calliope-edu / CalliopEO_AstroPi

MIT License
1 stars 2 forks source link

Access denied to port /dev/ttyACM0 #13

Closed Amerlander closed 3 years ago

Amerlander commented 3 years ago

When executed as calliopeI get the following error: [Errno 13} could not open port /dev/ttyACM0: [Errno 13] Permission denied: '/dev/ttyACM0'

User calliope is part of dialout and dialout exists. /dev/ttyACM0 is owned by root:dialout and has 660 permissions. Chown 666 doesnt change anything.

rzbrk commented 3 years ago

Interesting ...

For my tests at home, I used a "stock" Raspberry Pi OS. More precisely, the "Lite" (headless) version, but I assume this makes no difference here.

pi@pimuckl:~ $ cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" NAME="Raspbian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

pi@pimuckl:~ $ cat /proc/cpuinfo | grep Model Model : Raspberry Pi 3 Model B Plus Rev 1.3

Mit angeschlossenem Calliope Mini:

pi@pimuckl:~ $ ls -l /dev/ttyA* crw-rw---- 1 root dialout 166, 0 Jul 6 09:55 /dev/ttyACM0 crw-rw---- 1 root dialout 204, 64 Jul 4 14:24 /dev/ttyAMA0

What did you use? Did you use the security-hardened OS provided by ESA?

rzbrk commented 3 years ago

I uploaded the current code to my Raspberry Pi (see above) and tried to execute the code.

I have the same issue:

calliope@pimuckl:~/src/CalliopEO_AstroPi $ pipenv run python CalliopEO.py

programming: /home/calliope/src/CalliopEO_AstroPi/run_060721-0959/temp01.hex Status: Port must be configured before it can be used. Status: [Errno 13] could not open port /dev/ttyACM0: [Errno 13] Permission denied: '/dev/ttyACM0'

I am afraid, we broke the code ...

Will check the details later.

Amerlander commented 3 years ago

It is becouse we now try to connect in the try/catch loop to the mini. As the mini restarts it is not available, the root user seem to be okay with that, but the unprivileged user raises the error and stops the script.

Uncommenting the line https://github.com/calliope-edu/CalliopEO_AstroPi/blob/9b798b1748aa2f74efba070e3a22d05b0512907c/CalliopEO.py#L212 and adding the sleep(20) again solves it. Maybe there is something else we can do?

rzbrk commented 3 years ago

BTW, I am currently fixing this issue. Will take some more time ....

rzbrk commented 3 years ago

Fixed with #16