]> git.ipfire.org Git - thirdparty/systemd.git/commit
shared/install: print warning when unmasking unit with cmdline mask 24461/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 26 Aug 2022 10:02:43 +0000 (12:02 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 13 Oct 2022 17:44:47 +0000 (19:44 +0200)
commitbf3b0d5f29d769fc248808d323ee95b23eae86df
tree6ceac07c732455b4e262a0a0d08fdb69a32c0f21
parentacb5b834381c7938c371b0b2a912bd8c420c4a4d
shared/install: print warning when unmasking unit with cmdline mask

'systemctl unmask foo' will try to remove the symlink to /dev/null under /etc/.
But the unit may also be masked by a symlink under /run/generator, in particular
the one created by systemd-debug-generator based on systemd.mask=foo on the
kernel commandline. The unmask call cannot anything about this: even if it removed
the symlink from /run/generator, it'll be recreated on the next daemon-reload.
Thus, we can only warn about it.

Initially, I wanted to check if 'systemctl.mask' is defined on the kernel
command-line, but that's not effective, because such mask symlinks can be
created by other generators based on other conditions. Checking for runtime
mask is "dumber", but is more robust because it doesn't assume who created the
mask and why.

The handling of InstallInfo is the copied from install_info_symlink_wants().
It's pretty ugly, this whole code should be rewritten from scratch.

The message is printed, but the whole operation is still "successful". This
keep backwards compatibility: people might call unmask to remove filesystem
masks even if there's still a cmdline param in place. We allow 'systemctl
mask' to create such a mask, so 'unmask' should be able to remove it.

Fixes #22689.
src/shared/install.c
src/shared/install.h