Borked Grub2 on trying to update to f32

Output from commands

[root@localhost-live /]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=“$(sed ‘s, release .*$,g’ /etc/system-release)”
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT=“console”
GRUB_CMDLINE_LINUX=“rd.md.uuid=843fde6d:3d925ba8:dbd242a0:2bffda48 vconsole.font=latarcyrheb-sun16 rd.md.uuid=24e64025:1fd5cd15:c8e8de80:cdaae23e $([ -x /usr/sbin/rhcrashkernel-param ] && /usr/sbin/rhcrashkernel-param || :slight_smile: rhgb quiet”
GRUB_DISABLE_RECOVERY=“true”
GRUB_ENABLE_BLSCFG=true
[root@localhost-live /]# grep -v -e ^# -e ^$ /etc/fstab
UUID=4d881bbb-2df6-465f-9fea-cfc9ddfc6679 / ext4 defaults 1 1
UUID=9ba49569-5460-491d-80e1-c634583fcf56 /boot ext4 defaults 1 2
UUID=0e3e7d1e-25fc-4241-84e5-3e01830302ef /home ext4 defaults 1 2
/dev/mapper/fedora-misc1 /misc1 ext4 defaults 1 2
/dev/mapper/fedora-misc2 /misc2 ext4 defaults 1 2
UUID=86ccd925-73cd-457f-843b-ae1ce60a5961 swap swap defaults 0 0
[root@localhost-live /]# grub2-editenv list
boot_success=0

Fix the UUID for sda1 in /etc/fstab and update the GRUB config:

sudo sed -i -r -e "s|^(UUID=)(\S*)(\s/boot\s.*)$|\1$(lsblk -n -o UUID /dev/sda1)\3|" /etc/fstab
sudo grub2-editenv create
sudo grub2-mkconfig -o /etc/grub2$(test -d /sys/firmware/efi && echo -efi).cfg
sudo dracut -f --regenerate-all

On the following command I get the following

[root@localhost-live /]# grub2-mkconfig -o /etc/grub2$(test -d /sys/firmware/efi && echo -efi).cfg
Generating grub configuration file …
device-mapper: reload ioctl on osprober-linux-sdd1 failed: Device or resource busy
Command failed.
device-mapper: reload ioctl on osprober-linux-md125 failed: Device or resource busy
Command failed.
device-mapper: remove ioctl on osprober-linux-fedora-misc2 failed: Device or resource busy
Command failed.
done

These messages may be not critical, the important part is:

Continue with the following command and check if it works or not.

No warning at the end of the last command. On reboot all I get is the GRUB> command line.

what should I run next.

Thanks

I think you need to manually check the config:

sudo readlink -f /etc/grub2$(test -d /sys/firmware/efi && echo -efi).cfg
sudo cat /etc/grub2$(test -d /sys/firmware/efi && echo -efi).cfg

Output of the above commands
[root@localhost-live /]# readlink -f /etc/grub2$(test -d /sys/firmware/efi && echo -efi).cfg
/boot/grub2/grub.cfg
[root@localhost-live /]# cat /etc/grub2$(test -d /sys/firmware/efi && echo -efi).cfg

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

### BEGIN /etc/grub.d/00_header ###
set pager=1

if [ -f ${config_directory}/grubenv ]; then
  load_env -f ${config_directory}/grubenv
elif [ -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
}

terminal_output console
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/01_users ###
if [ -f ${prefix}/user.cfg ]; then
  source ${prefix}/user.cfg
  if [ -n "${GRUB2_PASSWORD}" ]; then
    set superusers="root"
    export superusers
    password_pbkdf2 root ${GRUB2_PASSWORD}
  fi
fi
### END /etc/grub.d/01_users ###

### BEGIN /etc/grub.d/08_fallback_counting ###
insmod increment
# Check if boot_counter exists and boot_success=0 to activate this behaviour.
if [ -n "${boot_counter}" -a "${boot_success}" = "0" ]; then
  # if countdown has ended, choose to boot rollback deployment,
  # i.e. default=1 on OSTree-based systems.
  if  [ "${boot_counter}" = "0" -o "${boot_counter}" = "-1" ]; then
    set default=1
    set boot_counter=-1
  # otherwise decrement boot_counter
  else
    decrement boot_counter
  fi
  save_env boot_counter
fi
### END /etc/grub.d/08_fallback_counting ###

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

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

### BEGIN /etc/grub.d/10_reset_boot_success ###
# Hiding the menu is ok if last boot was ok or if this is a first boot attempt to boot the entry
if [ "${boot_success}" = "1" -o "${boot_indeterminate}" = "1" ]; then
  set menu_hide_ok=1
else
  set menu_hide_ok=0 
fi
# Reset boot_indeterminate after a successful boot
if [ "${boot_success}" = "1" ] ; then
  set boot_indeterminate=0
# Avoid boot_indeterminate causing the menu to be hidden more then once
elif [ "${boot_indeterminate}" = "1" ]; then
  set boot_indeterminate=2
fi
# Reset boot_success for current boot 
set boot_success=0
save_env boot_success boot_indeterminate
### END /etc/grub.d/10_reset_boot_success ###

### BEGIN /etc/grub.d/12_menu_auto_hide ###
if [ x$feature_timeout_style = xy ] ; then
  if [ "${menu_show_once}" ]; then
    unset menu_show_once
    save_env menu_show_once
    set timeout_style=menu
    set timeout=60
  elif [ "${menu_auto_hide}" -a "${menu_hide_ok}" = "1" ]; then
    set orig_timeout_style=${timeout_style}
    set orig_timeout=${timeout}
    if [ "${fastboot}" = "1" ]; then
      # timeout_style=menu + timeout=0 avoids the countdown code keypress check
      set timeout_style=menu
      set timeout=0
    else
      set timeout_style=hidden
      set timeout=1
    fi
  fi
fi
### END /etc/grub.d/12_menu_auto_hide ###

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

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

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

### BEGIN /etc/grub.d/30_uefi-firmware ###
### 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 ###

It seems you need to fix this first and then reconfigure GRUB:

sudo sed -i -e "1i GRUB_DISABLE_OS_PROBER=true" /etc/default/grub
sudo grub2-mkconfig -o /etc/grub2$(test -d /sys/firmware/efi && echo -efi).cfg
sudo dracut -f --regenerate-all

I’m reading through this thread to see if I can help, but wanted to point out it’s a little hard to read the terminal output in regular font. You should wrap terminal output as a code block by putting three grave accents on a line before and after your terminal output so the #'s don’t get interpreted as Markdown headers and the text is monospaced.

E.g. inputting

```
# A comment, not a header
Another line of text, same length as the line below.|
This line should be the same length as the one above|
```

Gives

# A comment, not a header
Another line of text, same length as the line below.|
This line should be the same length as the one above|

But without grave accents,

A comment, not a header

Another line of text, same length as the one below.|
This line should be the same length as the one above|

1 Like

Ran the following commands

sed -i -e "1i GRUB_DISABLE_OS_PROBER=true" /etc/default/grub
grub2-mkconfig -o /etc/grub2$(test -d /sys/firmware/efi && echo -efi).cfg
dracut -f --regenerate-all

Results on rebooting is I’m still on the “Grub>” prompt.

Vgaetera that for all the help.

Bob thank you for comment on the dots in the response. I was wondering how this was done.

2 Likes

Make sure to run all those commands in the live chroot after you mounted the boot and root volumes.

What is the result of the second command?
Also, check if there are any changes in the GRUB config, i.e. /boot/grub2/grub.cfg.

All the changes to the config have been done under chroot. (commands below)

[liveuser@localhost-live ~]$ su
[root@localhost-live liveuser]# mkdir -p /mnt/root
[root@localhost-live liveuser]# mount /dev/md126 /mnt/root
mount: /mnt/root: unknown filesystem type ‘swap’.
[root@localhost-live liveuser]# mount /dev/md12 /mnt/root
mount: /mnt/root: special device /dev/md12 does not exist.
[root@localhost-live liveuser]# mount /dev/md125 /mnt/root
[root@localhost-live liveuser]# ls /mnt/root/
bin etc lib64 misc1 null root srv system-update var
boot home lost+found misc2 opt run sys tmp
dev lib media mnt proc sbin sysroot usr
[root@localhost-live liveuser]# mount /dev/sda1 /mnt/root/boot
[root@localhost-live liveuser]# mount -o bind /dev /mnt/root/dev
[root@localhost-live liveuser]# mount -o bind /proc /mnt/root/proc
[root@localhost-live liveuser]# mount -o bind /sys /mnt/root/sys
[root@localhost-live liveuser]# mount -o bind /run /mnt/root/run
[root@localhost-live liveuser]# chroot /mnt/root

Took a look at the grub.cfg and I found no differences between before and now. See below.

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

### BEGIN /etc/grub.d/00_header ###
set pager=1

if [ -f ${config_directory}/grubenv ]; then
  load_env -f ${config_directory}/grubenv
elif [ -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
}

terminal_output console
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/01_users ###
if [ -f ${prefix}/user.cfg ]; then
  source ${prefix}/user.cfg
  if [ -n "${GRUB2_PASSWORD}" ]; then
    set superusers="root"
    export superusers
    password_pbkdf2 root ${GRUB2_PASSWORD}
  fi
fi
### END /etc/grub.d/01_users ###

### BEGIN /etc/grub.d/08_fallback_counting ###
insmod increment
# Check if boot_counter exists and boot_success=0 to activate this behaviour.
if [ -n "${boot_counter}" -a "${boot_success}" = "0" ]; then
  # if countdown has ended, choose to boot rollback deployment,
  # i.e. default=1 on OSTree-based systems.
  if  [ "${boot_counter}" = "0" -o "${boot_counter}" = "-1" ]; then
    set default=1
    set boot_counter=-1
  # otherwise decrement boot_counter
  else
    decrement boot_counter
  fi
  save_env boot_counter
fi
### END /etc/grub.d/08_fallback_counting ###

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

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

### BEGIN /etc/grub.d/10_reset_boot_success ###
# Hiding the menu is ok if last boot was ok or if this is a first boot attempt to boot the entry
if [ "${boot_success}" = "1" -o "${boot_indeterminate}" = "1" ]; then
  set menu_hide_ok=1
else
  set menu_hide_ok=0 
fi
# Reset boot_indeterminate after a successful boot
if [ "${boot_success}" = "1" ] ; then
  set boot_indeterminate=0
# Avoid boot_indeterminate causing the menu to be hidden more then once
elif [ "${boot_indeterminate}" = "1" ]; then
  set boot_indeterminate=2
fi
# Reset boot_success for current boot 
set boot_success=0
save_env boot_success boot_indeterminate
### END /etc/grub.d/10_reset_boot_success ###

### BEGIN /etc/grub.d/12_menu_auto_hide ###
if [ x$feature_timeout_style = xy ] ; then
  if [ "${menu_show_once}" ]; then
    unset menu_show_once
    save_env menu_show_once
    set timeout_style=menu
    set timeout=60
  elif [ "${menu_auto_hide}" -a "${menu_hide_ok}" = "1" ]; then
    set orig_timeout_style=${timeout_style}
    set orig_timeout=${timeout}
    if [ "${fastboot}" = "1" ]; then
      # timeout_style=menu + timeout=0 avoids the countdown code keypress check
      set timeout_style=menu
      set timeout=0
    else
      set timeout_style=hidden
      set timeout=1
    fi
  fi
fi
### END /etc/grub.d/12_menu_auto_hide ###

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

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

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

### BEGIN /etc/grub.d/30_uefi-firmware ###
### 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 ###

When you paste large text files like grub.cfg, please mark the text after pasting it and format it as “Preformatted text” using the </>symbol from the editor’s toolbar above. See:

a60c6b6bf7a424f4b6d88b41e51b7917f38413e2.png

I made the change on your post to show how nice a pasted config file can look like (if formatted correctly).

1 Like

Or put triple grave accents/backticks (```) before and after. I think that’s what @plarsonpoweree intended to do, but they typed triple dots by mistake (…).

1 Like

Would the following cause issues. The last time I setup to go into chroot the md125 had the linux, md126 had swap and md127 had home. This morning I ran the commands to get to this step and md125 is linux, md126 is home and md127 is swap.

This is making me beleve that all three are not fixed names. Is this a problem and what are the workarounds?

Icts thanks for the tip on the backticks.

1 Like

Yes, it can lead to mistakes.

If you want to achieve a guaranteed and reproducible result, you need to rely on UUIDs.

sudo mount -U file_system_uuid /path/to/mount

the UUID come form the 32 digits under “cat /etc/default/grub” example UUID=9ba49569-5460-491d-80e1-c634583fcf56 /boot ext4 defaults 1 2

If so I will try the procedure from the start using this.

1 Like