Bug 725745

Summary: systemctl is-enabled not working correctly
Product: [Fedora] Fedora Reporter: cornel panceac <cpanceac>
Component: systemdAssignee: systemd-maint
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 15CC: harald, johannbg, lpoetter, mads, metherid, mschmidt, notting, plautrba, samuel-rhbugs
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-16 00:25:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description cornel panceac 2011-07-26 12:48:13 UTC
Description of problem:
systemctl is-enabled foo.service does not display anything on screen if the service file exists, and displays an error if it doesn't exist.

Version-Release number of selected component (if applicable):
26-8

How reproducible:
always

Steps to Reproduce:
1. 
2.
3.
  
Actual results:
nothing

Expected results:
is / not enabled

Additional info:

; echo $? displays 0 if the service file exists, 1 if it doesn't

Comment 1 cornel panceac 2011-07-26 14:07:13 UTC
To clarify last line above: it displays 0 whether the service is enabled or not, as long as it's not in /lib/*/ .

Example:

# systemctl enable sshd.socket

# ls -l /lib/systemd/system/*wants/ | grep -i sshd

# ls -l /etc/systemd/system/*wants/ | grep -i sshd
lrwxrwxrwx. 1 root root 31 Jul 26 16:45 sshd.socket -> /lib/systemd/system/sshd.socket

# systemctl is-enabled sshd.socket;echo $?
0

# systemctl disable sshd.socket
rm '/etc/systemd/system/sockets.target.wants/sshd.socket'

# systemctl is-enabled sshd.socket;echo $?
1

But

# ls /lib/systemd/system/multi-user.target.wants/
dbus.service                   getty.target           plymouth-quit-wait.service  systemd-ask-password-wall.path
fedora-sysinit-unhack.service  plymouth-quit.service  rc-local.service            systemd-user-sessions.service

# mv /lib/systemd/system/multi-user.target.wants/rc-local.service ~

# systemctl --system daemon-reload

# ls /lib/systemd/system/*wants/ | grep -i rc-local

# ls /etc/systemd/system/*wants/ | grep -i rc-local

# systemctl is-enabled rc-local.service ; echo $?
0

Comment 2 cornel panceac 2011-07-28 06:43:55 UTC
Oops, returns 0 as long as it *is* under /lib . Sorry for this.

Comment 3 Fedora Admin XMLRPC Client 2011-10-20 16:28:45 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 4 Michal Schmidt 2011-12-16 00:25:41 UTC
In F16 this is fixed - 'systemctl is-enabled ...' prints the state to stdout.
It's not the kind of change that would be good to backport at this point, so WONTFIX for F15.