Description of problem: The systemctl --is-enabled option should return a non-zero exit code if none of the specified unit files is enabled. It always returns a zero exit code. Version-Release number of selected component (if applicable): # systemctl --version systemd 25 fedora +PAM +LIBWRAP +AUDIT +SELINUX +SYSVINIT +LIBCRYPTSETUP How reproducible: Always Steps to Reproduce: # systemctl disable NetworkManager.service rm '/etc/systemd/system/dbus-org.freedesktop.NetworkManager.service' rm '/etc/systemd/system/multi-user.target.wants/NetworkManager.service' # # systemctl is-enabled NetworkManager.service || echo NetworkManager is not enabled # # ls /etc/systemd/system/*.wants/NetworkManager.service ls: cannot access /etc/systemd/system/*.wants/NetworkManager.service: No such file or directory Actual results: As above Expected results: # systemctl is-enabled NetworkManager.service || echo NetworkManager is not enabled NetworkManager is not enabled Additional info: The final ls shows that NetworkManager is not enabled.
hmm, weird... do you have any additional links to NM in /etc/systemd or /lib/systemd? This works fine here...
Yes, in /lib/systemd: [root@plum ~]# systemctl disable NetworkManager.service rm '/etc/systemd/system/dbus-org.freedesktop.NetworkManager.service' rm '/etc/systemd/system/multi-user.target.wants/NetworkManager.service' rm '/etc/systemd/system/network.target.wants/NetworkManager.service' [root@plum ~]# systemctl is-enabled NetworkManager.service || echo NetworkManager is not enabled [root@plum ~]# find /etc/systemd /lib/systemd -name "*Manager*" /lib/systemd/system/NetworkManager-wait-online.service /lib/systemd/system/NetworkManager.service
Hmm, this is really weird, and I cannot reproduce this here... If you downgrade to systemd 24, do things work there?
Oh. It works fine with systemd-24-1. Fails with systemd-25-1.
Exactly the same problem here. I see the same problem with all services (dhcpd,atd,ntpd) I have tried it with. I've just wanted to create a new bug and found this one. It's a clear installation in VM. systemd-24-1 works fine. Fails with systemd-25-1 and systemd-26-1.
I can reproduce with "systemctl is-enabled ntpd.service". strace shows that systemctl opens the unit file, but it never reads anything from it: open("/etc/systemd/system/ntpd.service", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/lib/systemd/system/ntpd.service", O_RDONLY|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC) = 4 fcntl(4, F_GETFL) = 0xa8000 (flags O_RDONLY|O_LARGEFILE|O_NOFOLLOW|O_CLOEXEC) fstat(4, {st_mode=S_IFREG|0644, st_size=209, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f806fcc1000 lseek(4, 0, SEEK_CUR) = 0 close(3) = 0 exit_group(0) = ? This is the problem in install_info_apply(): /* Consider unit files stored in /lib and /usr always enabled * if they have no [Install] data. */ if (streq(verb, "is-enabled") && strv_isempty(i->aliases) && strv_isempty(i->wanted_by) && !path_startswith(filename, "/etc")) return 1; If systemctl never reads the file, it cannot know whether there is an [Install] section or not. config_parse() is called only after the above test.
Discussed in the 2011-05-06 blocker review meeting. Rejected as NTH as there is no clear rationale for accepting it. If the fix does not get pushed to stable before the freeze, this can be re-proposed as NTH.
The rationale is that it's a command used by both admins and scripts to take action (Is this service enabled, if so, do something...) and it's not working properly. Admittedly, this may not be in the boot path or the release criteria.
(In reply to comment #7) > Discussed in the 2011-05-06 blocker review meeting. Rejected as NTH as there is > no clear rationale for accepting it. > > If the fix does not get pushed to stable before the freeze, this can be > re-proposed as NTH. Apparently, I have too many tabs open - this comment went into the wrong bug. Still discussed in the 2011-05-06 blocker meeting. Rejected as NTH because there was no clear scenario for something for which a post-release update wouldn't be an acceptable fix. This can be re-proposed as NTH later if there is a more specific reason as to why it can't be fixed with a post-release update.
This problem is adversely affecting puppet where service resources are to be disabled. For example, the following manifest snippet to enforce that ntpd runs on all but kvm guests (which have clocks inherently sync'd to their host): service { "ntpd": enable => $virtual ? { "kvm" => false, default => true, }, ensure => $virtual ? { "kvm" => stopped, default => running, }, } With Fedora 15 and the above, puppet will perpetually ask systemd (via chkconfig) to disable the service, even if it's already disabled and this generates lots of email/log noise. Puppet essentially calls 'chkconfig SERVICE_NAME' to learn if the service is enabled or not. An update to resolve this would be most appreciated.
*** Bug 712818 has been marked as a duplicate of this bug. ***
"Common F15 Bugs" page mentions this command for fixing service-not-enabled-after-update issue, so it's quite important that this command works fine. This bug should be high priority https://fedoraproject.org/wiki/Common_F15_bugs#upgrade-disabled-services
Patch: http://lists.freedesktop.org/archives/systemd-devel/2011-June/002594.html
systemd-26-4.fc15 has been submitted as an update for Fedora 15. https://admin.fedoraproject.org/updates/systemd-26-4.fc15
Package systemd-26-4.fc15: * should fix your issue, * was pushed to the Fedora 15 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing systemd-26-4.fc15' as soon as you are able to, then reboot. Please go to the following url: https://admin.fedoraproject.org/updates/systemd-26-4.fc15 then log in and leave karma (feedback).
This latest update does not seem to fix the problem for me. As shown below, is-enabled now always returns 1: $ rpm -q systemd systemd-26-4.fc15.x86_64 $ systemctl status ntpd.service ntpd.service - Network Time Service Loaded: loaded (/lib/systemd/system/ntpd.service) Active: active (running) since Mon, 20 Jun 2011 11:40:55 -0400; 5min ago Main PID: 24358 (ntpd) CGroup: name=systemd:/system/ntpd.service └ 24358 /usr/sbin/ntpd -n -u ntp:ntp -g -x $ systemctl is-enabled ntpd.service ; echo $? 1 $ sudo systemctl stop ntpd.service $ systemctl status ntpd.service ntpd.service - Network Time Service Loaded: loaded (/lib/systemd/system/ntpd.service) Active: inactive (dead) CGroup: name=systemd:/system/ntpd.service $ systemctl is-enabled ntpd.service ; echo $? 1
(In reply to comment #16) > This latest update does not seem to fix the problem for me. As shown below, > is-enabled now always returns 1 Please disregard. I just realized I was stop/starting the service for my test when I really meant to be enable/disable 'ing the service. Works fine for me.
systemd-26-4.fc15 has been pushed to the Fedora 15 stable repository. If problems still persist, please make note of it in this bug report.
still not fixed as reported here: https://bugzilla.redhat.com/show_bug.cgi?id=725745