I’m digging into a problem with udev device detection on Ubuntu Core. I’ve created a simple snap using udevadm which you can reproduce the issue with: http://pastebin.ubuntu.com/25817127/. Install with --devmode.
If I run the snap as an app, it works correctly:
snap run udevadm-monitor
and plug/unplug a USB mouse/keyboard. This is my output: http://pastebin.ubuntu.com/25817138/
If I run the same app as a daemon however, I see problems. Begin with the USB device unplugged, and start the daemon:
sudo systemctl start snap.udevadm-monitor.udevadm-monitor.service
Observe the live journalctl output (sudo journalctl -f) and plug/unplug the USB device. I see nothing being printed by udevadm. I do see the correct kernel messages indicating USB device plug/unplugged.
But when I stop the daemon with
sudo systemctl start snap.udevadm-monitor.udevadm-monitor.service
I get the output from udevadm that I was expecting. So it looks like udevadm was blocked somehow at startup, before it printed its usual message. Here is my journalctl output showing the strangeness: http://pastebin.ubuntu.com/25817184/
Or is journald doing some per-client buffering that is totally throwing me off?
I’m able to reproduce with a Raspberry Pi3, and Ubuntu Core in a VM. The reason I ask is that we’re seeing this problem with device detection for Mir, and the udevadm behaviour here exactly replicates how Mir behaves.
I’m here to ask for ideas. What kind of differences might exist in the environment between the unconfined app, and unconfined daemon? Devmode should mean confinement isn’t interfering, right? I’m going over straces:
Strace of udevadm run as snap app (working): http://pastebin.ubuntu.com/25817409/
Strace of udevadm run as snap daemon (bad): http://pastebin.ubuntu.com/25817423/
I see that the epoll calls are very different, which I’m looking into now. But I’d really appreciate if anyone had some suggestions.
Thanks
-G