From 823e5fabb783d452607ff8ccaa5235af14eb44eb Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Thu, 19 May 2016 16:37:04 +0200 Subject: systemctl: reload configuration when enabling sysv units too (#3297) After enabling/disabling a unit, the daemon configuration is expected to be unless '--no-reload' option is passed. However this is not done when enabling a sysv units. This can lead to the following scenario: $ cp /etc/init.d/named /etc/init.d/foo $ systemctl enable foo foo.service is not a native service, redirecting to systemd-sysv-install Executing /usr/lib/systemd/systemd-sysv-install enable foo $ systemctl start foo Failed to start foo.service: Unit foo.service failed to load: No such file or directory. This can also be seen after installing a package providing a sysv service: the service can't be started unless 'daemon-reload' is called manually. This shouldn't be needed and this patch will fix this case too since during package installation, the service is expected to be enabled/disabled. --- src/systemctl/systemctl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/systemctl') diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 3b4678c119..fe24b936ec 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -5478,8 +5478,11 @@ static int enable_unit(int argc, char *argv[], void *userdata) { return r; /* If the operation was fully executed by the SysV compat, let's finish early */ - if (strv_isempty(names)) - return 0; + if (strv_isempty(names)) { + if (arg_no_reload || install_client_side()) + return 0; + return daemon_reload(argc, argv, userdata); + } if (install_client_side()) { if (streq(verb, "enable")) { -- cgit v1.2.3-54-g00ecf