You are not logged in.
Hey all,
I recently used this guide to create a persistent Arch flash drive that can be booted in both BIOS and UEFI mode.
Later on, I decided I wanted to encrypt the root partition in case I lose the flash drive.
I successfully encrypted the root partition following the instructions on the Arch wiki and am able to open and mount it when booting from the Arch installation media.
When booting the flash drive alone, however, after selecting Arch Linux from the GRUB menu, I get the following error:
error: disk 'hd0,gpt2' not found.
error: disk 'hd0,gpt2' not found.
error: disk 'hd0,gpt2' not found.
error: disk 'hd0,gpt2' not found.
error: disk 'hd0,gpt2' not found.
error: disk 'hd0,gpt2' not found.
error: disk 'hd0,gpt2' not found.
error: disk 'hd0,gpt2' not found.
error: disk 'hd0,gpt2' not found.
error: disk 'hd0,gpt2' not found.
error: disk 'hd0,gpt2' not found.
error: disk 'hd0,gpt2' not found.
error: disk 'hd0,gpt2' not found.
error: disk 'hd0,gpt2' not found.
Press any key to continue...And it sends me back to the GRUB menu when I press any key. I get the exact same error when booting in both BIOS and UEFI mode.
Here is my /etc/fstab. The weird options on my root partition are to reduce wear on the flash drive.
# /dev/mapper/root
UUID=be3b9c09-3750-4174-bf96-f99a3ff03f50 / ext4 rw,noatime,lazytime,commit=600 0 1
# /dev/sdX2
UUID=3529-9561 /boot vfat rw,noatime,lazytime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2Here is my /etc/default/grub (excluding comments). I made sure to run grub-mkconfig -o /boot/grub/grub.cfg while chroot'd into the flash drive after every change (boot was mounted too).
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Arch"
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet cryptdevice=UUID=f4b4e102-43ef-4329-a86f-218d5b066b5d:root root=/dev/mapper/root"
GRUB_CMDLINE_LINUX=""
GRUB_PRELOAD_MODULES="part_gpt part_msdos usb usb_keyboard ohci uhci ehci"
GRUB_ENABLE_CRYPTODISK=y
GRUB_TIMEOUT_STYLE=menu
GRUB_TERMINAL_INPUT="usb_keyboard"
GRUB_GFXMODE=auto
GRUB_GFXPAYLOAD_LINUX=keep
GRUB_DISABLE_RECOVERY=trueHere is my /etc/mkinitcpio.conf (excluding comments). I made sure to run mkinitcpio -P while chroot'd into the flash drive after every change.
MODULES=()
BINARIES=()
FILES=()
HOOKS=(base udev autodetect keyboard modconf block encrypt filesystems fsck)Any and all help will be appreciated. Thanks.
-cobalt32
Last edited by cobalt32 (2022-06-11 07:54:15)
Offline
For anyone in the future who comes across a similar issue, the following topics may be useful to you.
https://bbs.archlinux.org/viewtopic.php?id=267279
https://bbs.archlinux.org/viewtopic.php?id=268460
I realized that GRUB does not fully support LUKS2 yet, so I converted my LUKS2 partition to LUKS1.
After a grub-install and grub-mkconfig, I now see the insmod cryptodisk, insmod luks, and cryptomount commands in my grub.cfg necessary to unlock the root partition during boot.
Unfortunately, I am still receiving the original errors when attempting to boot.
When GRUB debug is enabled (set debug=all), it appears that the first eight of the "error: disk 'hd0,gpt2' not found." errors occur during the load_video function, one at the beginning and one after each insmod. It attempts to open 'hd0,gpt2' and fails.
Most of the others occur when GRUB is trying to load the kernel and initial ramdisk.
kern/disk.c:XXX:disk: Opening 'hd0,gpt2'...
kern/disk.c:XXX:disk: Opening 'hd0,gpt2' failed.
kern/disk.c:XXX:disk: Closing 'hd0'.I believe 'hd0,gpt1' is my /boot partition, as it is /dev/sdX2. However, there is no mention of 'hd0,gpt1' in my grub.cfg, only of 'hd1,gpt2'
Below is my full /boot/grub/grub.cfg.
#
# 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 part_gpt
insmod part_msdos
insmod usb
insmod usb_keyboard
insmod ohci
insmod uhci
insmod ehci
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 part_gpt
insmod cryptodisk
insmod luks
insmod gcry_rijndael
insmod gcry_rijndael
insmod gcry_sha256
insmod ext2
cryptomount -u f4b4e10243ef4329a86f218d5b066b5d
set root='cryptouuid/f4b4e10243ef4329a86f218d5b066b5d'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint='cryptouuid/f4b4e10243ef4329a86f218d5b066b5d' be3b9c09-3750-4174-bf96-f99a3ff03f50
else
search --no-floppy --fs-uuid --set=root be3b9c09-3750-4174-bf96-f99a3ff03f50
fi
font="/usr/share/grub/unicode.pf2"
fi
if loadfont $font ; then
set gfxmode=auto
load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=en_US
insmod gettext
fi
terminal_input usb_keyboard
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 ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-be3b9c09-3750-4174-bf96-f99a3ff03f50' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod fat
set root='hd1,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci1,gpt2 3529-9561
else
search --no-floppy --fs-uuid --set=root 3529-9561
fi
echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=be3b9c09-3750-4174-bf96-f99a3ff03f50 rw loglevel=3 quiet cryptdevice=UUID=f4b4e102-43ef-4329-a86f-218d5b066b5d:root root=/dev/mapper/root
echo 'Loading initial ramdisk ...'
initrd /initramfs-linux.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-be3b9c09-3750-4174-bf96-f99a3ff03f50' {
menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-be3b9c09-3750-4174-bf96-f99a3ff03f50' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod fat
set root='hd1,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci1,gpt2 3529-9561
else
search --no-floppy --fs-uuid --set=root 3529-9561
fi
echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=be3b9c09-3750-4174-bf96-f99a3ff03f50 rw loglevel=3 quiet cryptdevice=UUID=f4b4e102-43ef-4329-a86f-218d5b066b5d:root root=/dev/mapper/root
echo 'Loading initial ramdisk ...'
initrd /initramfs-linux.img
}
menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-be3b9c09-3750-4174-bf96-f99a3ff03f50' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod fat
set root='hd1,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd1,gpt2 --hint-efi=hd1,gpt2 --hint-baremetal=ahci1,gpt2 3529-9561
else
search --no-floppy --fs-uuid --set=root 3529-9561
fi
echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=be3b9c09-3750-4174-bf96-f99a3ff03f50 rw loglevel=3 quiet cryptdevice=UUID=f4b4e102-43ef-4329-a86f-218d5b066b5d:root root=/dev/mapper/root
echo 'Loading initial ramdisk ...'
initrd /initramfs-linux-fallback.img
}
}
### 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 ###Offline
grub only supports LUKS1 if grub itself is on an encrypted partition, your boot partition is not encrypted so you can use LUKS2 no worries.
this does not look right:
linux /vmlinuz-linux root=UUID=be3b9c09-3750-4174-bf96-f99a3ff03f50 rw loglevel=3 quiet cryptdevice=UUID=f4b4e102-43ef-4329-a86f-218d5b066b5d:root root=/dev/mapper/rootroot is defined twice, take this out of "/etc/default/grub"
root=/dev/mapper/rootas for the actual problem its hard to tell without a bit more info, chroot into the system and mount everything as if you were going to update grub and post outputs of:
lsblk -f
fdisk -xOffline
Here is the output of lsblk -f.
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
loop0 squashfs 4.0
sda
└─sda1 vfat FAT32 ARCH_202205 2444-0869
sdb
├─sdb1
├─sdb2 vfat FAT32 3529-9561 424.3M 15% /boot
└─sdb3 crypto_LUKS 1 f4b4e102-43ef-4329-a86f-218d5b066b5d
└─root ext4 1.0 be3b9c09-3750-4174-bf96-f99a3ff03f50 214.6G 3% /
nvme0n1 Here is the output of fdisk -x.
Disk /dev/nvme0n1: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: SAMSUNG MZVLW512HMJP-000H1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 3.73 GiB, 4009754624 bytes, 7831552 sectors
Disk model: USB Flash Disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 6392A75B-BF62-43C8-96AF-6F0982A8EF6B
First usable LBA: 34
Last usable LBA: 7831518
Alternative LBA: 7831551
Partition entries starting LBA: 2
Allocated partition entries: 128
Partition entries ending LBA: 33
Device Start End Sectors Type-UUID UUID Name Attrs
/dev/sda1 2048 7831518 7829471 EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 88E1E943-9FFF-47F8-BC0A-394C3177C87E Main Data Partition
Disk /dev/sdb: 239.02 GiB, 256641603584 bytes, 501253132 sectors
Disk model: Flash Drive
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 5092036A-B328-4011-9876-90A370CC9A68
First usable LBA: 34
Last usable LBA: 501253098
Alternative LBA: 501253131
Partition entries starting LBA: 2
Allocated partition entries: 128
Partition entries ending LBA: 33
Device Start End Sectors Type-UUID UUID Name Attrs
/dev/sdb1 2048 22527 20480 21686148-6449-6E6F-744E-656564454649 EFD49B1A-E97C-499F-BCA1-78AFDAE5A9CC
/dev/sdb2 22528 1046527 1024000 C12A7328-F81F-11D2-BA4B-00A0C93EC93B DA49FCF5-DC5D-42E9-8856-E57A0360880E
/dev/sdb3 1046528 501253098 500206571 0FC63DAF-8483-4772-8E79-3D69D8477DE4 6A1AB02B-E782-4DD7-A4DB-E64210BFC8C3
Disk /dev/loop0: 669.16 MiB, 701665280 bytes, 1370440 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/root: 238.51 GiB, 256097375744 bytes, 500190187 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytesThanks for the input, I will remove the second root definition and reinstall grub.
Offline
im really struggling to find your problem, everything looks fine to me, one thing i did notice is:
GRUB_ENABLE_CRYPTODISK=ywhich you dont need, as mentioned before your boot partition isnt encrypted so comment that line out of your "/etc/default/grub"
EDIT: and obviously regenerate your grub config after making changes
Last edited by jonno2002 (2022-06-11 03:51:58)
Offline
EDIT2: sorry you will need to re-install grub as well after making that change according to the wiki:
This option is used by grub-install to generate the grub core.img, so make sure to install grub after modifying this option.
Offline
Yep, already tried that. Just gave it another shot, even on a different laptop, but still getting the same error.
Offline
ok one more try, change this line in "/etc/default/grub":
GRUB_PRELOAD_MODULES="part_gpt part_msdos usb usb_keyboard ohci uhci ehci"to
GRUB_PRELOAD_MODULES="part_gpt part_msdos"and regen grub and see if that works.
Offline
That... worked! I was about to do a clean install on a spare flash drive to try and figure this out. Thank you!
I guess after following the guide on how to encrypt an existing unencrypted file system, it linked me to a few pages on how to configure it if it is a root partition, including this one. Might be wise to remove it so others aren't mislead.
Offline
would be interesting to know why those modules cause that problem
Offline