Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add systemd WorkingDirectory to service template #125

Open
symmetryninja opened this issue Sep 22, 2024 · 0 comments
Open

Please add systemd WorkingDirectory to service template #125

symmetryninja opened this issue Sep 22, 2024 · 0 comments

Comments

@symmetryninja
Copy link

Greetings, I love this plugin and use it often!

Recently I've attempted to use robot_upstart to run a ros launch file that called a service that uses the LGPIO library (https://pypi.org/project/rpi-lgpio/) to interact with the GPIO pins on the PI. The lgpio library creates some sort of hardlink or softlink to call the gpio access with non-root privileges, it does this wherever the launch file is executed.

When run as a service, the launch file is triggered in a folder unwritable to the user and thus can't create the link and therefore can't call the GPIO pins.

Guidance on the internets is to run the service as root, which is clearly a bad idea.

After running the upstart in python, I can make the code work by editing the service file:

# THIS IS A GENERATED FILE, NOT RECOMMENDED TO EDIT.
[Unit]
Description="bringup gpio_flasher"
After=network.target
[Service]
Type=simple
ExecStart=/usr/sbin/gpio_flasher-start
WorkingDirectory=/home/ubuntu/ros2_ws
[Install]
WantedBy=multi-user.target

It would be great if this was part of the python code so this hacky fix could survive re-runs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant