1

systemd doesn't stop the service when the device is removed suggests adding a remove rule to udev which simply runs systemd --no-block stop SOMETHING.service

But what if the unit in question is a user unit, started with ENV{SYSTEMD_USER_WANTS}? systemd --user --no-block stop SOMETHING.service will fail, I assume because udev runs it as not the user for which the unit should be stopped.

0

One solution is to not try running systemd commands from udev, but instead use StopWhenUnneeded=true. This does however require fixing an underlying issue with the device unit which I've detailed in another answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.