Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Grub can't find root Partition.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Landcy
n00b
n00b


Joined: 05 Jan 2024
Posts: 3

PostPosted: Sat Jan 06, 2024 7:20 am    Post subject: Grub can't find root Partition. Reply with quote

First time installing Gentoo so please excuse my ignorance.
At boot Grub outputs the following error.
Code:
error: no such device: a4a82cef-570e-42e9-97cc-8d1a3ad529a4
error: unknown filesystem
entering rescue mode...


For some important context I've only encrypted my rootfs (following this page on the wiki), I'm using the distribution kernel and and I'm using openrc.

Here's my partition layout and the output of blkid as well as any other files that I thought may be relevant.

Code:
livecd / # lsblk
NAME     MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
loop0      7:0    0 423.9M  1 loop
sda        8:0    0 931.5G  0 disk
├─sda1     8:1    0     1G  0 part  /efi
├─sda2     8:2    0     4G  0 part
└─sda3     8:3    0 926.5G  0 part
  └─root 252:0    0 926.5G  0 crypt /
sdb        8:16   1 115.7G  0 disk
├─sdb1     8:17   1   246K  0 part
├─sdb2     8:18   1   2.8M  0 part
├─sdb3     8:19   1 462.7M  0 part
└─sdb4     8:20   1   300K  0 part
zram0    253:0    0     0B  0 disk


Code:

/dev/sdb3: BLOCK_SIZE="2048" LABEL="ISOIMAGE" TYPE="hfsplus" PARTLABEL="HFSPLUS" PARTUUID="511fff52-b47e-49b4-bc8d-61c9a4fce718"
/dev/loop0: TYPE="squashfs"
/dev/mapper/root: UUID="a4a82cef-570e-42e9-97cc-8d1a3ad529a4" BLOCK_SIZE="512" TYPE="xfs"
/dev/sda3: UUID="e3354f20-b4cc-42ca-91bf-95add58664cf" TYPE="crypto_LUKS" PARTUUID="be368159-270e-d44c-8cce-f6ad76dd7c81"
/dev/sda1: UUID="538F-1852" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="0da13249-2fef-774f-9571-fdc37fc3b20a"
/dev/sdb4: PARTLABEL="Gap1" PARTUUID="511fff52-b47e-49b4-bc8a-61c9a4fce718"
/dev/sdb1: PARTLABEL="Gap0" PARTUUID="511fff52-b47e-49b4-bc8f-61c9a4fce718"
/dev/sda2: PARTUUID="857cd234-9932-6542-84eb-40982a78bf20"


/etc/dracut.conf.d/luks.conf
Code:
add_dracutmodules+=" crypt dm rootfs-block "
kernel_cmdline+=" root=UUID=a4a82cef-570e-42e9-97cc-8d1a3ad529a4 rd.luks.uuid=e3354f20-b4cc-42ca-91bf-95add58664cf "


/etc/default/grub

Code:

GRUB_DISTRIBUTOR="Gentoo"
GRUB_CMDLINE_LINUX="crypt_root=UUID=a4a82cef-570e-42e9-97cc-8d1a3ad529a4 root=/dev/mapper/root "
GRUB_CMDLINE_LINUX_DEFAULT="root=/dev/sda3"
GRUB_DISABLE_LINUX_PARTUUID=false


/etc/fstab

Code:
PARTUUID=0da13249-2fef-774f-9571-fdc37fc3b20a   /efi        vfat    defaults 0 2
/dev/sda2   none         swap    sw                   0 0
/dev/mapper/root   /            xfs    defaults,noatime              0 1


/efi/grub/grub.cfg

Code:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod luks
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}
if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod xfs
search --no-floppy --fs-uuid --set=root a4a82cef-570e-42e9-97cc-8d1a3ad529a4
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
fi
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
        fwsetup
}
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg
fi
### END /etc/grub.d/41_custom ###



I've also ran:

Code:
rc-update add dmcrypt boot


I'm assuming the issue is that the root directory isn't decrypted by the time grub attempts to mount the device. Well, the solution is obviously to decrypt /dev/sda3 but I don't get prompted to enter the passphrase anytime during boot, its this that I'm at a loss for. I'm not sure what I've configured wrong and what the solution out of this is.

So if anyone can help get me on the right track it would be very appreciated.

Thank you
Back to top
View user's profile Send private message
CaptainBlood
Advocate
Advocate


Joined: 24 Jan 2010
Posts: 3672

PostPosted: Sat Jan 06, 2024 8:21 am    Post subject: Reply with quote

Unsure if related, No crypted fs here.

René Rebe from T2 distribution did a debug session for grub-2.12 decryption issue.

EDIT:Not so easy to follow, strong german aceent, and a LOT of rant in this perticular video.

EDIT:IIRC it's iniyially a build issue, then tries to cancel a late patch...

Thks 4 ur attention, interest & support.
_________________
USE="-* ..." in /etc/portage/make.conf here, i.e. a countermeasure to portage implicit braces, belt & diaper paradigm
LT: "I've been doing a passable imitation of the Fontana di Trevi, except my medium is mucus. Sooo much mucus. "


Last edited by CaptainBlood on Sat Jan 06, 2024 9:36 am; edited 1 time in total
Back to top
View user's profile Send private message
sMueggli
Guru
Guru


Joined: 03 Sep 2022
Posts: 380

PostPosted: Sat Jan 06, 2024 9:34 am    Post subject: Reply with quote

As far as I can see, you do not use an unencrypted /boot. But I have the impression, that you want an unencrypted /boot (your /efi has 1 GB, which makes sense if you use the EFI System Partition as /boot).

It is possible to have an encrypted /boot, but this requires Grub to be able to decrypt the LUKS container and that is currently not the case. Therefore it cannot find the device with a4a82cef-...

Do you want full disk encryption or almost full disk encryption (with unencrypted /boot)?
Back to top
View user's profile Send private message
Landcy
n00b
n00b


Joined: 05 Jan 2024
Posts: 3

PostPosted: Sat Jan 06, 2024 10:01 am    Post subject: Reply with quote

Quote:
Do you want full disk encryption or almost full disk encryption (with unencrypted /boot)?


Correct. I didn't want to attempt full disk encryption for this install and so only root (/dev/sda3) has been encrypted. At least to my knowledge. You say you don't see an unencrypted /boot (or /efi which is what I am using as my /boot) but I can mount and read the contents of the boot partition from the livecd without having to use cryptsetup to decrypt it. This is not the case for /dev/sda3 or the root partition. Please correct me if I've misinterpreted your words.

Code:
livecd / # mount /dev/sda1 /mnt/gentoo/
livecd / # ls /mnt/gentoo/
EFI  grub  initramfs.img
livecd / # mount /dev/sda3 /mnt/rotfs/
mount: /mnt/rotfs: unknown filesystem type 'crypto_LUKS'.
       dmesg(1) may have more information after failed mount system call.
livecd / # lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0    7:0    0 423.9M  1 loop /mnt/livecd
sda      8:0    0 931.5G  0 disk
├─sda1   8:1    0     1G  0 part /mnt/gentoo
├─sda2   8:2    0     4G  0 part
└─sda3   8:3    0 926.5G  0 part
sdb      8:16   1 115.7G  0 disk /mnt/cdrom
├─sdb1   8:17   1   246K  0 part
├─sdb2   8:18   1   2.8M  0 part
├─sdb3   8:19   1 462.7M  0 part
└─sdb4   8:20   1   300K  0 part
zram0  253:0    0     0B  0 disk
Back to top
View user's profile Send private message
sMueggli
Guru
Guru


Joined: 03 Sep 2022
Posts: 380

PostPosted: Sat Jan 06, 2024 10:23 am    Post subject: Reply with quote

Landcy wrote:
You say you don't see an unencrypted /boot (or /efi which is what I am using as my /boot) but I can mount and read the contents of the boot partition from the livecd without having to use cryptsetup to decrypt it. This is not the case for /dev/sda3 or the root partition. Please correct me if I've misinterpreted your words.

Code:
livecd / # mount /dev/sda1 /mnt/gentoo/
livecd / # ls /mnt/gentoo/
EFI  grub  initramfs.img


The mountpoint /efi is meant to mount your ESP (EFI System Partition). The ESP does normally store only the bootloader part. The bootloader is now under /efi/EFI/gentoo/grubx64.efi and can be loaded by the firmware at boot time.

Your ESP (/efi) further contains a folder "grub" which contains parts that are used by Grub, before your kernel is loaded. And there is also a initramfs.

But your kernel is still located under /boot which is part of your / partition and is encrypted.

Maybe the easiest is to delete /efi/grub and /efi/initramfs.img. Then unmount /efi and change the mountpoint of the ESP to /boot instead of /efi (changing /etc/fstab) and remount the ESP (now under /boot). Then install Grub again (with emerge and also grub-install), install also the kernel and initramfs again.

If your /boot contains now the directories "EFI" and "grub" and also the kernel and initramfs files, you can recreate your grub.cfg again.
Back to top
View user's profile Send private message
Landcy
n00b
n00b


Joined: 05 Jan 2024
Posts: 3

PostPosted: Sat Jan 06, 2024 11:55 am    Post subject: Reply with quote

Quote:
But your kernel is still located under /boot which is part of your / partition and is encrypted.



Ahhhh I think I understand better now what you were saying. I've done what you've suggested and everything works perfectly now, mostly. I'm getting mount error now related to that /dev/sda3 partition. I think maybe I configured something wrong with dracut its trying to mount /dev/sda3 instead of /dev/mapper/root. Anyway I think I can figure this one out on my own.

Thank you very much!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum