Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#24819 - [mkinitcpio] encrypted root fails to deactivate at shutdown

Attached to Project: Arch Linux
Opened by voltaic (voltaic) - Wednesday, 22 June 2011, 03:12 GMT
Last edited by Dave Reisner (falconindy) - Wednesday, 04 April 2012, 00:32 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Tobias Powalowski (tpowa)
Thomas Bächler (brain0)
Dave Reisner (falconindy)
Tom Gundersen (tomegun)
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

Encrypted root filesystem (LVM on top of LUKS) fails to deactivate during shutdown. Encrypted swap, on the other hand, is correctly deactivated.

Additional info:
* 2010.05 net install iso, x86_64
* mkinitcpio 0.6.15-1
* initscripts 2011.06.4-1
* grub2-bios 1:1.99-3
* all packages updated as of 6/21/2011
* mkinitcpio hooks used: base udev autodetect pata scsi sata usbinput encrypt lvm2 filesystems
* / is an LVM logical volume, which resides on a LUKS volume

Steps to reproduce:
1) Issue shutdown command on a system with a root parition which is an LVM volume atop a LUKS volume.
2) Observe status messages
3) "Deactivating encrypted volumes: root..failed swap..ok

I originally commented on issue 23889 thinking that this was an rc.shutdown issue. Tom Gundersen suggested that the problem I am describing here is related to mkinitcpio. If someone can help me trace the source of the error I will be happy to provide debug output, etc. I am trying to understand if there are negative consequences to what I've observed. Upon reboot I do not see any problems when the partitions are remounted.
This task depends upon

Closed by  Dave Reisner (falconindy)
Wednesday, 04 April 2012, 00:32 GMT
Reason for closing:  Implemented
Additional comments about closing:  mkinitcpio 0.8.6
Comment by Thomas Bächler (brain0) - Wednesday, 22 June 2011, 11:52 GMT
IIRC, it should only try to close root if it is listed in crypttab, which it shouldn't be.

However, closing LVM or encryption requires umounting the file system on it - which in this case is the root file system. You can imagine that this is rather hard to do.

I started a proof-of-concept implementation of a "deinitramfs" with the capability of umounting root [1]. It does not handle LVM or encryption yet, but it is a start.

As for the negative consequences: Not closing LVM is harmless. But failing to close a dm-crypt mapping will not wipe the encryption key from memory and will make you potentially vulnerable to cold boot attacks, allowing an attacker to gain access to your key (force a reboot, boot with a prepared image that scans your memory for cryto-specific structures, extract the key).

[1] http://projects.archlinux.org/users/thomas/deinitramfs.git
Comment by voltaic (voltaic) - Thursday, 23 June 2011, 02:55 GMT
Thank you for your help. Root was listed in crypttab for some reason. Without that entry I don't see the failure message any longer.

At the expense of repeating what you just said, am I correct in saying that we currently cannot close an encrypted root filesystem at shutdown/reboot? If so, I'll have to rethink the benefits of using encryption with root.
Comment by Thomas Bächler (brain0) - Thursday, 23 June 2011, 11:10 GMT
Exactly, you cannot close the encryption mapping unless you umount it first.
Comment by Tom Gundersen (tomegun) - Saturday, 18 February 2012, 12:54 GMT
This should now be rather straightforward to do in the shutdown hook in mkinitcpio. Someone who can test it should provide patches though...
Comment by Dave Reisner (falconindy) - Sunday, 25 March 2012, 00:50 GMT
Working on this for next release...

http://code.falconindy.com/cgit/mkinitcpio.git/log/?h=shutdown-disassemble

Testers welcome (and wanted). If you want to report that it doesn't work, I need the output of 'lsblk' (from util-linux) to be able to troubleshoot.

Loading...