[systemd-devel] Preserve all active encrypted device when shutting down into initramfs

Lennart Poettering lennart at poettering.net
Fri Jul 22 18:28:47 UTC 2016


On Fri, 22.07.16 17:24, Ivan Kabaivanov (chepati at yahoo.com) wrote:

> Hi,
> I'm running LFS (Linux From Scratch) with systemd-230, compiled from source.  I have three LUKS-encrypted devices:
> /dev/mapper/swap/dev/mapper/root/dev/mapper/home
> I want to drop into initramfs and do some maintenance work, for which I require all three of these encrypted devices to remain active.
> I create /run/initramfs with a populated and working initramfs.  I create /run/initramfs/shutdown with permissions 0755 and the following content:
> #/bin/shexec busybox sh
> When I issue the shutdown command I get dropped into the initramfs and I get the busybox shell.  Howerver, only /dev/mapper/root (my / ) remains active.  /dev/mapper/swap and /dev/mapper/home point to non-existent /dev/dm-* block devices.
> Manually trying cryptsetup open /dev/sdaN label just hangs without activating the device.
> I'm guessing systemd goes on a killing spree and kills all the crypt processes, except the ones associated with / (/oldroot in the initramfs).
> Is there a way to tell systemd to keep the encrypted devices active, even if it unmounts their filesystems?

No, this is currently not available. The killing spree will try to
unmount everything it can, detach all loopbacks it can, and
disassemble all DM devices it can (of which LUKS is one type). You are
shutting down after all...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list