Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Desktop/apps don't receive uevents (hardware changes) #1

Open
martinpitt opened this issue Dec 18, 2022 · 4 comments
Open

Desktop/apps don't receive uevents (hardware changes) #1

martinpitt opened this issue Dec 18, 2022 · 4 comments
Labels
blocker bug Something isn't working help wanted Extra attention is needed

Comments

@martinpitt
Copy link
Owner

A running sway desktop does not recognize new input devices (such as plugging in a Yubikey), changed monitors (docking/undocking), or USB drives. This is most probably because it does not receive any uevents: udevadm monitor -e --udev does not do anything in swaypod. The kernel's netlink socket is an abstract Unix socket, so it can't simply be bind-mounted.

This does not work in a standard Fedora toolbox either. I am not sure if this can be made to work at all with current Linux/podman -- if not, then that is a dealbreaker, and the "run desktop in container" concept is fundamentally broken.

@martinpitt martinpitt added bug Something isn't working blocker help wanted Extra attention is needed labels Dec 18, 2022
@martinpitt
Copy link
Owner Author

I filed a toolbox issue and also asked on Mastodon, perhaps some great mind has an idea?

@martinpitt
Copy link
Owner Author

@brauner implemented uevent forwarding in the kernel a few years ago, and pointed me to https://github.com/lxc/lxd/pull/5099 which implements an uevent forwarder in lxd. Curiously the actually interesting piece of code is commented out. In principle this isn't difficult, though: "You can receive the uevent in the host netns, then you cut off it's seqnum field, write it into a uevent socket of the target netns (of the container) and the kernel will append a new seqnum and send it to the target netns.". This is a great thing to try on my next long train ride or so 😁 Thanks Christian!

@89luca89 created https://github.com/89luca89/distrobox/. This is very similar to toolbox (especially while it was still in shell). I quickly tested that (thanks for making it trivial to run straight out of git!), and unsurprisingly it suffers from the same problem, there is no mechanics for forwarding uevents. So once we have some solution, that may be interesting for you as well?

@brauner
Copy link

brauner commented Dec 19, 2022

@brauner implemented uevent forwarding in the kernel a few years ago, and pointed me to lxc/lxd#5099 which implements an uevent forwarder in lxd. Curiously the actually interesting piece of code is commented out. In principle this isn't difficult, though: "You can receive the uevent in the host netns, then you cut off it's seqnum field, write it into a uevent socket of the target netns (of the container) and the kernel will append a new seqnum and send it to the target netns.". This is a great thing to try on my next long train ride or so 😁 Thanks Christian!

@89luca89 created https://github.com/89luca89/distrobox/. This is very similar to toolbox (especially while it was still in shell). I quickly tested that (thanks for making it trivial to run straight out of git!), and unsurprisingly it suffers from the same problem, there is no mechanics for forwarding uevents. So once we have some solution, that may be interesting for you as well?

@martinpitt the code isn't commented out. It's cgo ad it's called from a constructor in another file. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocker bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants