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.
This commit is contained in:
@@ -32,6 +32,7 @@ enum {
|
||||
INSTALL_CHANGE_SYMLINK,
|
||||
INSTALL_CHANGE_UNLINK,
|
||||
INSTALL_CHANGE_IS_MASKED,
|
||||
INSTALL_CHANGE_IS_MASKED_GENERATOR,
|
||||
INSTALL_CHANGE_IS_DANGLING,
|
||||
INSTALL_CHANGE_DESTINATION_NOT_PRESENT,
|
||||
INSTALL_CHANGE_AUXILIARY_FAILED,
|
||||
|
||||
Reference in New Issue
Block a user