Bug 750025

Summary: Crypttab setup failing on boot
Product: [Fedora] Fedora Reporter: Fred Wells <fred_wells>
Component: systemdAssignee: systemd-maint
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 16CC: foudilmusic, harald, johannbg, johannbg, lpoetter, metherid, mschmidt, notting, plautrba, systemd-maint
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-10-30 17:56:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Config and log files none

Description Fred Wells 2011-10-30 03:15:20 UTC
Description of problem:

Problem 1:
Init/boot process hangs for several minutes if encrypted device is defined in /etc/crypttab but unavailable (e.g. USB storage).

Problem 2:
Encrypted 'swap' not automatically added during init.


Version-Release number of selected component (if applicable):
systemd-37-2.fc16


How reproducible:

Every time.


Steps to Reproduce:
1.  Create encrypted filesystem on removable USB media 
2.  Create encrypted swap partition and update /etc/fstab accordingly
3.  Disconnect removable encrypted (USB) media
4.  Reboot
  
Actual results:
- Watch init hang during "Starting Cryptography Setup for ..." removable 
- After system boots, "swapon -s" command lists no swap device


Expected results:
- Init process should quickly detect missing removable encrypted USB device and move on.
- Swap partition should be enabled


Additional info:

Comment 1 Fred Wells 2011-10-30 03:27:49 UTC
Created attachment 530810 [details]
Config and log files

Attaching config and log files.

Comment 2 Harald Hoyer 2011-11-01 10:28:55 UTC
Aside from the bug.

Do _not_ use "sd*" kernel names in crypttab and fstab!!!

Always use one of the symbolic links found in /dev/disk/

Comment 3 Lennart Poettering 2011-11-01 21:50:31 UTC
Normally swap is only necessary on memory constrained systems. Due to that we need to wait until the swap device shows up before proceeding the boot, since we need to be sure that swap space is set up before we start the full system so that enough virtual memory is around. If we'd just ignore swap not being around we might break systems which actually really need swap.

Add "nofail" to the options field in fstab to tell systemd to activate your swap partition only if it is around. This analogous to "nofail" for file systems.

Comment 4 Fred Wells 2011-11-02 02:51:04 UTC
Why did you close this?  Swap is only part of the problem.  This setup works perfectly on F15 and only fails on F16.  I'm not suggesting that swap should be ignored, only that it behaves as expected - as per F15.  I simply ask that your  review the reported symptoms more closely before closing as NOTABUG.  I'll try your swap recommendation.  However, the hang on boot has nothing to do with swap as far as I can tell.  Rather, boot hangs only when my encrypted USB device is unavailable (i.e. unplugged).

Comment 5 Fred Wells 2011-11-02 03:05:14 UTC
'nofail' works for swap.  That solves one of the reported problems.

Comment 6 Michal Schmidt 2011-11-02 09:13:11 UTC
> Init/boot process hangs for several minutes if encrypted device is defined
> in /etc/crypttab but unavailable (e.g. USB storage).

Is it in fact 90 seconds? That is the usual timeout when waiting for a device to appear.

> Encrypted 'swap' not automatically added during init.

It can be due to bug 711394 and/or bug 711150.

Comment 7 Fred Wells 2011-11-02 13:29:53 UTC
> Is it in fact 90 seconds? That is the usual timeout when waiting for a device
to appear.

Yup.  90 seconds is correct.


> Encrypted 'swap' not automatically added during init.

'nofail' option seems to work around this issue.

Comment 8 Jóhann B. Guðmundsson 2012-01-29 15:50:07 UTC
Is this still an issue or can this bug be closed?

Comment 9 Fred Wells 2012-01-30 04:21:44 UTC
Encrypted swap issue resolved with the 'nofail' boot option.

Encrypted USB storage still broken.

Comment 10 Lennart Poettering 2012-10-30 17:56:00 UTC
In F17 encrypted swap should get the right dependencies. Closing.

If you can reproduce the issue on F17/F18 please reopen!