Suggestion - Update docs to add service users to /etc/group gpio group #141
-
Great project BTW and fantastic documentation!!! Just a suggestion, I followed the installation guide for setup. I was unsure if the systemd service needed a dedicated user or not. I went ahead and created a user and group named mqttany. I updated the /etc/systemd/system/mqttany.service file to set User=mqttany and Group=mqttany. I then tried to start the service. Service would not start. journalctrl -u mqttany showed the following error: 2022-03-11 09:46:48,501 [INFO ] [core.gpio ] Detected board: After looking at the init.py file it appears the problem was that the user I setup did not have the ability to read the gpio pins. I solved the problem by editing /etc/group to add my mqttany user to the gpio group. After that I restarted the service and it runs fine now. Not sure why os.getlogin() fails, but might suggest updating docs to add user to that group. Running an Raspberry Pi 4 on Raspbian 10 (buster) fully up-to-date. Also documenting to help anyone else with this problem. Great project, thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @jhuettner sorry it took so long to respond to this! The first half of this year wasn't great for me and this must have slipped through the cracks. Thank you for your kind words. It is up to you if you want to create a dedicated user, but MQTTany is happy to run as any user. The need for permissions is documented in each module's documentation as different permissions may be needed for different modules. This is indicated at the top of the GPIO page. That said, however, the call to |
Beta Was this translation helpful? Give feedback.
Hi @jhuettner sorry it took so long to respond to this! The first half of this year wasn't great for me and this must have slipped through the cracks. Thank you for your kind words.
It is up to you if you want to create a dedicated user, but MQTTany is happy to run as any user.
The need for permissions is documented in each module's documentation as different permissions may be needed for different modules. This is indicated at the top of the GPIO page.
That said, however, the call to
os.getlogin()
is meant only to return the user MQTTany is running as for the log message that says you don't have permissions. I'm not sure why it failed but that is a bug and warrants investigation. I have …