Bug 30908

Summary: doesn't automatically activate swap units
Product: systemd Reporter: Bill Nottingham <notting>
Component: generalAssignee: Lennart Poettering <lennart>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Bill Nottingham 2010-10-15 12:04:53 UTC
My swaps are not being enabled on boot; by all appearances, they should be.

[root@localhost ~]# systemctl show swap.target
Id=swap.target
Names=swap.target
RequiredBy=basic.target rescue.target
ConflictedBy=shutdown.target
Before=basic.target rescue.target
After=dev-vda1.swap dev-disk-by\x2duuid-c75e33f2\x2d5405\x2d47fd\x2dbab3\x2d0dac95c555f1.swap
Description=Swap
LoadState=loaded
ActiveState=active
SubState=active
FragmentPath=/lib/systemd/system/swap.target
InactiveExitTimestamp=Fri, 15 Oct 2010 14:56:44 -0400
ActiveEnterTimestamp=Fri, 15 Oct 2010 14:56:44 -0400
CanStart=yes
CanStop=yes
CanReload=no
CanIsolate=no
RecursiveStop=no
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
NeedDaemonReload=no
JobTimeoutUSec=0
[root@localhost ~]# systemctl status swap.target
swap.target - Swap
	  Loaded: loaded (/lib/systemd/system/swap.target)
	  Active: active since [Fri, 15 Oct 2010 14:56:44 -0400; 2min 30s ago]
[root@localhost ~]# systemctl status dev-vda1.swap
dev-vda1.swap - /dev/vda1
	  Loaded: loaded
	  Active: inactive (dead)
	    What: /dev/vda1
[root@localhost ~]# systemctl show dev-vda1.swap
Id=dev-vda1.swap
Names=dev-vda1.swap
Requires=dev-vda1.device
Before=swap.target
After=dev-vda1.device sysinit.target
Description=/dev/vda1
LoadState=loaded
ActiveState=inactive
SubState=dead
CanStart=yes
CanStop=yes
CanReload=no
CanIsolate=no
RecursiveStop=no
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
NeedDaemonReload=no
JobTimeoutUSec=0
What=/dev/vda1
Priority=0
[root@localhost ~]# systemctl status dev-vda1.device sysinit.target
dev-vda1.device - /dev/vda1
	  Loaded: loaded
	  Active: active (plugged) since [Fri, 15 Oct 2010 14:56:51 -0400; 2min 51s ago]
	  Device: /sys/devices/virtio-pci/virtio1/block/vda/vda1

sysinit.target - System Initialization
	  Loaded: loaded (/lib/systemd/system/sysinit.target)
	  Active: active since [Fri, 15 Oct 2010 14:56:49 -0400; 2min 53s ago]

I can start/stop/etc the swap units by hand, but they're not automatically coming up.

Looking at systemd debugging messages:
[    6.661571] init[1]: Added job swap.target/start to transaction.
[    6.980083] init[1]: swap.target changed dead -> active
[    6.981451] init[1]: Job swap.target/start finished, success=yes
[   11.835086] init[1]: dev-vda.device changed dead -> plugged
[   11.836649] init[1]: sys-devices-virtio\x2dpci-virtio1-block-vda.device changed dead -> plugged
[   13.192687] init[1]: dev-vda1.device changed dead -> plugged
[   13.207150] init[1]: sys-devices-virtio\x2dpci-virtio1-block-vda-vda1.device changed dead -> plugged

From all appearances, the 'After' dependencies in swap.target aren't being followed (or, it's trying to start them immediately, noticing that dev-vda1.device isn't plugged yet, and then just exiting.)
Comment 1 Bill Nottingham 2010-10-15 20:15:47 UTC
Whoops. Config error.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.