On Di, 25.01.22 13:04, Tomáš Hnyk (tomashnyk@xxxxxxxxx) wrote: > Hello, > I want to run a script invoked by udev to run a pactl script. I am now using > a udev rule SUBSYSTEM=="drm", ACTION=="change", > RUN+="/usr/local/bin/my_script" > > which calls (drew is my username): > systemctl --machine=drew@.host --user --now my.service > > > which has: > [Service] > Type=oneshot > ExecStart=/usr/local/bin/my_script.py > > and in the my_script.py, I do what I need. I cannot call my_script.py > directly > from the udev rule because, if I understood it correctly, scripts triggered > by udev run in a limited environment and pactl runs as user. > > Needless to say, this feels rather hackish. Ideally I would use something > like TAG+="systemd", ENV{SYSTEMD_WANTS}="my.service" > > I can specify "User=" in the service file but I could not figure out > to translate the --machine=drew@.host parameter to it. This is not supported. Containers run in their own little world, and generally get their own devices (i.e. just virtual devices such as /dev/null and similar), hence we do not have infra to propagate evnts to containers. Lennart -- Lennart Poettering, Berlin