]> git.ipfire.org Git - thirdparty/systemd.git/commit
systemctl: downgrade or silence warnings for --now 39456/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 26 Oct 2025 10:57:56 +0000 (11:57 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 1 Nov 2025 09:25:39 +0000 (10:25 +0100)
commit77a1cc8fa09c264991d147ec71d70a4b5d2a553e
tree0d8c5040601bd3c2e8298310cfb085bde5175aba
parent0ff5985176acaccf4d2f220f92e14cd0f6ee82bf
systemctl: downgrade or silence warnings for --now

When calling systemctl enable/disable/reenable --now, we'd always fail with
error when operating offline. This seemly overly restricitive. In particular,
if systemd is not running at all, the service is not running either, so
complaining that we can't stop it is completely unnecessary. But even when
operating in a chroot where systemd is not running, let's just emit a warning
and return success. It's fairly common to have installation or package scripts
which do such calls and not starting/restarting the service in those scenarios
is the desired and expected operation. (If --now is called in combination
with --global or --root=, keep returning an error.)

Also make the messages nicer. I was adding some docs to tell the user to run
'systemctl enable --now', and checked how the command can fail, and the error
message that the user might see in some common scenarios was too complicated.
Split it up to be nicer.
src/systemctl/systemctl-enable.c