🎄⛄❄️🎁 It's beginning to look a lot like ADABOX-mas! The next ADABOX from Adafruit ships soon! Get yours now, or give as a gift! 🎄⛄❄️🎁
0

RGBMatrix, RGBMatrixOptions - asking for daemon password
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

RGBMatrix, RGBMatrixOptions - asking for daemon password

by DebraPeri on Tue Aug 13, 2019 2:08 pm

Hello,

I stumbled across a very strange thing with the python libs for the LED RGB matrix display. When I create an instance of RGBMatrix (see code below) I am prompted for a password for user 'daemon'. This code is part of a python script that accesses the bluetooth services so it has to run as root. I haven't done an exhaustive search through the rgbmatrix code but did notice that when the demos are run they appear as being owned by user 'daemon'. Where does that su occur? Can I get around this? Do I need to recompile the libraries with a different option? I''m stumped. Any help is appreciated.


Thanks,
Debra Peri


Code: Select all | TOGGLE FULL SIZE
   
from rgbmatrix import RGBMatrix, RGBMatrixOptions

def setup_RGB_matrix():

    logging.warning('Setting up LED RGB matrix  ...')

    options = RGBMatrixOptions()       
    options.rows = 32
    options.cols = 32
    options.chain_length = 1
    options.parallel = 1
    options.row_address_type = 0
    options.multiplexing = 0
    options.pwm_bits = 11
    options.brightness = 100
    options.pwm_lsb_nanoseconds = 130
    options.show_refresh_rate = 1
    options.gpio_slowdown = 1
    options.disable_hardware_pulsing = True

    matrix = RGBMatrix(options = options)
Attachments
Screen Shot 2019-08-13 at 10.58.39 AM.png
running as root the call to create an instance of RGBMatrix prompts for a password for user 'daemon'
Screen Shot 2019-08-13 at 10.58.39 AM.png (598.74 KiB) Viewed 193 times
Screen Shot 2019-08-13 at 10.58.14 AM.png
demo code running as user 'daemon'
Screen Shot 2019-08-13 at 10.58.14 AM.png (582.37 KiB) Viewed 193 times

DebraPeri
 
Posts: 26
Joined: Fri Sep 07, 2018 3:56 pm

Re: RGBMatrix, RGBMatrixOptions - asking for daemon password

by adafruit_support_carter on Thu Aug 15, 2019 4:04 pm

Not sure. If you run a
Code: Select all | TOGGLE FULL SIZE
whoami

before the sudo, what does it show as the user?

adafruit_support_carter
 
Posts: 13589
Joined: Tue Nov 29, 2016 2:45 pm

Re: RGBMatrix, RGBMatrixOptions - asking for daemon password

by DebraPeri on Thu Aug 15, 2019 4:40 pm

This is running on a Raspberry Pi, so the user is 'pi' before invoking sudo.

Code: Select all | TOGGLE FULL SIZE
pi@pi-abcs:~ $ whoami
pi
pi@pi-abcs:~ $ id
uid=1000(pi) gid=1000(pi) groups=1000(pi),4(adm),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),101(input),108(netdev),997(gpio),998(i2c),999(spi
)


When I su into root and run the python script I am still prompted for a password. The UDP debug message comes from code that is executed after creating an instance of an RGBMatrix object (after setting the options, matrix = RGBMatrix(options = options) ), so it appears that it's creating a separate thread (which is sending the "285.1Hz" messages to the console.

As root, starting the script:

Code: Select all | TOGGLE FULL SIZE
root@pi-abcs:/home/pi/dev/bluetooth/abcs-muse# ./abcs.py
 273.0Hz*************************     MAIN      ************************************************
 285.1Hz('*** Testing UDP ', 0)
 286.9Hz('*** Testing UDP ', 1)
 286.8Hz('*** Testing UDP ', 2)

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for  287.4Hz


Any help is deeply appreciated. The project is for capturing EEG signals from a Muse headband that I want to control the RGB LED display. I hope to use more of these RGB LED displays in other projects so it's very helpful for me to know how to use the supplied libraries correctly. Thanks for your help!

DebraPeri
 
Posts: 26
Joined: Fri Sep 07, 2018 3:56 pm

Re: RGBMatrix, RGBMatrixOptions - asking for daemon password

by adafruit_support_carter on Thu Aug 15, 2019 5:30 pm

Can you provide more details on the hardware. What RGB matrix are you using? How is it connected to the Pi?

adafruit_support_carter
 
Posts: 13589
Joined: Tue Nov 29, 2016 2:45 pm

Re: RGBMatrix, RGBMatrixOptions - asking for daemon password

by DebraPeri on Thu Aug 15, 2019 5:50 pm

I'm using the 64x64 RGB LED Matrix display:
https://www.adafruit.com/product/3649

It's connected to the pi with the Adafruit RGB Matrix Bonnet:
https://www.adafruit.com/product/3211

DebraPeri
 
Posts: 26
Joined: Fri Sep 07, 2018 3:56 pm

Re: RGBMatrix, RGBMatrixOptions - asking for daemon password

by adafruit_support_carter on Thu Aug 15, 2019 6:09 pm

Does the basic hardware work per the guide?
https://learn.adafruit.com/adafruit-rgb ... spberry-pi

One thing to make sure with the 64x64 matrix and the Bonnet is to solder close the jumper as described here:
https://learn.adafruit.com/adafruit-rgb ... ep-2982866

Can you get the examples to work?
https://learn.adafruit.com/adafruit-rgb ... mples-4-30

adafruit_support_carter
 
Posts: 13589
Joined: Tue Nov 29, 2016 2:45 pm

Re: RGBMatrix, RGBMatrixOptions - asking for daemon password

by DebraPeri on Thu Aug 15, 2019 6:11 pm

Yes, all the hardware works and the demo works perfectly.

DebraPeri
 
Posts: 26
Joined: Fri Sep 07, 2018 3:56 pm

Re: RGBMatrix, RGBMatrixOptions - asking for daemon password

by DebraPeri on Thu Aug 15, 2019 6:17 pm

Here's the way I start the demo:

Code: Select all | TOGGLE FULL SIZE
pi@pi-abcs:~/rpi-rgb-led-matrix/examples-api-use $ sudo nice ./demo -D 6 -m 10  --led-rows=64 --led-cols=64 --led-brightness=10
Size: 64x64. Hardware gpio mapping: adafruit-hat
Press <CTRL-C> to exit and reset LEDs

DebraPeri
 
Posts: 26
Joined: Fri Sep 07, 2018 3:56 pm

Re: RGBMatrix, RGBMatrixOptions - asking for daemon password

by adafruit_support_carter on Thu Aug 15, 2019 6:18 pm

Can you share the full code for test_it.py shown in your first post.

adafruit_support_carter
 
Posts: 13589
Joined: Tue Nov 29, 2016 2:45 pm

Re: RGBMatrix, RGBMatrixOptions - asking for daemon password

by adafruit_support_mike on Thu Aug 15, 2019 6:20 pm

The hezeller code has a command line option '--led-daemon', which makes it run in the background.

That option is usually called from a startup script that launches the code when the RasPi boots.

adafruit_support_mike
 
Posts: 59487
Joined: Thu Feb 11, 2010 2:51 pm

Re: RGBMatrix, RGBMatrixOptions - asking for daemon password

by DebraPeri on Thu Aug 15, 2019 6:22 pm

And the demo code runs as user 'daemon', which must be happening in the complied demo code:

Code: Select all | TOGGLE FULL SIZE
pi@pi-abcs:~/rpi-rgb-led-matrix/examples-api-use $ ps -ef | grep demo
root      1532   811  0 15:11 pts/1    00:00:00 sudo nice ./demo -D 6 -m 10 --led-rows=64 --led-cols=64 --led-brightness=10
daemon    1536  1532 75 15:11 pts/1    00:01:35 ./demo -D 6 -m 10 --led-rows=64 --led-cols=64 --led-brightness=10


Is there a switch or something that the rgbmatrix libs can run as a different user? It's getting confusing because the demo code needs to run as root via sudo:

Code: Select all | TOGGLE FULL SIZE
pi@pi-abcs:~/rpi-rgb-led-matrix/examples-api-use $ nice ./demo -D 6 -m 10  --led-rows=64 --led-cols=64 --led-brightness=10
Must run as root to be able to access /dev/mem
Prepend 'sudo' to the command


:-(

DebraPeri
 
Posts: 26
Joined: Fri Sep 07, 2018 3:56 pm

Re: RGBMatrix, RGBMatrixOptions - asking for daemon password

by DebraPeri on Thu Aug 15, 2019 6:23 pm

adafruit_support_mike wrote:The hezeller code has a command line option '--led-daemon', which makes it run in the background.

That option is usually called from a startup script that launches the code when the RasPi boots.


I saw that but my code is calling the lib via the python binding. Is there a switch that can be passed via python? I haven't found it.

DebraPeri
 
Posts: 26
Joined: Fri Sep 07, 2018 3:56 pm

Re: RGBMatrix, RGBMatrixOptions - asking for daemon password

by DebraPeri on Thu Aug 15, 2019 6:43 pm

This is all I can find in the python bindings:


Code: Select all | TOGGLE FULL SIZE
Python 2.7.13 (default, Sep 26 2018, 18:42:22)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import rgbmatrix
>>> opt = rgbmatrix.RGBMatrixOptions()
>>> opt.daemon
0
>>> opt.daemon = 1
>>> opt.daemon
1
>>>


Could this flag be related?

DebraPeri
 
Posts: 26
Joined: Fri Sep 07, 2018 3:56 pm

Re: RGBMatrix, RGBMatrixOptions - asking for daemon password

by DebraPeri on Thu Aug 15, 2019 6:46 pm

When I set that flag, this error message appears in /var/log/auth.log and the program exits.

Code: Select all | TOGGLE FULL SIZE
Aug 15 15:40:30 pi-abcs sudo:       pi : TTY=pts/0 ; PWD=/home/pi/dev/bluetooth/abcs-muse ; USER=root ; COMMAND=./abcs.py
Aug 15 15:40:30 pi-abcs sudo: pam_unix(sudo:session): session opened for user root by pi(uid=0)
Aug 15 15:40:32 pi-abcs sudo: pam_unix(sudo:session): session closed for user root
Aug 15 15:40:35 pi-abcs sudo: pam_unix(sudo:auth): conversation failed
Aug 15 15:40:35 pi-abcs sudo: pam_unix(sudo:auth): auth could not identify password for [daemon]
Aug 15 15:40:35 pi-abcs sudo: pam_unix(sudo:auth): conversation failed
Aug 15 15:40:35 pi-abcs sudo: pam_unix(sudo:auth): auth could not identify password for [daemon]

DebraPeri
 
Posts: 26
Joined: Fri Sep 07, 2018 3:56 pm

Re: RGBMatrix, RGBMatrixOptions - asking for daemon password

by adafruit_support_carter on Thu Aug 15, 2019 7:02 pm

Are you running Python with elevated privileges?
https://github.com/hzeller/rpi-rgb-led- ... he-library

adafruit_support_carter
 
Posts: 13589
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.