0

I've setup a Kali Linux installation on an SD card and created an encrypted LUKS partition with a LVM logical volume inside of it, then created a BTRFS filesystem inside. Almost everything works, but boot fails after decrypting the LUKS volume succeeds. Logs:

Begin: Loading essential drivers ... done.
Begin: Mounting root file system ... Begin: Running /scrypts/local-top ... [ 8.655803] device-mapper: ioctl: 4.28.0-ioctl (2014-09-17) initialised: dm-devel@redhat.com
[ 8.689182] random: lvm urandom read with 113 bits of entropy available
  Volume group "pi" not found
  Skipping volume group pi
Unable to find LVM volume pi/root
Unlocking the disk /dev/mmcblk0p2 (picrypt)
Enter passphrase:
Reading all physical volumes. This may take a while...
  Found volume group "pi" using metadata type lvm2
  ffff0000-ffff1000 r-xp 00000000 00:00 0    [vectors]: mlock failed: Cannot allocate memory
  1 logical volume(s) in volume group "pi" now active
  ffff0000-ffff1000 r-xp 00000000 00:00 0    [vectors]: munlock failed: Cannot allocate memory
cryptsetup: picrypt set up successfully
done.
Begin: Running /scripts/local-premount ... done.
mount: mounting /dev/mapper/pi-root on /root failed: Invalid argument
Begin: Running /scripts/local-bottom ... done.
done.
Begin: Running /scripts/init-bottom ... mount: mounting /de on /root/dev failed: No such file or directory
done.
Target filesystem doesn't have requested /sbin/init.
No init found. Try passing init= bootarg.
modprobe: module i8042 not found in modules.dep
modprobe: module atkbd not found in modules.dep
modprobe: module ehci-pci not found in modules.dep
modprobe: module ehci-orion not found in modules.dep
modprobe: module ehci-hcd not found in modules.dep
modprobe: module uhci-hcd not found in modules.dep
modprobe: module ohci-hcd not found in modules.dep

BusyBox v1.20.2 (Debian 1:1.20.0-7) built-in shell (ash)
Enter 'help' for a list of built-in commands.

/bin/sh: can't access tty; job control turned off

It seems to fail to be able to mount my root filesystem. In the initramfs, I can actually mount the BTRFS partition just fine using all the options given in fstab. It seems to fail initially, for some strange reason that I can't diagnose.

In the initramfs, running the following works:

mount -t btrfs -o defaults,subvol=@,compress=lzo,ssd,noatime /dev/mapper/pi-root /root

Mounting works and I can see the filesystem properly.

Here's my /etc/fstab:

proc                   /proc    proc     defaults                                      0    0
/dev/mmcblk0p1         /boot    vfat     defaults                                      0    2
/dev/mapper/pi-root    /        btrfs    defaults,subvol=@,compress=lzo,ssd,noatime    0    1

Here's my /etc/crypttab:

picrypt /dev/mmcblk0p2 none luks

Here's my kernel command line:

dwc_otg.fiq_fix_enable=1 console=tty1 console=tty1 root=/dev/mapper/pi-root cryptopts=target=picrypt,source=/dev/mmcblk0p2,lvm=pi rootfstype=btrfs rootwait rootdelay=5 ro rootflags=noload,subvol=@

I've made sure that initramfs.gz is up to date.

Again, to reiterate, here's my setup:

  • SD Card
    • Boot VFAT FS
    • LUKS Encrypted FS (picrypt)
    • LVM Logical Volume (/dev/mapper/pi-root)
      • BTRFS Filesystem
      • BTRFS Subvolume (subvol=@)

I have a fairly identical setup as this on my main laptop, which works fine.

During Boot, here's what happens and then what fails:

  1. Decrypt LUKS Volume picrypt: Works
  2. Open Volume Group pi and LV root: Works
  3. Try mounting LV root via fstab: Fails with Invalid argument.

Busybox also seems to fail with not being able to access the tty, but that's irrelevant to the problem.

How can I debug what's going wrong here?

0

The error was caused by this parameter in my kernel line:

rootflags=noload,subvol=@

This parameter's value is passed directly to mount as filesystem options for mounting the root filesystem. By inserting debugging statements into /scripts/local (generated from /usr/share/initramfs-tools/scripts/local), I was able to determine what went wrong with the mount parameters and was able to then fix my boot command line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.