Bug 697185 - F15 systemd issue with non-existent units (aka ghost units)
Summary: F15 systemd issue with non-existent units (aka ghost units)
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 15
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Lennart Poettering
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-04-16 14:37 UTC by Reartes Guillermo
Modified: 2013-05-13 19:53 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2011-04-19 19:21:51 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Reartes Guillermo 2011-04-16 14:37:56 UTC
Description of problem:

It is posible for systemd to report some inacurate/invalid info.
I was surprised when i found it, i noticed by accident, after a typo 
testing the avahi bug. 


# systemctl -a --full | grep ava
avahi-daemon.service      loaded active   running       Avahi mDNS/DNS-SD Stack
avahi-daemon.socket       loaded active   listening     Avahi mDNS/DNS-SD Stack Activation Socket


This is incorrect, the this service does not exists.
# systemctl status avai-daemon.service
avai-daemon.service
          Loaded: error
          Active: inactive (dead)

This is incorrect, the this service does not exists.
# systemctl status avei-daemon.service
avei-daemon.service
          Loaded: error
          Active: inactive (dead)

This is incorrect, the this service does not exists.
# systemctl status windows.service
windows.service
          Loaded: error
          Active: inactive (dead)

This is the correct behaviour.
# systemctl status @.service
Failed to issue method call: Unit name @.service is not valid.

# systemctl status 1.service
1.service
          Loaded: error
          Active: inactive (dead)

# systemctl status la_lalala.socket
la_lalala.socket
          Loaded: error
          Active: inactive (dead)

This is also the correct behaviour.
# systemctl enable ava.service
Couldn't find ava.service.

# systemctl status ava.service
ava.service
          Loaded: error
          Active: inactive (dead)

This is incorrect, the service ava does not exists.
# systemctl stop ava.service

This is also the correct behaviour.
# systemctl start ava.service
Failed to issue method call: Unit ava.service failed to load: No such file or directory. See system logs and 'systemctl status' for details.

This is incorrect, the service foo_foo does not exists.
# systemctl show foo_foo.service
Id=foo_foo.service
Names=foo_foo.service
Description=foo_foo.service
LoadState=error
ActiveState=inactive
SubState=dead
CanStart=yes
CanStop=yes
CanReload=no
CanIsolate=no
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
NeedDaemonReload=no
JobTimeoutUSec=0
ConditionResult=no
Type=simple
Restart=no
NotifyAccess=none
RestartUSec=100ms
TimeoutUSec=3min
UMask=0002
LimitCPU=18446744073709551615
LimitFSIZE=18446744073709551615
LimitDATA=18446744073709551615
LimitSTACK=18446744073709551615
LimitCORE=18446744073709551615
LimitRSS=18446744073709551615
LimitNOFILE=1024
LimitAS=18446744073709551615
LimitNPROC=63359
LimitMEMLOCK=65536
LimitLOCKS=18446744073709551615
LimitSIGPENDING=63359
LimitMSGQUEUE=819200
LimitNICE=0
LimitRTPRIO=0
LimitRTTIME=18446744073709551615
OOMScoreAdjust=0
Nice=0
IOScheduling=0
CPUSchedulingPolicy=0
CPUSchedulingPriority=0
TimerSlackNSec=50000
CPUSchedulingResetOnFork=no
NonBlocking=no
StandardInput=null
StandardOutput=inherit
StandardError=inherit
SyslogPriority=30
SyslogLevelPrefix=yes
SecureBits=0
CapabilityBoundingSet=18446744073709551615
MountFlags=1048576
PrivateTmp=no
SameProcessGroup=no
KillMode=control-group
KillSignal=15
PermissionsStartOnly=no
RootDirectoryStartOnly=no
RemainAfterExit=no
GuessMainPID=yes
ExecMainPID=0
ExecMainCode=0
ExecMainStatus=0
MainPID=0
ControlPID=0
SysVStartPriority=-1
FsckPassNo=0

This is incorrect, the service foo_foo does not exists.
# systemctl is-active foo_foo.service
inactive

If you happen to type a service name wrong, systemctl may report inacurate info (as seen by the user/administator)


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

systemd.x86_64                               24-1.fc15          @updates-testing
systemd-units.x86_64                         24-1.fc15          @updates-testing

How reproducible:
easy

Steps to Reproduce:
above
  
Actual results:
above

Expected results:
above

Additional info:

Comment 1 Reartes Guillermo 2011-04-16 16:22:27 UTC
more examples.
i think systemctl must be more explicit/strict when someone just throws junk to it.
some of the output messages are prone to confusion. if something does not exists, 
do not report these confusing 'show' or 'status' examples.
starting / stoping / enabling / disabling is ok, but the reporting status/show functions
seem to need a bit of polish.

---

# systemctl start fake_storage.mount
Failed to issue method call: Unit fake_storage.mount failed to load: No such file or directory. See system logs and 'systemctl status' for details.

# systemctl status fake_storage.mount
fake_storage.mount - /fake_storage
          Loaded: error
          Active: inactive (dead)
           Where: /fake_storage
          CGroup: name=systemd:/system/fake_storage.mount

# systemctl show fake_storage.mount
Id=fake_storage.mount
Names=fake_storage.mount
Requires=systemd-logger.socket -.mount
Conflicts=umount.target
Before=umount.target
After=systemd-logger.socket -.mount
Description=/fake_storage
LoadState=error
ActiveState=inactive
SubState=dead
CanStart=yes
CanStop=yes
CanReload=yes
CanIsolate=no
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
DefaultControlGroup=name=systemd:/system/fake_storage.mount
ControlGroup=cpu:/system/fake_storage.mount name=systemd:/system/fake_storage.mount
NeedDaemonReload=no
JobTimeoutUSec=0
ConditionResult=no
Where=/fake_storage
TimeoutUSec=3min
UMask=0002
LimitCPU=18446744073709551615
LimitFSIZE=18446744073709551615
LimitDATA=18446744073709551615
LimitSTACK=18446744073709551615
LimitCORE=18446744073709551615
LimitRSS=18446744073709551615
LimitNOFILE=1024
LimitAS=18446744073709551615
LimitNPROC=63359
LimitMEMLOCK=65536
LimitLOCKS=18446744073709551615
LimitSIGPENDING=63359
LimitMSGQUEUE=819200
LimitNICE=0
LimitRTPRIO=0
LimitRTTIME=18446744073709551615
OOMScoreAdjust=0
Nice=0
IOScheduling=0
CPUSchedulingPolicy=0
CPUSchedulingPriority=0
TimerSlackNSec=50000
CPUSchedulingResetOnFork=no
NonBlocking=no
StandardInput=null
StandardOutput=kmsg
StandardError=inherit
SyslogPriority=30
SyslogLevelPrefix=yes
SecureBits=0
CapabilityBoundingSet=18446744073709551615
MountFlags=1048576
PrivateTmp=no
SameProcessGroup=yes
KillMode=control-group
KillSignal=15
ControlPID=0
DirectoryMode=0755

---

# systemctl status sys-devices-virtual-tty-tty6666333333312.device
sys-devices-virtual-tty-tty6666333333312.device
          Loaded: loaded
          Active: inactive (dead)

# systemctl show sys-devices-virtual-tty-tty6666333333312.device
Id=sys-devices-virtual-tty-tty6666333333312.device
Names=sys-devices-virtual-tty-tty6666333333312.device
Description=sys-devices-virtual-tty-tty6666333333312.device
LoadState=loaded
ActiveState=inactive
SubState=dead
CanStart=no
CanStop=no
CanReload=no
CanIsolate=no
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
NeedDaemonReload=no
JobTimeoutUSec=3min
ConditionResult=no

---

# systemctl status systemd-ask-password-foo-bank.path
systemd-ask-password-foo-bank.path
          Loaded: error
          Active: inactive (dead)

# systemctl start systemd-ask-password-foo-bank.path
Failed to issue method call: Unit systemd-ask-password-foo-bank.path failed to load: No such file or directory. See system logs and 'systemctl status' for details.

# systemctl restart systemd-ask-password-foo-bank.path
Failed to issue method call: Unit systemd-ask-password-foo-bank.path failed to load: No such file or directory. See system logs and 'systemctl status' for details.

# systemctl show  systemd-ask-password-foo-bank.path
Id=systemd-ask-password-foo-bank.path
Names=systemd-ask-password-foo-bank.path
Description=systemd-ask-password-foo-bank.path
LoadState=error
ActiveState=inactive
SubState=dead
CanStart=yes
CanStop=yes
CanReload=no
CanIsolate=no
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
NeedDaemonReload=no
JobTimeoutUSec=0
ConditionResult=no

---

# systemctl show pentask-5users.target
Id=pentask-5users.target
Names=pentask-5users.target
Description=pentask-5users.target
LoadState=error
ActiveState=inactive
SubState=dead
CanStart=yes
CanStop=yes
CanReload=no
CanIsolate=no
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
NeedDaemonReload=no
JobTimeoutUSec=0
ConditionResult=no

# systemctl isolate pentask-5users.target
Failed to issue method call: Operation refused, unit may not be isolated.

# systemctl status pentask-5users.target
pentask-5users.target
          Loaded: error
          Active: inactive (dead)

---

# systemctl status dev-sdz9999999.swap 
dev-sdz9999999.swap - /dev/sdz9999999
          Loaded: loaded
          Active: inactive (dead)
            What: /dev/sdz9999999
          CGroup: name=systemd:/system/dev-sdz9999999.swap

# systemctl show dev-sdz9999999.swap 
Id=dev-sdz9999999.swap
Names=dev-sdz9999999.swap
Requires=systemd-logger.socket
Conflicts=umount.target
Before=umount.target
After=systemd-logger.socket
Description=/dev/sdz9999999
LoadState=loaded
ActiveState=inactive
SubState=dead
CanStart=yes
CanStop=yes
CanReload=no
CanIsolate=no
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
DefaultControlGroup=name=systemd:/system/dev-sdz9999999.swap
ControlGroup=cpu:/system/dev-sdz9999999.swap name=systemd:/system/dev-sdz9999999.swap
NeedDaemonReload=no
JobTimeoutUSec=0
ConditionResult=no
What=/dev/sdz9999999
Priority=-1
UMask=0002
LimitCPU=18446744073709551615
LimitFSIZE=18446744073709551615
LimitDATA=18446744073709551615
LimitSTACK=18446744073709551615
LimitCORE=18446744073709551615
LimitRSS=18446744073709551615
LimitNOFILE=1024
LimitAS=18446744073709551615
LimitNPROC=63359
LimitMEMLOCK=65536
LimitLOCKS=18446744073709551615
LimitSIGPENDING=63359
LimitMSGQUEUE=819200
LimitNICE=0
LimitRTPRIO=0
LimitRTTIME=18446744073709551615
OOMScoreAdjust=0
Nice=0
IOScheduling=0
CPUSchedulingPolicy=0
CPUSchedulingPriority=0
TimerSlackNSec=50000
CPUSchedulingResetOnFork=no
NonBlocking=no
StandardInput=null
StandardOutput=kmsg
StandardError=inherit
SyslogPriority=30
SyslogLevelPrefix=yes
SecureBits=0
CapabilityBoundingSet=18446744073709551615
MountFlags=1048576
PrivateTmp=no
SameProcessGroup=no
KillMode=control-group
KillSignal=15
ControlPID=0

# systemctl enable dev-sdz9999999.swap 
Couldn't find dev-sdz9999999.swap.

# systemctl start dev-sdz9999999.swap 
Job failed. See system logs and 'systemctl status' for details.

----


# systemctl show systemd-tmpfiles-destroy.timer
Id=systemd-tmpfiles-destroy.timer
Names=systemd-tmpfiles-destroy.timer
Description=systemd-tmpfiles-destroy.timer
LoadState=error
ActiveState=inactive
SubState=dead
CanStart=yes
CanStop=yes
CanReload=no
CanIsolate=no
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
NeedDaemonReload=no
JobTimeoutUSec=0
ConditionResult=no
NextElapseUSec=(null)

# systemctl status systemd-tmpfiles-destroy.timer
systemd-tmpfiles-destroy.timer
          Loaded: error
          Active: inactive (dead)

Comment 2 Reartes Guillermo 2011-04-16 16:29:33 UTC
The 'dev-sdz9999999.swap' that 'failed' is efectivelly 'failed' ?

# systemctl --failed
UNIT                      LOAD   ACTIVE SUB    JOB DESCRIPTION
cgconfig.service          loaded failed failed     LSB: start and stop the WLM configuration
plymouth-start.service    loaded failed failed     Show Plymouth Boot Screen
systemd-...-clean.service loaded failed failed     Cleanup of Temporary Directories
systemd-...-setup.service loaded failed failed     Recreate Volatile Files and Directories
dev-sdz9999999.swap       loaded failed failed     /dev/sdz9999999

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.
JOB    = Pending job for the unit.

5 units listed. Pass --all to see inactive units, too.

---------------

Comment 3 Reartes Guillermo 2011-04-16 18:29:40 UTC
It seems that .swap units are encapsulated swapon(s) commands...

---

#!/bin/bash
# script.sh
for i in {1..65535}
do
   systemctl start dev-sdz$i.swap --no-pager
done

---

# ./script.sh
CTRL+C after some time...

# systemctl --failed --no-pager
[...]
dev-sdz9984.swap          loaded failed failed     /dev/sdz9984
dev-sdz9985.swap          loaded failed failed     /dev/sdz9985
dev-sdz9986.swap          loaded failed failed     /dev/sdz9986
dev-sdz9987.swap          loaded failed failed     /dev/sdz9987
dev-sdz9988.swap          loaded failed failed     /dev/sdz9988
dev-sdz9989.swap          loaded failed failed     /dev/sdz9989
dev-sdz999.swap           loaded failed failed     /dev/sdz999
dev-sdz9990.swap          loaded failed failed     /dev/sdz9990
dev-sdz9991.swap          loaded failed failed     /dev/sdz9991
dev-sdz9992.swap          loaded failed failed     /dev/sdz9992
dev-sdz9993.swap          loaded failed failed     /dev/sdz9993
dev-sdz9994.swap          loaded failed failed     /dev/sdz9994
dev-sdz9995.swap          loaded failed failed     /dev/sdz9995
dev-sdz9996.swap          loaded failed failed     /dev/sdz9996
dev-sdz9997.swap          loaded failed failed     /dev/sdz9997
dev-sdz9998.swap          loaded failed failed     /dev/sdz9998
dev-sdz9999.swap          loaded failed failed     /dev/sdz9999
dev-sdz9999999.swap       loaded failed failed     /dev/sdz9999999

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.
JOB    = Pending job for the unit.

14615 units listed. Pass --all to see inactive units, too

# dmesg
[...]
[14585.832062] swapon[9064]: swapon: /dev/sdz14583: stat failed: No such file or directory
[14586.215346] swapon[9068]: swapon: /dev/sdz14584: stat failed: No such file or directory
[14586.588672] swapon[9072]: swapon: /dev/sdz14585: stat failed: No such file or directory
[14586.971919] swapon[9076]: swapon: /dev/sdz14586: stat failed: No such file or directory
[14587.354705] swapon[9080]: swapon: /dev/sdz14587: stat failed: No such file or directory
[14587.743829] swapon[9084]: swapon: /dev/sdz14588: stat failed: No such file or directory
[14588.118636] swapon[9088]: swapon: /dev/sdz14589: stat failed: No such file or directory
[14588.494966] swapon[9092]: swapon: /dev/sdz14590: stat failed: No such file or directory
[14588.884138] swapon[9096]: swapon: /dev/sdz14591: stat failed: No such file or directory
[14589.274679] swapon[9100]: swapon: /dev/sdz14592: stat failed: No such file or directory
[14589.645408] swapon[9104]: swapon: /dev/sdz14593: stat failed: No such file or directory
[...]

Attached an esata disk, and created a swap partition (GPT partition 7, Linux Swap)

# mkswap  /dev/sdc7
Setting up swapspace version 1, size = 5242876 KiB
no label, UUID=7f8956f6-b43a-4768-bcd2-d168152c4ac1
# systemctl start dev-sdc7.swap

# systemctl status dev-sdc7.swap
dev-sdc7.swap - /dev/sdc7
          Loaded: loaded
          Active: active
            What: /dev/sdc7
         Process: 9427 ExecActivate=/sbin/swapon /dev/sdc7 (code=exited, status=0/SUCCESS)
          CGroup: name=systemd:/system/dev-sdc7.swap


# systemctl enable dev-sdc7.swap
Couldn't find dev-sdc7.swap.

---

After a reboot, those spurious failed units disapeared.

----


# systemctl -a | grep swap
fedora-autoswap.service   loaded active   exited        Enable all detected swap partitions
dev-disk...\x2dpart5.swap loaded active   active        /dev/disk/by-id/ata-WDC_WD1001FALS-00J7B1_WD-WMATV2323736-part5
dev-disk...\x2dpart5.swap loaded active   active        /dev/disk/by-id/scsi-SATA_WDC_WD1001FALS-_WD-WMATV2323736-part5
dev-disk...\x2dpart5.swap loaded active   active        /dev/disk/by-id/wwn-0x50014ee056bd218a-part5
dev-disk...\x2dpart5.swap loaded active   active        /dev/disk/by-path/pci-0000:00:09.0-scsi-0:0:0:0-part5
dev-disk...2bd8c3028.swap loaded active   active        /dev/disk/by-uuid/2eda15a2-c38e-4eb9-91c3-5952bd8c3028
dev-sda5.swap             loaded inactive dead          /dev/sda5
swap.target               loaded active   active        Swap

note: sda5 is a true swap (/etc/fstab) partition.

# systemctl status swap.target
swap.target - Swap
          Loaded: loaded (/lib/systemd/system/swap.target)
          Active: active since Sat, 16 Apr 2011 15:04:43 -0300; 6min ago

# systemctl status dev-sda5.swap
dev-sda5.swap - /dev/sda5
          Loaded: loaded
          Active: inactive (dead)
            What: /dev/sda5
          CGroup: name=systemd:/system/dev-sda5.swap

By conparison, this is a fake swap:
# systemctl status dev-sdrr.swap
dev-sdrr.swap - /dev/sdrr
          Loaded: loaded
          Active: inactive (dead)
            What: /dev/sdrr
          CGroup: name=systemd:/system/dev-sdrr.swap

Comment 4 Lennart Poettering 2011-04-19 19:21:51 UTC
This is actually intended this way: some units need no configuration to be useful (for example swap units where everything that systemd needs to know can be deduced from the name). Others otoh need configuration to be useful (for example services). In either case however we must be able to deal with units that are active but have no valid configuraiton, for example after a config reload after a service was started.

Putting this all together the current behaviour actually makes a lot of sense, even if it might be confusing. The best way to clear up the confusion is by making the status output better and include error message, which is requested in 680122 already. Hence, closing.

Also note that "systemctl start" can activate any unit. "systemctl enable" however works on unit files.

A service with invalid configuration can still be stopped, but not started.

units that are referenced but unused area usually removed after a while via a GC algorithm. If units failed to start however they are kept around until the fail status is cleared using "systemctl reset-failed"


Note You need to log in before you can comment on or make changes to this bug.