correctly removing systemd socket unit on package upgrade
Thomas Lamprecht
t.lamprecht at proxmox.com
Fri Feb 19 13:48:32 GMT 2016
Hi again,
On 01/11/2016 09:38 AM, Thomas Lamprecht wrote:
> Hi all,
>
> I building a deb package where I removed a socket unit file as I have
> no need for it anymore (to be exact, it mustn't be loaded anymore).
>
> The question is now how to achieve a clean removal of this .socket
> file on a package upgrade, so that systemd doesn't tries to load it
> anymore and thus outputs:
>> systemd[1]: Cannot add dependency job for unit watchdog-mux.socket,
>> ignoring: Unit watchdog-mux.socket failed to load: No such file or
>> directory.
>
>
> Should I do it simply in postinst with something like:
>
>> [...]
>> configure)
>>
>> # remove the systemd watchdog-mux socket service
>> # as watchdog-mux should handle this on it's own
>> rm -f /etc/systemd/system/sockets.target.wants/watchdog-mux.socket
>
>
> Or is there a cleaner (automated way) to achieve this?
>
> best regards,
> Thomas
>
>
In the hope this was simply overlooked: ping
I went for the post install script way which does effectively:
> # remove the systemd watchdog mux socket service
> # as watchdog-mux should handle this on it's own
> if [ -L /etc/systemd/system/sockets.target.wants/watchdog-mux.socket
> ]; then
> rm -f /etc/systemd/system/sockets.target.wants/watchdog-mux.socket
> rm -f
> /var/lib/systemd/deb-systemd-helper-enabled/sockets.target.wants/watchdog-mux.socket
> rm -f
> /var/lib/systemd/deb-systemd-helper-enabled/watchdog-mux.socket.dsh-also
> systemctl daemon-reload
> fi
Which also has it's issue if someone disabled the socket (with whichever
reason he had) as I only check for the link, solvable through an better
if condition, though.
It still seems like a ugly hack to me and as I did not found a resource
or example which handled such a case,
I'm hoping that anyone could point me out to such a resource (sorry if i
was to stupid to overlook a obvious one).
cheers,
Thomas
More information about the Pkg-systemd-maintainers
mailing list