Hi,
I’m trying to get Install Processing on Linux | Snap Store up and running for a family member in combination with an Arduino Uno connected on /dev/ttyACM0.
Processing just shows an error that it could not find the serial port. So I started to dig …
$ snap run --strace="-f -e openat -s 1024" processing
[pid 12509] openat(AT_FDCWD, "/dev/ttyACM0",
O_RDWR|O_NOCTTY|O_NONBLOCK) = -1 EPERM (Vorgang nicht zulässig)
Just to confirm it’s not a general permission issue I also checked the device and group permission:
$ ls -la /dev/ttyACM0
crw-rw---- 1 root dialout 166, 0 Jun 27 20:38 /dev/ttyACM0
$ groups
adm dialout cdrom sudo dip plugdev users lpadmin
Reading a bit about snap interfaces it seems one has to add the plug serial-port to the snap. According to hxxs://snapcraft.io/docs/serial-port-interface and the linked go code in hxxs://github.com/snapcore/snapd/blob/master/interfaces/builtin/serial_port.go that should cover /dev/ttyACM0 as well.
I found the explanation in https://askubuntu.com/questions/1178913/adding-a-plug-or-interface-to-existing-snap on how to quickly modify a snap locally, and added the serial-port plug, installed it and connected it.
$ snap connections processing
Schnittstelle Plug Slot Notizen
audio-playback processing:audio-playback :audio-playback -
audio-record processing:audio-record - -
desktop processing:desktop :desktop -
desktop-legacy processing:desktop-legacy :desktop-legacy -
gpio processing:gpio - -
home processing:home :home -
network processing:network :network -
opengl processing:opengl :opengl -
pulseaudio processing:pulseaudio - -
removable-media processing:removable-media - -
serial-port processing:serial-port - -
wayland processing:wayland :wayland -
x11 processing:x11 :x11 -
$ snap interface serial-port
name: serial-port
summary: allows accessing a specific serial port
documentation: https://snapcraft.io/docs/serial-port-interface
plugs:
- arduino
- processing
But still I get the original error and see the same access failure when running strace.
I wanted to dig a bit further into the apparmor profile which I suspect is blocking it, I could not find anything with “snappy-debug” related to access to /dev, but
$ sudo aa-status |grep processing
snap-update-ns.processing
snap.processing.processing
shows it’s getting a policy enforced.
I tried to
$ sudo aa-complain /var/lib/snapd/apparmor/profiles/snap.processing.processing
Profile for /var/lib/snapd/apparmor/profiles/snap.processing.processing
not found, skipping
Now I’m lost how to set this policy back to complain mode, any ideas? Looking through the policy file I do not see anything covering /dev/tty*, thus I still suspect that could be a source of the blocked access.
I also looked into the snap file for the Arduino IDE where the device access works, but they also just define the visible plug for serial-port.
As a workaround I installed it now with --devmode. That at least works.
Would be grateful if someone could provide a hint what is missing or what I could try to narrow it down further. The sad thing is that processing is used as an example in an official Arduino book, thus the user experience of Ubuntu and the Arduino kit with the processing sample is rather bad right now.
Sven