robot_upstart permission folder denied
I have myrobotros.service file which auto run a launch during boot.
[Unit]
Description="bringup my_robot_ros"
After=network.target
[Service]
Type=simple
ExecStart=/usr/sbin/my_robot_ros-start
[Install]
WantedBy=multi-user.target
My launch file works just fine when I run it in the terminal but when it runs with myrobotros.service it has errors regarding permission in the folder as shown below.
my_robot_ros.service - "bringup my_robot_ros"
Loaded: loaded (/lib/systemd/system/my_robot_ros.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2023-01-06 13:50:36 PST; 13s ago
Main PID: 1812 (my_robot_ros-st)
Tasks: 34 (limit: 4915)
CGroup: /system.slice/my_robot_ros.service
├─1812 /bin/bash /usr/sbin/my_robot_ros-start
├─1869 /usr/bin/python3 /opt/ros/noetic/bin/roslaunch /tmp/my_robot_ros.launch
├─1881 /usr/bin/python3 /opt/ros/noetic/bin/rosmaster --core -p 11311 -w 3 __log:=/tmp/0c512cfa-8d86-11ed-8bd5-e45f01b0b2d0/master.log
├─1893 /opt/ros/noetic/lib/rosout/rosout __name:=rosout __log:=/tmp/0c512cfa-8d86-11ed-8bd5-e45f01b0b2d0/rosout-1.log
├─1896 /usr/bin/python3 /home/pi/servoing_ws/devel/lib/project/camROS.py __name:=camera __log:=/tmp/0c512cfa-8d86-11ed-8bd5-e45f01b0b2d0/camera-2.log
└─1902 /usr/bin/python3 /home/pi/servoing_ws/devel/lib/project/roverROS.py __name:=rover __log:=/tmp/0c512cfa-8d86-11ed-8bd5-e45f01b0b2d0/rover-4.log
Jan 06 13:50:39 raspberrypi my_robot_ros-start[1812]: /usr/bin/du: cannot read directory '/tmp/.vnc-vncservice': Permission denied
Jan 06 13:50:39 raspberrypi my_robot_ros-start[1812]: /usr/bin/du: cannot read directory '/tmp/systemd-private-69682e631638479ca9fbe5a239c33ccf-rtkit-daemon.service-PwCAft': Permission denied
Jan 06 13:50:39 raspberrypi my_robot_ros-start[1812]: /usr/bin/du: cannot read directory '/tmp/systemd-private-69682e631638479ca9fbe5a239c33ccf-systemd-timesyncd.service-oDig7w': Permission denied
Jan 06 13:50:39 raspberrypi my_robot_ros-start[1812]: /usr/bin/du: cannot read directory '/tmp/pulse-PKdhtXMmr18n': Permission denied
Jan 06 13:50:39 raspberrypi my_robot_ros-start[1812]: /usr/bin/du: cannot read directory '/tmp/systemd-private-69682e631638479ca9fbe5a239c33ccf-ModemManager.service-O0jBb0': Permission denied
Jan 06 13:50:47 raspberrypi my_robot_ros-start[1812]: Unable to init server: Could not connect: Connection refused
Jan 06 13:50:47 raspberrypi imageprocessing[1897]: cannot open display:
Jan 06 13:50:47 raspberrypi my_robot_ros-start[1812]: WARNING: Could not change permissions for folder [/tmp/0c512cfa-8d86-11ed-8bd5-e45f01b0b2d0], make sure that the parent folder has correct permissions.
Jan 06 13:50:47 raspberrypi my_robot_ros-start[1812]: [imageprocessing-3] process has died [pid 1897, exit code -11, cmd /home/pi/servoing_ws/devel/lib/project/imageprocessingROS.py __name:=imageprocessing __log:=/tmp/0c512cfa-8d86-11ed-8
Jan 06 13:50:47 raspberrypi my_robot_ros-start[1812]: log file: /tmp/0c512cfa-8d86-11ed-8bd5-e45f01b0b2d0/imageprocessing-3*.log
I think it is the reason why my imageprocessing node dies or stop working. Does anyone know how to solve this problem? Thank you
Asked by El on 2023-01-06 02:13:10 UTC
Answers
Jan 06 13:50:47 raspberrypi my_robot_ros-start[1812]: Unable to init server: Could not connect: Connection refused
Jan 06 13:50:47 raspberrypi imageprocessing[1897]: cannot open display:
A systemd service does not have a graphical desktop. You can not run code that requires a GUI from a systemd service, so you need to remove those commands from your script.
Asked by Mike Scheutzow on 2023-01-07 11:00:58 UTC
Comments