<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 25, 2024 at 4:50 AM Lennart Poettering <<a href="mailto:lennart@poettering.net">lennart@poettering.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On So, 24.11.24 12:35, Michael Kilburn (<a href="mailto:crusader.mike@gmail.com" target="_blank">crusader.mike@gmail.com</a>) wrote:<br>
<br>
> Hi,<br>
><br>
> OS: Pop!_OS 22.04 LTS (Debian-based distro). User service (fluidsynth)<br>
> fails to start on user login:<br>
><br>
> ALSA lib seq_hw.c:466:(snd_seq_hw_open) open /dev/snd/seq failed:<br>
> Permission denied<br>
><br>
> because at that moment that device's ACL was not updated yet (to grant<br>
> access to the user being logged in).<br>
><br>
> When an active user logs in udev executes rules stored in<br>
> /lib/udev/rules.d/70-uaccess.rules (via 73-seat-late.rules) to grant that<br>
> user access to local devices (like soundcard, etc).<br>
><br>
> Is there a way to express this dependency between user service and<br>
> completion of execution of udev rules?<br>
><br>
> Or (if this is a wrong approach) -- what is the correct way to deal with<br>
> this?<br>
<br>
"uaccess" ḿeans access to devices can come and go any time, as the<br>
user switches sessions, as sessions come and go. This means programs<br>
which want access to such devices need to be written with this in<br>
mind: watch udev events, and try to reopen the devices whenever you<br>
receive an event for the relevant audio device and access is<br>
permitted. (logind will re-retrigger relevant devices whenever the fg<br>
session changes, so that the udev rules are rerun and apps are<br>
notified about the new situation via udev events)<br></blockquote><div><br></div><div>Turns out, related udev rule(s) only mark /dev/snd devices with "uaccess" tags, actual ACL update happens in logind. And (to my knowledge) there is no event/condition/target you could use to wait for this ACL update to happen. This is the main problem. Waiting in a loop doesn't look like a proper solution at all. Which means user services that need access to these devices are kind of in limbo... You can't configure them to auto-run, have to use hacks.<br></div></div><div class="gmail_quote"><br></div><div class="gmail_quote">If the device "goes away" (because of a user switch) -- it is not a problem in this case... fluid synth needs to open /de/snd/seq only once (and keeps it open, afaik).<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">Regards,<br>Michael.</div></div>