Bug 86488

Summary: swap + nofail = timeout and dependency failed
Product: systemd Reporter: Marcos Mello <marcosfrm>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Marcos Mello 2014-11-20 12:44:19 UTC
With 'nofail' in fstab I still see a 90s timeout and a "dependency failed" warning at boot for a swap volume that does not exist anymore. Bug? Feature?

# systemd-analyze dump

...
-> Unit swap.target:
        Description: Swap
        Instance: n/a
        Unit Load State: loaded
        Unit Active State: inactive
        Inactive Exit Timestamp: Thu 2014-11-20 10:29:10 BRST
        Active Enter Timestamp: Thu 2014-11-20 10:29:10 BRST
        Active Exit Timestamp: Thu 2014-11-20 10:29:12 BRST
        Inactive Enter Timestamp: Thu 2014-11-20 10:29:12 BRST
        GC Check Good: no
        Need Daemon Reload: no
        Transient: no
        Slice: n/a
        CGroup: n/a
        CGroup realized: no
        CGroup mask: 0x0
        CGroup members mask: 0x0
        Name: swap.target
        Documentation: man:systemd.special(7)
        Fragment Path: /usr/lib/systemd/system/swap.target
        Condition Timestamp: Thu 2014-11-20 10:29:10 BRST
        Condition Result: yes
        Requires: dev-disk-by\x2duuid-8872f836\x2d3676\x2d49a9\x2dafdc\x2d6eb790a13d9f.swap
        Requires: dev-disk-by\x2duuid-115fafca\x2df014\x2d467c\x2dab19\x2dc8f0585200ca.swap
        Requires: dev-disk-by\x2duuid-f8a8fc0e\x2d6978\x2d46e4\x2d9412\x2da327aaa96816.swap
        Requires: dev-disk-by\x2dpath-pci\x2d0000:00:1f.2\x2data\x2d1.0\x2dpart1.swap
        Requires: dev-disk-by\x2did-wwn\x2d0x50000f000b4b1915\x2dpart1.swap
        Requires: dev-disk-by\x2did-scsi\x2dSATA_SAMSUNG_HD322HJ_S1G2J50QB49151\x2dpart1.swap
        Requires: dev-disk-by\x2did-scsi\x2dSATA_SAMSUNG_HD322HJS1G2J50QB49151\x2dpart1.swap
        Requires: dev-disk-by\x2did-scsi\x2d350000f000b4b1915\x2dpart1.swap
        Requires: dev-disk-by\x2did-scsi\x2d1ATA_SAMSUNG_HD322HJ_S1G2J50QB49151\x2dpart1.swap
        Requires: dev-disk-by\x2did-scsi\x2d0ATA_SAMSUNG_HD322HJ_S1G2J50QB49151\x2dpart1.swap
        Requires: dev-disk-by\x2did-ata\x2dSAMSUNG_HD322HJ_S1G2J50QB49151\x2dpart1.swap
        Requires: dev-sda1.swap
        Requires: dev-disk-by\x2dpath-pci\x2d0000:00:1f.2\x2data\x2d2.0\x2dpart1.swap
        Requires: dev-disk-by\x2did-scsi\x2dSATA_MAXTOR_STM31608_6RACKZQN\x2dpart1.swap
        Requires: dev-disk-by\x2did-scsi\x2dSATA_MAXTOR_STM316081_6RACKZQN\x2dpart1.swap
        Requires: dev-disk-by\x2did-scsi\x2d1ATA_MAXTOR_STM3160815AS_6RACKZQN\x2dpart1.swap
        Requires: dev-disk-by\x2did-scsi\x2d0ATA_MAXTOR_STM316081_6RACKZQN\x2dpart1.swap
        Requires: dev-disk-by\x2did-ata\x2dMAXTOR_STM3160815AS_6RACKZQN\x2dpart1.swap
        Requires: dev-sdb1.swap
        Wants: dev-disk-by\x2duuid-f8a8fc0e\x2d6978\x2d46e4\x2d9412\x2da327aaa96816.swap
        Wants: dev-disk-by\x2duuid-115fafca\x2df014\x2d467c\x2dab19\x2dc8f0585200ca.swap
        Wants: dev-disk-by\x2duuid-8872f836\x2d3676\x2d49a9\x2dafdc\x2d6eb790a13d9f.swap
        WantedBy: sysinit.target
        Conflicts: shutdown.target
        Before: sysinit.target
        After: dev-disk-by\x2duuid-8872f836\x2d3676\x2d49a9\x2dafdc\x2d6eb790a13d9f.swap
        After: dev-disk-by\x2duuid-115fafca\x2df014\x2d467c\x2dab19\x2dc8f0585200ca.swap
        After: dev-disk-by\x2duuid-f8a8fc0e\x2d6978\x2d46e4\x2d9412\x2da327aaa96816.swap
        After: dev-disk-by\x2dpath-pci\x2d0000:00:1f.2\x2data\x2d1.0\x2dpart1.swap
        After: dev-disk-by\x2did-wwn\x2d0x50000f000b4b1915\x2dpart1.swap
        After: dev-disk-by\x2did-scsi\x2dSATA_SAMSUNG_HD322HJ_S1G2J50QB49151\x2dpart1.swap
        After: dev-disk-by\x2did-scsi\x2dSATA_SAMSUNG_HD322HJS1G2J50QB49151\x2dpart1.swap
        After: dev-disk-by\x2did-scsi\x2d350000f000b4b1915\x2dpart1.swap
        After: dev-disk-by\x2did-scsi\x2d1ATA_SAMSUNG_HD322HJ_S1G2J50QB49151\x2dpart1.swap
        After: dev-disk-by\x2did-scsi\x2d0ATA_SAMSUNG_HD322HJ_S1G2J50QB49151\x2dpart1.swap
        After: dev-disk-by\x2did-ata\x2dSAMSUNG_HD322HJ_S1G2J50QB49151\x2dpart1.swap
        After: dev-sda1.swap
        After: dev-disk-by\x2dpath-pci\x2d0000:00:1f.2\x2data\x2d2.0\x2dpart1.swap
        After: dev-disk-by\x2did-scsi\x2dSATA_MAXTOR_STM31608_6RACKZQN\x2dpart1.swap
        After: dev-disk-by\x2did-scsi\x2dSATA_MAXTOR_STM316081_6RACKZQN\x2dpart1.swap
        After: dev-disk-by\x2did-scsi\x2d1ATA_MAXTOR_STM3160815AS_6RACKZQN\x2dpart1.swap
        After: dev-disk-by\x2did-scsi\x2d0ATA_MAXTOR_STM316081_6RACKZQN\x2dpart1.swap
        After: dev-disk-by\x2did-ata\x2dMAXTOR_STM3160815AS_6RACKZQN\x2dpart1.swap
        After: dev-sdb1.swap
        References: dev-disk-by\x2duuid-f8a8fc0e\x2d6978\x2d46e4\x2d9412\x2da327aaa96816.swap
        References: dev-disk-by\x2duuid-115fafca\x2df014\x2d467c\x2dab19\x2dc8f0585200ca.swap
        References: dev-disk-by\x2duuid-8872f836\x2d3676\x2d49a9\x2dafdc\x2d6eb790a13d9f.swap
        References: shutdown.target
        References: dev-disk-by\x2dpath-pci\x2d0000:00:1f.2\x2data\x2d1.0\x2dpart1.swap
        References: dev-disk-by\x2did-wwn\x2d0x50000f000b4b1915\x2dpart1.swap
        References: dev-disk-by\x2did-scsi\x2dSATA_SAMSUNG_HD322HJ_S1G2J50QB49151\x2dpart1.swap
        References: dev-disk-by\x2did-scsi\x2dSATA_SAMSUNG_HD322HJS1G2J50QB49151\x2dpart1.swap
        References: dev-disk-by\x2did-scsi\x2d350000f000b4b1915\x2dpart1.swap
        References: dev-disk-by\x2did-scsi\x2d1ATA_SAMSUNG_HD322HJ_S1G2J50QB49151\x2dpart1.swap
        References: dev-disk-by\x2did-scsi\x2d0ATA_SAMSUNG_HD322HJ_S1G2J50QB49151\x2dpart1.swap
        References: dev-disk-by\x2did-ata\x2dSAMSUNG_HD322HJ_S1G2J50QB49151\x2dpart1.swap
        References: dev-sda1.swap
        References: dev-disk-by\x2dpath-pci\x2d0000:00:1f.2\x2data\x2d2.0\x2dpart1.swap
        References: dev-disk-by\x2did-scsi\x2dSATA_MAXTOR_STM31608_6RACKZQN\x2dpart1.swap
        References: dev-disk-by\x2did-scsi\x2dSATA_MAXTOR_STM316081_6RACKZQN\x2dpart1.swap
        References: dev-disk-by\x2did-scsi\x2d1ATA_MAXTOR_STM3160815AS_6RACKZQN\x2dpart1.swap
        References: dev-disk-by\x2did-scsi\x2d0ATA_MAXTOR_STM316081_6RACKZQN\x2dpart1.swap
        References: dev-disk-by\x2did-ata\x2dMAXTOR_STM3160815AS_6RACKZQN\x2dpart1.swap
        References: dev-sdb1.swap
        ReferencedBy: sysinit.target
        StopWhenUnneeded: no
        RefuseManualStart: no
        RefuseManualStop: no
        DefaultDependencies: yes
        OnFailureJobMode: replace
        IgnoreOnIsolate: no
        IgnoreOnSnapshot: no
        Target State: dead
...

The missing volume is UUID 8872f836-...

# grep 8872f836 /etc/fstab
UUID=8872f836-3676-49a9-afdc-6eb790a13d9f swap                 swap       nofail                0 0

I run openSUSE 13.2, systemd-210-25.5.4.x86_64.
Comment 1 Zbigniew Jedrzejewski-Szmek 2014-11-24 01:25:13 UTC
Feature, more than a bug...

The timeout is necessary because of event-based boot. Traditionally sysvinit would try swapon at some "random" point, which almost always worked because bootup was slow enough for devices to show up. With systemd this is different, because it is often faster than device discovery so it must pick some explicit timeout and actually wait.

As for the warning: systemd.mount(5) only says that the boot will be continued. But it is still expected that the device will be there, it just is not important enough to stop boot without it.

I'll close this, since I don't think there's much we can do here: in some applications it would be nicer to be quieter, in other cases it would nicer to be more verbose, so we're never going to fit all cases. I think the current approach strikes a good balance.
Comment 2 Marcos Mello 2014-11-24 09:06:22 UTC
I am reporting because I am almost sure on openSUSE 13.1 (208 + lots of -stable patches) it did not show timeout, nor warning. Too lazy to install it again and test though. Anyway, system still boots. I can remove the offending line.
Comment 3 Marcos Mello 2014-11-24 12:28:02 UTC
Well, changing 'nofail' to 'defaults' does not make difference. So 'nofail' is a NOP. That is not expected.

man swapon

-e, --ifexists
*Silently* skip devices that do not exist.  The /etc/fstab mount option nofail may also be used to skip non-existing device.

man systemd.mount

If nofail is given, this mount will be only wanted, not required, by the local-fs.target. This means that the boot will continue even if this mount point is not mounted successfully. Option fail has the opposite meaning and is the default.

but:

systemd-analyze dump

-> Unit swap.target:
...
Requires: dev-disk-by\x2duuid-8872f836\x2d3676\x2d49a9\x2dafdc\x2d6eb790a13d9f.swap

?
Comment 4 Zbigniew Jedrzejewski-Szmek 2014-11-24 13:33:43 UTC
Darn. swap.target has both Requires and Wants on the same unit. This does not look right.
Comment 5 Zbigniew Jedrzejewski-Szmek 2014-11-26 20:23:32 UTC
Fixed in http://cgit.freedesktop.org/systemd/systemd/commit/?id=5607d856b8.
Comment 6 Marcos Mello 2014-12-05 23:29:22 UTC
Thanks!

http://cgit.freedesktop.org/systemd/systemd/commit/?id=deb6120920

also applies to systemd.swap, no?
Comment 7 Marcos Mello 2014-12-15 20:10:50 UTC
Ping?

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.