You are not logged in.

#1 2021-06-24 13:22:16

Dun
Member
Registered: 2014-12-28
Posts: 98

Reinstall GRUB for LVM on LUKS

Recently my workstation died and I wanted to use the system on another PC. But I was unable to boot from the SSD on 2 different PCs. They didn't detect anything bootable on the SSD, even GRUB's minimal bash didn't show up.

I have the following partition-scheme:

sda
├─sda1 (FAT32, EFI partition)
├─sda2 (ext4, boot partition)
└─sda3 (LUKS partition)

Then I did the following in an attempt to reinstall GRUB.

$ cryptsetup luksOpen /dev/sda3 dec
$ mount /dev/volgroup0/lv_root /mnt
$ mount /dev/sda2 /mnt/boot
$ arch-chroot /mnt
$ mount /dev/sda1 /boot/EFI
$ grub-install --target=x86_64-efi --bootloader-id=grub --recheck
$ grub-mkconfig -o /boot/grub/grub.cfg

But now it boots only into GRUB's minimal bash.

/etc/default/grub hasn't changed, it still contains:

...
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 cryptdevice=/dev/sda3:volgroup0:allow-discards quiet"
...
GRUB_ENABLE_CRYPTODISK=y
...

How could I reinstall GRUB properly?

Offline

#2 2021-06-24 13:46:13

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,296

Re: Reinstall GRUB for LVM on LUKS

Post the /boot/grub/grub.cfg

Offline

#3 2021-06-24 13:57:56

Dun
Member
Registered: 2014-12-28
Posts: 98

Re: Reinstall GRUB for LVM on LUKS

V1del wrote:

Post the /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
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="${saved_entry}"
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 lvm
insmod ext2
set root='lvmid/6bbVH9-uI4y-DaLs-WSBw-5VX2-zUvK-KuTdGw/fBEiq6-G2ds-8dfP-eIYD-v35l-9fEU-Tc6snd'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint='lvmid/6bbVH9-uI4y-DaLs-WSBw-5VX2-zUvK-KuTdGw/fBEiq6-G2ds-8dfP-eIYD-v35l-9fEU-Tc6snd'  65131c78-7f6f-40b0-990a-7b949c2ad7a4
else
  search --no-floppy --fs-uuid --set=root 65131c78-7f6f-40b0-990a-7b949c2ad7a4
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 console
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/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

#4 2021-06-25 14:59:14

Dun
Member
Registered: 2014-12-28
Posts: 98

Re: Reinstall GRUB for LVM on LUKS

I tried using cryptomount in GRUB's bash but it doesn't prompt for the password.

$ ls 
(proc) (hd0) (hd0,gpt3) (hd0,gpt2) (hd0,gpt1)
$ insmod luks
$ cryptomount hd0,gpt3
$ cryptomount hd0,3

I also noticed the EFI partition containing another folder called EFI which I found a little bit weird. Is that normal? /boot/EFI/EFI/grub/

Offline

#5 2023-01-02 08:52:16

gitaarik
Member
Registered: 2022-12-16
Posts: 2

Re: Reinstall GRUB for LVM on LUKS

I'm facing the exact same issue at the moment. Also tried reinstalling grub on a LVM/LUKS setup. And the new grub also only gives me the option to boot into the UEFI settings screen. I also have the curious folder structure on the EFI partition: /boot/EFI/EFI/grub. Did you find a solution? Or anyone has any other suggestions?

Offline

#6 2023-01-02 14:46:41

gitaarik
Member
Registered: 2022-12-16
Posts: 2

Re: Reinstall GRUB for LVM on LUKS

I figured out my problem. I had re-formatted the /boot partition, and I had to re-install the linux kernel so it would have a kernel to boot... So a simple `pacman -S linux linux-headers` before `grub-install` and `grub-mkconfig` fixed the issue for me.

Offline

Board footer

Powered by FluxBB