You are not logged in.

#1 2024-11-01 04:41:27

Robin-T
Member
Registered: 2024-10-31
Posts: 2

[SOLVED] LUKS on partition, LVM not Mapping VG/LV, LV not activated

Hi,

I have installed Arch in windows Hyper-V VM, I getting following this error when booting,

A password is required to access the volgroup0 volume:
Enter passphrase for /dev/sda3 :
ERROR: device ‘/dev/mapper/volgroup0-lv_root’ not found. Skipping fsck .
mount: /new_root: no valid filesysten type specified.
ERROR: Failed to mount ‘/dev/mapper/volgroup0-lv_root’ on real root
You are now being dropped into an emergency shell .
sh: can’t access tty; job control turned off

Additional details:

  • created separate partition for /root(/dev/sda3) and home(/dev/sdb1) on separate disk

  • setup encryption (LVM on LUKS) on two different partition i.e. /dev/sda1 and /dev/sdb1

  • volume group name = volgroup0

  • logical volume name = /root - lv_root & /home - lv_home

  • separate partition for /boot i.e /dev/sda2 type ext4

  • separate ESP i.e /dev/sda1 type Fat32 and mounting on /boot/EFI

GRUB Boot Time Configuration
GRUB-Live-confg.png

lsblk with file system UUID

NAME              FSTYPE      FSVER            LABEL       UUID                                   FSAVAIL FSUSE% MOUNTPOINTS
loop0             squashfs    4.0                                                                       0   100% /run/archiso/airootfs
sda1              vfat        FAT32                        2DA9-389F                              1021.8M     0% /mnt/boot/EFI
└─sda
sda2              ext4        1.0                          395f33c1-4633-46b8-8fc1-bc6eb843d021    627.6M    29% /mnt/boot
└─sda
sda4              swap        1                            470dc906-22b1-49db-9ce6-3a84706c9856                  [SWAP]
└─sda
sr0               iso9660     Joliet Extension ARCH_202410 2024-10-01-04-30-02-00                       0   100% /run/archiso/bootmnt
volgroup0-lv_root ext4        1.0                          a3c884c7-4675-4868-a9d9-c1fd2b870628     31.4G    14% /mnt
└─cryptroot       LVM2_member LVM2 001                     Zw8XOs-RpUl-9c4R-SbQ2-q5bv-ta34-BAkbJc
  └─sda3          crypto_LUKS 2                            9cf77056-7dff-46f8-b04e-bff4b3be402a
    └─sda
volgroup0-lv_home ext4        1.0                          c9a624ff-8714-460c-b465-a68825937712       37G     0% /mnt/home
└─crypthome       LVM2_member LVM2 001                     U33UtM-DNX4-Dxxq-IS2x-RdRp-egzt-qUPd51
  └─sdb1          crypto_LUKS 2                            5c0d143f-b5ad-4a7a-b314-2dd9c2857241
    └─sdb

Partition Table for /dev/sda

Disk /dev/sda: 127 GiB, 136365211648 bytes, 266338304 sectors
Disk model: Virtual Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 6EDB384A-0FF5-4209-9DC5-77426E72FA1F

Device        Start       End  Sectors Size Type
/dev/sda1      2048   2099199  2097152   1G EFI System
/dev/sda2   2099200   4196351  2097152   1G Linux filesystem
/dev/sda3   4196352  88082431 83886080  40G Linux root (x86-64)
/dev/sda4  88082432 100665343 12582912   6G Linux swap

Partition Table for /dev/sdb

Disk /dev/sdb: 70 GiB, 75161927680 bytes, 146800640 sectors
Disk model: Virtual Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 3A5DECB4-DAE7-41F4-A3B0-8EC75D879FC3

Device     Start      End  Sectors Size Type
/dev/sdb1   2048 83888127 83886080  40G Linux LVM

File System - fstab

root@archiso ~ # cat /mnt/etc/fstab
# /dev/mapper/volgroup0-lv_root
UUID=a3c884c7-4675-4868-a9d9-c1fd2b870628       /             ext4         rw,relatime  0 1

# /dev/mapper/volgroup0-lv_home
UUID=c9a624ff-8714-460c-b465-a68825937712       /home         ext4         rw,relatime  0 2

# /dev/sda2
UUID=395f33c1-4633-46b8-8fc1-bc6eb843d021       /boot         ext4         rw,relatime  0 2

# /dev/sda4
UUID=470dc906-22b1-49db-9ce6-3a84706c9856       none          swap         defaults     0 0

Block ID

root@archiso ~ # blkid
/dev/mapper/crypthome: UUID=”U33UtM-DNX4-Dxxq-IS2x-RdRp-egzt-qUPd51” TYPE=”LVM2_member”
/dev/sdb1: UUID=”5c0d143f-b5ad-4a7a-b314-2dd9c2857241” TYPE=”crypto_LUKS” PARTUUID=”eb61c953-7b40-410a-8bcc-416ad065d43c”
/dev/sr0: BLOCK_SIZE=”2048” UUID=”2024-10-01-04-30-02-00” LABEL=”ARCH_202410” TYPE=”iso9660” PTUUID=”f9f63ac3” PTTYPE=”dos”
/dev/mapper/volgroup0-lv_root: UUID=”a3c884c7-4675-4868-a9d9-c1fd2b870628” BLOCK_SIZE=”4096” TYPE=”ext4”
/dev/loop0: BLOCK_SIZE=”1048576” TYPE=”squashfs”
/dev/mapper/cryptroot: UUID=”Zw8XOs-RpUl-9c4R-SbQ2-q5bv-ta34-BAkbJc” TYPE=”LVM2_member”
/dev/sda4: UUID=”470dc906-22b1-49db-9ce6-3a84706c9856” TYPE=”swap” PARTUUID=”e6c7eb00-2efb-4e3c-b2f1-0b055adf52b1”
/dev/sda2: UUID=”395f33c1-4633-46b8-8fc1-bc6eb843d021” BLOCK_SIZE=”4096” TYPE=”ext4” PARTUUID=”b54e2119-30eb-4d73-a6d0-f8e5e8c5f7a6”
/dev/sda3: UUID=”9cf77056-7dff-46f8-b04e-bff4b3be402a” TYPE=”crypto_LUKS” PARTUUID=”d3a935c5-da6c-45a5-b9f9-c602c827d853”
/dev/sda1: UUID=”2DA9-389F” BLOCK_SIZE=”512” TYPE=”vfat” PARTUUID=”9b15acea-d0db-48b5-9879-23f7b7d3e8c0”
/dev/mapper/volgroup0-lv_home: UUID=”c9a624ff-8714-460c-b465-a68825937712” BLOCK_SIZE=”4096” TYPE=”ext4”

Default GRUB Conf

root@archiso ~ # cat /mnt/etc/default/grub
# GRUB boot loader configuration

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=”Arch”
GRUB_CMDLINE_LINUX_DEFAULT=”loglevel=3 cryptdevice=/dev/sda3:volgroup0 quiet”
GRUB_CMDLINE_LINUX=””

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES=”part_gpt part_msdos”

# Uncomment to enable booting from LUKS encrypted devices
#GRUB_ENABLE_CRYPTODISK=y

GRUB mkconfig

### BEGIN /etc/grub.d/10_linux ###
menuentry ‘Arch Linux’ —class arch —class gnu-linux —class gnu —class os $menuentry_id_option ‘gnulinux-simple-a3c884c7-4675-4868-a9d9-c1fd2b870628’ {
 load_video
 set gfxpayload=keep
 insmod gzio
 insmod part_gpt
 insmod ext2
 set root=’hd0,gpt2’
 if [ x$feature_platform_search_hint = xy ]; then
   search —no-floppy —fs-uuid —set=root —hint-bios=hd0,gpt2 —hint-efi=hd0,gpt2 —hint-baremetal=ahci0,gpt2  395f33c1-4633-46b8-8fc1-bc6eb843d021
 else
   search —no-floppy —fs-uuid —set=root 395f33c1-4633-46b8-8fc1-bc6eb843d021
 fi
 echo   ‘Loading Linux linux-lts …’
 linux  /vmlinuz-linux-lts root=/dev/mapper/volgroup0-lv_root rw  loglevel=3 cryptdevice=/dev/sda3:volgroup0 quiet
 echo   ‘Loading initial ramdisk …’
 initrd /initramfs-linux-lts.img
}

Hooks in mkinitcpio.conf file

##   NOTE: If you have /usr on a separate partition, you MUST include the
#    usr and fsck hooks.
HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block encrypt lvm2 filesystems fsck)

cryptfilesystem etc/crypttab

root@archiso ~ # cat /mnt/etc/crypttab
# Configuration for encrypted block devices.
# See crypttab(5) for details.

# NOTE: Do not list your root (/) partition here, it must be set up
#       beforehand by the initramfs (/etc/mkinitcpio.conf).

# <name>       <device>                                     <password>              <options>
# crypthome    UUID=b8ad5c18-f445-495d-9095-c9ec4f9d2f37    /etc/mypassword1
# data2        /dev/sda5                                    /etc/cryptfs.key
# swap         /dev/sdx4                                    /dev/urandom            swap,cipher=aes-cbc-essiv:sha256,size=256
# vol          /dev/sdb7                                    none

please kindly provide your guidance to resolve this issue

Last edited by Robin-T (2024-11-04 03:12:45)

Offline

#2 2024-11-01 05:58:15

kermit63
Member
Registered: 2018-07-04
Posts: 259

Re: [SOLVED] LUKS on partition, LVM not Mapping VG/LV, LV not activated

GRUB_CMDLINE_LINUX_DEFAULT=”loglevel=3 cryptdevice=/dev/sda3:volgroup0 quiet”

1. What if you try using UUID instead? On some computers /dev/sda and /dev/sdb can swap places during boot, while UUIDs remain consistent across boots.

2. You seem to be missing an argument root=/dev/mapper/volgroup0-lv_root.

3. I suggest removing "quiet" while you're still debugging your installation.

Also, I don't see any /etc/crypttab entry for your home partition. If I'm reading your disk/partition layout correctly, /dev/sdb1 iwas encrypted separately from your root partition, so you need to specify a way to decrypt it during boot.


Never argue with an idiot, they will drag you down to their level and then beat you with experience.
It is better to light a candle than curse the darkness.
A journey of a thousand miles begins with a single step.

Offline

#3 2024-11-04 03:06:18

Robin-T
Member
Registered: 2024-10-31
Posts: 2

Re: [SOLVED] LUKS on partition, LVM not Mapping VG/LV, LV not activated

Issue resolved, due to 2 separate partition(/dev/sda3, /dev/sdb1) is encrypted which is under same Volume group (volgroup0) in that only one partition is root(/dev/sda3) so I used encrypt hook to decrypt only one partition /dev/sda3, so if I decrypt/open one partition at boot time, thus  LVM is not mapping VG & LG’s in /dev/mapper,  because LVM requires all the logical volumes inside the Volume group needs to be decrypt at initial boot phase so that its activated the volume group and logical volumes in it. so the hook encrypt has limited to only one partition to decrypt at boot time, so I have created custom hoot i.e. encrypt2 and resolved this issue, Thank for your suggestions

refer below link for more details :
https://wiki.archlinux.org/title/Dm-cry … partitions

Offline

Board footer

Powered by FluxBB