Bug 1709547

Summary: Boot fails when password file in crypttab can't be read
Product: [Fedora] Fedora Reporter: Ben Cotton <bcotton>
Component: systemdAssignee: systemd-maint
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 30CC: jesse, lnykryn, msekleta, s, steeve.mccauley, systemd-maint, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: systemd-241-14.git18dd3fb.fc30 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-21 01:17:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ben Cotton 2019-05-13 19:02:09 UTC
Description of problem:
Boot fails and drops to emergency mode if the file specified for an encrypted volume cannot be read. This is a change in behavior from Fedora 29 (although booting the F29 kernel in F30 userspace works as expected). The relevant message appears to be:

[    6.343786] fpgm systemd-cryptsetup[654]: Failed to open key file.
[    6.343809] fpgm systemd-cryptsetup[654]: Failed to activate with key file '/boot/luks_keys': Invalid argument

When I change the field to `-` in order to prompt for a password and then rebuild the initramfs, it boots as expected.

I think this is fixed by upstream PR 11805 (https://github.com/systemd/systemd/pull/11805), which is included in version 242. 

Version-Release number of selected component (if applicable):
systemd-241-8.git9ef65cb.fc30.x86_64

I'm not sure if the failure to open the file is new, or if it has never worked. I didn't see any related error messages on a successful boot with that key file still in place.

Comment 1 Steeve McCauley 2019-05-21 16:38:15 UTC
I finally discovered this over the weekend after much experimentation and gnashing of teeth.  I could still boot on the Fedora 29 kernel, but all of the Fedora 30 kernels failed to boot with the systemd-cryptsetup error "Failed to activate with key file ... Invalid argument".

I have two luks encrypted devices defined in /etc/crypttab, both were setup by gnome disks with plain-text passwords stored in /etc/luks-keys.  The root filesystem containing /etc is encrypted on disk UUID=ea56bffa-c0f1-49df-a68c-c7370cf7d146, so I changed its password reference in crypttab to "none" and it now boots after prompting for that password.

   luks-ea56bffa-c0f1-49df-a68c-c7370cf7d146 UUID=ea56bffa-c0f1-49df-a68c-c7370cf7d146 none luks
   luks-8d4ee900-a98f-47a3-84f8-e13906caac91 UUID=8d4ee900-a98f-47a3-84f8-e13906caac91 /etc/luks-keys/luks-8d4ee900-a98f-47a3-84f8-e13906caac91 luks

I don't know if it was necessary, but I also rebuilt the initramfs file,

   cd /boot
   dracut -f initramfs-5.0.11-300.fc30.x86_64.img 5.0.11-300.fc30.x86_64

and reinstalled grub2 efi,

   grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

Comment 2 jesse 2019-06-09 16:17:03 UTC
I experienced this same issue. After an upgrade to Fedora 30 I was unable to boot using the Fedora 30 kernels. The Fedora 29 kernel would still boot.

The steps outlined in Comment #1 fixed the issue for me.

Comment 3 Zbigniew Jędrzejewski-Szmek 2019-11-22 12:57:53 UTC
Please set status==POST if there's an upstream patch (or even PR). This makes it easier to see
stuff to backport in the sea of open tickets.

Comment 4 Fedora Update System 2020-02-06 15:27:16 UTC
FEDORA-2020-f8e267d6d0 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2020-f8e267d6d0

Comment 5 Fedora Update System 2020-02-07 01:03:51 UTC
systemd-241-14.git18dd3fb.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-f8e267d6d0

Comment 6 Fedora Update System 2020-02-21 01:17:37 UTC
systemd-241-14.git18dd3fb.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.