You are not logged in.

#1 2019-01-13 15:00:03

handella
Member
Registered: 2018-12-28
Posts: 6

[SOLVED] LVM on LUKS Installation - emergency shell on boot

Hi guys! wink

I'm trying to go through an encrypted Arch Install in a virtual machine and this is what I tried:

fdisk -l

fdisk /dev/sdX
	g
	Device      Size        Type			# I won't list the
	/dev/sdX1   1M          BIOS boot		# things I need to
	/dev/sdX2   512M        Linux Filesystem	# type in order to
	/dev/sdX3   left space  Linux LVM		# get this
	p        # this prints the above
	w

cryptsetup luksFormat --type luks2 /dev/sdX3
cryptsetup open /dev/sdX3 cryptlvm

pvcreate /dev/mapper/cryptlvm

vgcreate MyVolGroup /dev/mapper/cryptlvm

lvcreate -L 8G MyVolGroup -n swap
lvcreate -L 32G MyVolGroup -n root
lvcreate -l 100%FREE MyVolGroup -n home

mkfs.ext4 /dev/sdX2					# Here I
mkfs.ext4 /dev/MyVolGroup/root				# format
mkfs.ext4 /dev/MyVolGroup/home				# all the
mkswap /dev/MyVolGroup/swap				# partitions

mount /dev/MyVolGroup/root /mnt				# Here I
mkdir /mnt/boot						# mount the
mount /dev/sdX2 /mnt/boot				# partitions
mkdir /mnt/home						# and create
mount /dev/MyVolGroup/home /mnt/home			# the needed
swapon /dev/MyVolGroup/swap				# mountpoints

pacstrap -i /mnt base

genfstab -U /mnt >> /mnt/etc/fstab

mkdir /mnt/hostrun					# I do these steps, because else I won't be able
mount --bind /run /mnt/hostrun				# to run 'grub-mkconfig -o /boot/grub/grub.cfg' later

arch-chroot /mnt

mkdir /run/lvm						# These steps are also necessary in order
mount --bind /hostrun/lvm /run/lvm			# to run 'grub-mkconfig -o /boot/grub/grub.cfg' later

# here I do some configuration (e.g. language, timezone, wif, users, ...)

pacman -S intel-ucode
# or
pacman -S amd-ucode

pacman -S grub efibootmgr

grub-install --target=i386-pc /dev/sdX --recheck

nano /etc/mkinitcpio.conf				# I add 'encrypt' and 'lvm2' to 'HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)'
	HOOKS=(base udev autodetect modconf block encrypt lvm2 filesystems keyboard fsck)

nano /etc/default/grub					# I edit the line with 'GRUB_CMDLINE_LINUX=""'
	GRUB_CMDLINE_LINUX="cryptdevice=UUID=/dev/sdX3:cryptlvm root=/dev/MyVolGroup/root"

grub-mkconfig -o /boot/grub/grub.cfg

history -c && exit

umount -R /mnt && reboot

As you can see, I needed to do some steps that aren't documented in LVM on LUKS - Encrypted installation
This is the workaround that is needed to run grub-mkconfig -o /boot/grub/grub.cfg after installing grub.
But otherwise, I followed the Installation guide in combination with the Encrypted installation guide.

Now... The problem is, that I get this error message after rebooting: sad

starting version 240
ERROR: device '/dev/MyVolGroup/root' not found. Skipping fsck.
mount: /new_root: no filesystem type specified.
You are now being dropped into an emergency shell.
sh: can't access tty; job control turned off
[rootfs ]# _

It seems like it can't find the root partition, but it can find the boot partition. Where exactly did I mess it up?

Thanks in advance! smile

Last edited by handella (2019-01-13 16:08:43)

Offline

#2 2019-01-13 15:21:23

frostschutz
Member
Registered: 2013-11-15
Posts: 702

Re: [SOLVED] LVM on LUKS Installation - emergency shell on boot

In the rootfs shell, is the luks device /dev/sdX3 present? Is the /dev/mapper/ device present? (Did it ask for pass at all?)

cryptdevice=UUID=/dev/sdX3 looks mighty strange, should be UUID=youractual LUKS UUID (as shown in cryptsetup luksDump) or just cryptdevice=/dev/sdX3 without UUID= (prone to device name changes)

Offline

#3 2019-01-13 15:46:54

handella
Member
Registered: 2018-12-28
Posts: 6

Re: [SOLVED] LVM on LUKS Installation - emergency shell on boot

frostschutz wrote:

In the rootfs shell, is the luks device /dev/sdX3 present? Is the /dev/mapper/ device present? (Did it ask for pass at all?)

/dev/sdX3 does exist, but the /dev/mapper/ device isn't present.

frostschutz wrote:

cryptdevice=UUID=/dev/sdX3 looks mighty strange, should be UUID=youractual LUKS UUID (as shown in cryptsetup luksDump) or just cryptdevice=/dev/sdX3 without UUID= (prone to device name changes)

I booted into the machine with the install-iso and changed GRUB_CMDLINE_LINUX="cryptdevice=UUID=/dev/sdX3:cryptlvm root=/dev/MyVolGroup/root" to GRUB_CMDLINE_LINUX="cryptdevice=/dev/sdX3:cryptlvm root=/dev/MyVolGroup/root" and ran grub-mkconfig -o /boot/grub/grub.cfg again, but the same thing happened... sad Are there more steps, I need to do after changing the line in /etc/default/grub?

Offline

#4 2019-01-13 15:56:26

frostschutz
Member
Registered: 2013-11-15
Posts: 702

Re: [SOLVED] LVM on LUKS Installation - emergency shell on boot

In the rootfs shell you can `cat /proc/cmdline` to see if it booted with the parameters you expected. If not, you have to fix your grubcfg.

After editing mkinitcpio.conf, did you run mkinitcpio -p linux to actually rebuild it? It's not shown in your list of commands above.

Simple test: is cryptsetup command available in the rootfs shell? If not, you have to boot a live cd, mount your root and boot partitions, chroot, and rebuild initramfs.

Offline

#5 2019-01-13 16:08:22

handella
Member
Registered: 2018-12-28
Posts: 6

Re: [SOLVED] LVM on LUKS Installation - emergency shell on boot

frostschutz wrote:

After editing mkinitcpio.conf, did you run mkinitcpio -p linux to actually rebuild it? It's not shown in your list of commands above.

Thank you! That solved the problem... I forgot that step! smile

Offline

#6 2019-01-13 16:18:39

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 2,853

Re: [SOLVED] LVM on LUKS Installation - emergency shell on boot

There is https://bugs.archlinux.org/task/61334 but the latest systemd package in [core] should fix this.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB