View previous topic :: View next topic |
Author |
Message |
antonomasia n00b
Joined: 07 Dec 2019 Posts: 6
|
Posted: Fri Sep 10, 2021 8:52 pm Post subject: [SOLVED] GRUB won't boot LVM LUKS |
|
|
When I try to boot I just get a black screen with GRUB at the top left and a flashing cursor. I originally had a LUKS encrypted /boot but I couldn't get it to boot and it was always being formatted so I removed it and only kept the encryption on my other partition but it still won't boot. The boot partition is /dev/sda1 and the other partitions are on /dev/sda3 in an LVM group.
This is my grub.cfg:
Code: |
### BEGIN /etc/grub.d/10_linux ###
menuentry "Gentoo" {
insmod luks
insmod lvm
set root=(hd0,0)
cryptdevice=UUID=f0d38e7a-e51e-4ee8-99ee-17be586f754e:lvm
linux custom00-linux-5.10.61-gentoo root=/dev/mapper/vg0-root
initrd initramfs-x86_64-5.10.61-gentoo
}
### END /etc/grub.d/10_linux ###
|
output of blkid:
Code: |
/dev/mapper/lvm: UUID="KsRj8m-8ym3-YGUx-g0IE-gMWM-JlRO-FxmMnu" TYPE="LVM2_member"
/dev/mapper/vg0-home: UUID="db421ab9-7dd8-4d82-9e8c-89064cf8175c" BLOCK_SIZE="4096" TYPE="ext4"
/dev/sdb1: LABEL_FATBOOT="Tails" LABEL="TAILS" UUID="308E-3CF4" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="Tails" PARTUUID="1ae787bc-5b1e-4c12-acf3-992bac4b6318"
/dev/mapper/vg0-usr: UUID="e36023b8-8aaa-4fa8-abbb-eb2bc50a1867" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/vg0-tmp: UUID="c19cf098-7741-4107-b59d-687497799c74" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/vg0-root: UUID="b47c1026-c0bd-4768-9d6e-aa1c045bda30" BLOCK_SIZE="4096" TYPE="ext4"
/dev/loop0: TYPE="squashfs"
/dev/mapper/vg0-var: UUID="8079061d-f756-4742-987f-5aac5232d60d" BLOCK_SIZE="4096" TYPE="ext4"
/dev/sda3: UUID="f0d38e7a-e51e-4ee8-99ee-17be586f754e" TYPE="crypto_LUKS" PARTLABEL="lvm" PARTUUID="76b38199-e44f-4974-970c-34a2bc6bb652"
/dev/sda1: UUID="5e83e6b7-fbc1-444d-a129-ea977d25ed34" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="grub" PARTUUID="74a63fb1-5456-483e-9a6b-3f01e3ed5264"
/dev/mapper/vg0-dev.shm: UUID="400d29ea-ea4c-41e9-a65e-a4e6469e2987" BLOCK_SIZE="4096" TYPE="ext4"
/dev/mapper/vg0-swap: UUID="785a51bf-cf74-40fb-975f-2ee8b0a351dc" TYPE="swap"
/dev/sdb2: UUID="FC34-83F2" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="TailsData" PARTUUID="08ece7c0-e7c0-4d9b-8765-b13279b828ec"
/dev/sdc1: LABEL="GENTOO AMD6" UUID="1C0F-431E" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="0008d548-01"
|
fstab:
Code: |
/dev/sda1 /boot ext4 noauto 0 0
/dev/mapper/vgo-root / ext4 0 0
/dev/mapper/vg0-usr /usr ext4 0 0
/dev/mapper/vg0-var /var ext4 0 0
/dev/mapper/vg0-tmp /tmp ext4 nodev,nosuid,noexec 0 0
/dev/mapper/vg0-dev.shm /dev/shm ext4 nodev,nosuid,noexec 0 0
/dev/mapper/vg0-home /home ext4 nodev 0 0
|
/etc/default/grub:
Code: |
GRUB_DISTRIBUTOR="Gentoo"
GRUB_ENABLE_CRYPTODISK=y
GRUB_PRELOAD_MODULES='lvm'
GRUB_CMDLINE_LINUX="dolvm cryptdevice=UUID="f0d38e7a-e51e-4ee8-99ee-17be586f754e":lvm root=/dev/mapper/vg0-root"
|
I used this command to install GRUB:
Code: |
grub-install --modules="lvm luks part_gpt cryptodisk gcry_rijndael gcry_sha512 btrfs" /dev/sda
|
Thinking it may be the initramfs I used both this:
Code: |
genkernel --install --luks --lvm --kernel-config=/usr/src/linux/.config initramfs --no-ramdisk-modules
|
and this:
Code: |
dracut -a lvm root=UUID=f0d38e7a-e51e-4ee8-99ee-17be586f754e --kmoddir=/lib/modules/5.10.61-gentoo/
|
I'm pretty sure I enabled all the right options in the kernel .config
https://pastebin.com/bfLmTfhV
Last edited by antonomasia on Sun Sep 12, 2021 12:18 pm; edited 1 time in total |
|
Back to top |
|
|
alamahant Advocate
Joined: 23 Mar 2019 Posts: 3879
|
Posted: Fri Sep 10, 2021 9:24 pm Post subject: |
|
|
Hi
You have
Quote: |
GRUB_DISTRIBUTOR="Gentoo"
GRUB_ENABLE_CRYPTODISK=y
GRUB_PRELOAD_MODULES='lvm'
GRUB_CMDLINE_LINUX="dolvm cryptdevice=UUID="f0d38e7a-e51e-4ee8-99ee-17be586f754e":lvm root=/dev/mapper/vg0-root"
|
Plz make it
Quote: |
GRUB_DISTRIBUTOR="Gentoo"
###GRUB_ENABLE_CRYPTODISK=y ##### I think needed only for encrypted /boot but you removed it no?
GRUB_PRELOAD_MODULES='part_gpt part_msdos luks lvm'
GRUB_CMDLINE_LINUX="cryptdevice=UUID=f0d38e7a-e51e-4ee8-99ee-17be586f754e:lvm root=/dev/mapper/vg0-root rootfstype=ext4"
|
Then
Code: |
USE="device-mapper" emerge -1av grub
dracut --force --kver 5.10.61-gentoo
rc-update add dmcrypt boot
rc-update add lvm boot
grub-mkconfig -o /boot/grub/grub.cfg
|
Yes you absolutely need initramfs for this.
if it works make USE change permanent. _________________
Last edited by alamahant on Fri Sep 10, 2021 10:05 pm; edited 1 time in total |
|
Back to top |
|
|
antonomasia n00b
Joined: 07 Dec 2019 Posts: 6
|
Posted: Fri Sep 10, 2021 9:50 pm Post subject: |
|
|
Tried all that and it still doesn't work |
|
Back to top |
|
|
alamahant Advocate
Joined: 23 Mar 2019 Posts: 3879
|
Posted: Fri Sep 10, 2021 10:01 pm Post subject: |
|
|
What happens?
Quote: |
When I try to boot I just get a black screen with GRUB at the top left and a flashing cursor.
|
Do you arrive at the grub menu?
If not your grub is messed.
Dont use this
Code: |
grub-install --modules="lvm luks part_gpt cryptodisk gcry_rijndael gcry_sha512 btrfs" /dev/sda
|
First is it a bios or uefi install?
If bios use a simple
Code: |
grub-install /dev/sda
|
But i see some vfat partitions in your lsblk.
Are they efi partitions?
Also please run grub-mkconfig........... _________________
|
|
Back to top |
|
|
antonomasia n00b
Joined: 07 Dec 2019 Posts: 6
|
Posted: Fri Sep 10, 2021 11:13 pm Post subject: |
|
|
alamahant wrote: | What happens?
|
My partition table was screwed up so I formatted them creating a grub bios on /dev/sda1 and an EFI FAT32 on /dev/sda2 which is the new /boot. I'm using GPT and now it shows the grub screen but when I select Gentoo it says "invalid file name custom00-linux-5.10.61-gentoo" and "error: you need to load the kernel first" even though I've updated my grub.cfg to point to sda2, copied the kernel over, rebuilt the initramfs and done a new grub-install. |
|
Back to top |
|
|
alamahant Advocate
Joined: 23 Mar 2019 Posts: 3879
|
Posted: Fri Sep 10, 2021 11:34 pm Post subject: |
|
|
Either use bios boot or uefi.
You have mixed them both.
You shouldnt.
Put this in your make.conf
Code: |
GRUB_PLATFORMS="efi-64"
|
Then ry this
Code: |
USE="device-mapper" emerge -1av grub
grub-install --target=x86_64-efi --efi-directory=/boot
|
Do NOT use
Code: |
grub-install /dev/sda ###### DONOTUSE
|
_________________
|
|
Back to top |
|
|
antonomasia n00b
Joined: 07 Dec 2019 Posts: 6
|
Posted: Sat Sep 11, 2021 12:27 am Post subject: |
|
|
alamahant wrote: | Either use bios boot or uefi.
[/code] |
I've done all that and I'm still getting the same error.
On the grub command line 'ls (hd1,gpt2)/' shows my kernel but setting the grub.cfg root to hd1,gpt2 still doesn't work and there's deffo no typos. |
|
Back to top |
|
|
antonomasia n00b
Joined: 07 Dec 2019 Posts: 6
|
Posted: Sat Sep 11, 2021 1:10 am Post subject: |
|
|
antonomasia wrote: | alamahant wrote: | Either use bios boot or uefi.
[/code] |
I've done all that and I'm still getting the same error.
On the grub command line 'ls (hd1,gpt2)/' shows my kernel but setting the grub.cfg root to hd1,gpt2 still doesn't work and there's deffo no typos. |
UPDATE: I got past GRUB by adding a / to the kernel and initrd locations but now I'm stuck with the dracut refusing to boot saying /dev/mapper/vg0-root does not exist
UPDATE 2: Got it to decrypt the partition by adding 'root=/dev/mapper/vg0-root rd.luks.uuid=</dev/sda3's UUID>' to grub.cfg. The wiki needs updating as it says it the wrong way around and uses 'kernel' instead of 'linux' and adds an unnecessary '/boot' before the filenames. Now it's failing because it's adding a '-o 0' option when mounting and outputting "Unrecognised mount option "0" or missing value".
UPDATE 3: got it decrypting using genkernel too by renaming 'rf.luks.uuid' to 'crypt_root=UUID=' and adding 'dolvm'. It mounts /root but fails at /usr using the -o 0 option again and outputting "invalid option" and "init (/sbin/init) not found in mounted root device". Also there was a typo in fstab 'vgo-root' instead of 'vg0-root'.
UPDATE 4: Just realised some of the mount options in the fstab file were empty so I replaced them with defaults and now it boots. |
|
Back to top |
|
|
|