2

My system was installed with the Antergos installer and it runs encrypted GRUB. This works fine, just have to insert decryption key twice.

Then I added LVM and created three LVM volumes, boot root and swap. Now I want to update my GRUB with this LVM setup so I can choose to boot the second OS from LVM or just boot Arch.

NAME                                            MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                                               8:0    0 465.8G  0 disk  
├─sda1                                            8:1    0  65.2G  0 part  
│ └─luks                                        254:0    0  65.2G  0 crypt /
├─sda2                                            8:2    0   3.7G  0 part  
│ └─luks-14a10aeb-01ec-44f4-b908-0c09685a03ed   254:4    0   3.7G  0 crypt /run/media/thijs/74ec47c2-64ed-4fe5-a965-a5e414b7a129
└─sda3                                            8:3    0 396.9G  0 part  
  ├─triagia-kaliboot                            254:1    0   500M  0 lvm   /run/media/thijs/f1eb6904-c17e-40b7-8740-60e67b8d04de
  ├─triagia-kaliroot                            254:2    0    50G  0 lvm   
  │ └─luks-26028d27-8a95-41c3-9d80-9415b8c170dc 254:6    0    50G  0 crypt /run/media/thijs/65c769fd-ea4a-4854-928c-3c28f15745aa
  └─triagia-kaliswap                            254:3    0     4G  0 lvm   
    └─luks-a0fa8f9e-e6d0-42d7-b54c-7c275ddc328a 254:5    0     4G  0 crypt 

But when I use grub-mkconfig, the script never finds the boot partition in the LVM. I've used vgscan and vgchange to make them active and mounted the LVM volumes but still grub-mkconfig only reports the boot on sda1.

Research points a lot to taking /boot out of the LVM but I don't like that. I'd add the needed GRUB config manually but I couldn't find an example.

Volumes:

  --- Logical volume ---
  LV Path                /dev/triagia/kaliboot
  LV Name                kaliboot
  VG Name                triagia
  LV UUID                e68eqU-zP3Q-YnwY-ds6M-MG34-zAB5-VhZcAQ
  LV Write Access        read/write
  LV Creation host, time conDoin, 2015-08-21 17:50:52 +0200
  LV Status              available
  # open                 0
  LV Size                500.00 MiB
  Current LE             125
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0

  --- Logical volume ---
  LV Path                /dev/triagia/kaliroot
  LV Name                kaliroot
  VG Name                triagia
  LV UUID                Bco7iM-ZlQR-NyeI-Nl1r-N1IK-kooC-oBCfV6
  LV Write Access        read/write
  LV Creation host, time conDoin, 2015-08-21 17:51:09 +0200
  LV Status              available
  # open                 0
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:1

  --- Logical volume ---
  LV Path                /dev/triagia/kaliswap
  LV Name                kaliswap
  VG Name                triagia
  LV UUID                POkVXd-UMoe-yHaB-nfrV-lbpO-Fv3l-86N7AT
  LV Write Access        read/write
  LV Creation host, time conDoin, 2015-08-21 17:54:32 +0200
  LV Status              available
  # open                 0
  LV Size                4.00 GiB
  Current LE             1024
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:2

After some extra-extra reading on the Arch forums I've added lvm2 to mkinitcpio.conf under HOOKS.

HOOKS="base udev autodetect modconf block keyboard keymap encrypt resume lvm2 filesystems fsck"

And then I ran again:

mkinitcpio -p linux
systemctl enable lvm2-lvmetad.service
grub-mkconfig -o /boot/grub/grub.cfg

But this didn't change anything.

Boot volume

drwxr-x---+ 4 root root       80 Aug 23 19:19 ..
drwxr-xr-x  4 root root     1024 Aug 21 18:18 .
-rw-r--r--  1 root root 19692558 Aug 21 18:18 initrd.img-4.0.0-kali1-amd64
drwxr-xr-x  2 root root     1024 Aug 21 18:14 grub
drwx------  2 root root    12288 Aug 21 18:00 lost+found
-rw-r--r--  1 root root   165968 Jun  3 10:08 config-4.0.0-kali1-amd64
-rw-r--r--  1 root root  2790804 Jun  3 10:08 System.map-4.0.0-kali1-amd64
-rw-r--r--  1 root root  3274048 Jun  3 10:07 vmlinuz-4.0.0-kali1-amd64

grub dir:

drwxr-xr-x 4 root root    1024 Aug 21 18:18 ..
drwxr-xr-x 2 root root    1024 Aug 21 18:14 .
-rw-r--r-- 1 root root 2400500 Aug 21 18:14 unicode.pf2

I've created a manual Grub config in 40_custom and this almost works. The LVM is found and luks on root is decrypted but then I get this error:

Begin: Running /scripts/init-bottom ... mount: mounting /dev on /root/dev failed: No such file or directory
done.
No init found. Try passing init= bootarg.

Then I'm left with command line: (initramfs) _

Manual GRUB config:

menuentry 'Kali' {
insmod lvm
insmod gzio
insmod part_msdos
insmod ext2
set root=lvm/triagia-kaliboot
search --no-floppy --fs-uuid --set=root f1eb6904-c17e-40b7-8740-60e67b8d04de
linux /vmlinuz-4.0.0-kali1-amd64 root=/dev/mapper/triagia-kaliboot setkmap=us
initrd /initrd.img-4.0.0-kali1-amd64
}

migrated from serverfault.com Aug 22 '15 at 16:55

This question came from our site for system and network administrators.

  • How confident are you that your core.img is built to support reading from LVM? I know you're not getting as far as failing to boot, but the problems may well be related. – womble Aug 22 '15 at 9:46
  • Absolutely not confident. It's created during initial installation of Arch using the Antergos installer. I can see that GRUB loads the lvm module so that may be a good sign.. – Thijs Aug 22 '15 at 9:52
0

You will need to add the kernel parameter in order for GRUB to decrypt the disk so that it can load your kernel.

Add command below into GRUB's kernel parameter:

cryptdevice=UUID=device-UUID:lvm root=/dev/mapper/MyVol-root
The <device-UUID> refers to the UUID of /dev/sdaX

Decrypt and then boot, that's it. For more information, please refer to Arch Wiki.

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.