Bug 68175

Summary: systemctl: add a disable option to disable all missing units with only one command
Product: systemd Reporter: Pacho Ramos <pachoramos1>
Component: generalAssignee: systemd-bugs
Status: RESOLVED WONTFIX QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Pacho Ramos 2013-08-16 07:58:30 UTC
Usually, when I remove a lot of apps, I see the situation of needing to disable all their units one by one to prevent systemd from trying to start them on every reboot. Would be nice if systemctl could have an option to remove all now missing units (that are now missing links in /etc then) with only one command invocation

Thanks
Comment 1 Lennart Poettering 2013-09-12 17:19:16 UTC
Humm, your packaging system is quite broken if it leaves those dead links around...

I think this command should be enough for what you are trying to do, no?

  find /etc/systemd/system -type l -exec test ! -e {} \; -delete

I am not convinced that we need explicit functionality for this in systemd, especially since this is brokeness in your package management scripts I think.
Comment 2 Pacho Ramos 2013-09-12 18:25:28 UTC
Not sure what are we supposed to do downstream. I guess, running "systemctl remove" for all provided units when the package is removed?
Comment 3 Lennart Poettering 2013-09-12 18:46:07 UTC
(In reply to comment #2)
> Not sure what are we supposed to do downstream. I guess, running "systemctl
> remove" for all provided units when the package is removed?

There is no "remove".

Use "systemctl disable" and then "systemctl stop" for all units your package installed.
Comment 4 Lennart Poettering 2013-09-12 18:46:42 UTC
(Just to provide some context: for RPM we do this with these macros: http://cgit.freedesktop.org/systemd/systemd/tree/src/core/macros.systemd.in )
Comment 5 Pacho Ramos 2013-09-12 18:50:41 UTC
Sorry for the "remove", was probably due replying to this after hours of work :(

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.