Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

mdadm grub rescue mode after updates

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
jringoot
Posts: 17
Joined: 2017-05-29 12:24
Has thanked: 1 time

mdadm grub rescue mode after updates

#1 Post by jringoot »

Hello,

I manage a machine with software raid and it seems that everytime that grub has an update from apt, It gets in "grub_rescue" mode after reboot.

This happened twice, once last year and once this month. This could be an older update, since it is used for long calculations: weeks before results.


I follow then somewhat this guide to help me out (It is nicely done)
https://wiki.debian.org/GrubEFIReinstall


I boot with livecd ubuntu LTS 20.04 LTS

apt install mdadm

assemble the raid
mdadm --assemble --scan

mount the original / to /mnt
mount /dev/md/0 /mnt

mount all necessary directories for grub-install
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done

chroot to the mnt
chroot /mnt

update and install grub in both devices
update-grub
grub-install /dev/nvme0n1
grub-install /dev/nvme1n1

And then the machine boots correctly again.

This looks like a bug for grub... or may it be a configuration problem?

Thanks,

Joost

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: mdadm grub rescue mode after updates

#2 Post by p.H »

It is not a bug, it is a configuration mistake caused by a clueless sysadmin.

You are following https://wiki.debian.org/GrubEFIReinstall aimed at UEFI systems but

Code: Select all

grub-install /dev/nvme0n1
grub-install /dev/nvme1n1
suggests that the system actually boots in BIOS/legacy mode.
Also, since Debian 10, by default the grub rescue prompt can only happen with BIOS/legacy boot.

After an update of grub-pc, the GRUB bootloader is reinstalled in the locations specified in the package configuration, which can be shown by

Code: Select all

debconf-show grub-pc | grep install_devices
and modified with

Code: Select all

dpkg-reconfigure grub-pc
If only one drive is defined, then the boot loader will be updated only on that drive, leaving the old boot loader in the other drive. If the machine boots with that drive, the old boot loader may mismatch with the new contents of /boot/grub, leading to the grub rescue prompt.

User avatar
Bloom
df -h | grep > 90TiB
df -h | grep > 90TiB
Posts: 504
Joined: 2017-11-11 12:23
Been thanked: 26 times

Re: mdadm grub rescue mode after updates

#3 Post by Bloom »

On several of my systems, there is only one drive: an SSD. Nevertheless, each Grub upgrade asks whether it should be installed on /dev/sda or /dev/sda1, even though /dev/sda has always been used before. Why can't it remember which drive was chosen before and use that automatically?

Post Reply