Skip to main content
Topic: grub crashes to bios [SOLVED] (Read 1534 times) previous topic - next topic
0 Members and 6 Guests are viewing this topic.

grub crashes to bios [SOLVED]

I followed (my own..) hibernation guide on another laptop today. Up to now it succesfully ran artix runit x64 with plasma. Today I just did 2 things mentioned in the guide:
  • Added a resume runtime hook to the /etc/mkinitcpio.conf, and regenerated manually  the initramfs
    Code: [Select]
    # mkinitcpio -P
    so as /etc/mkinitcpio.conf looks now:
    Code: [Select]
    # vim:set ft=sh
    # MODULES
    # The following modules are loaded before any boot hooks are
    # run.  Advanced users may wish to specify all system modules
    # in this array.  For instance:
    #     MODULES=(piix ide_disk reiserfs)
    MODULES=""

    # BINARIES
    # This setting includes any additional binaries a given user may
    # wish into the CPIO image.  This is run last, so it may be used to
    # override the actual binaries included by a given hook
    # BINARIES are dependency parsed, so you may safely ignore libraries
    BINARIES=()

    # FILES
    # This setting is similar to BINARIES above, however, files are added
    # as-is and are not parsed in any way.  This is useful for config files.
    FILES=""

    # HOOKS
    # This is the most important setting in this file.  The HOOKS control the
    # modules and scripts added to the image, and what happens at boot time.
    # Order is important, and it is recommended that you do not change the
    # order in which HOOKS are added.  Run 'mkinitcpio -H <hook name>' for
    # help on a given hook.
    # 'base' is _required_ unless you know precisely what you are doing.
    # 'udev' is _required_ in order to automatically load modules
    # 'filesystems' is _required_ unless you specify your fs modules in MODULES
    # Examples:
    ##   This setup specifies all modules in the MODULES setting above.
    ##   No raid, lvm2, or encrypted root is needed.
    #    HOOKS=(base)
    #
    ##   This setup will autodetect all modules for your system and should
    ##   work as a sane default
    #    HOOKS=(base udev autodetect block filesystems)
    #
    ##   This setup will generate a 'full' image which supports most systems.
    ##   No autodetection is done.
    #    HOOKS=(base udev block filesystems)
    #
    ##   This setup assembles a pata mdadm array with an encrypted root FS.
    ##   Note: See 'mkinitcpio -H mdadm' for more information on raid devices.
    #    HOOKS=(base udev block mdadm encrypt filesystems)
    #
    ##   This setup loads an lvm2 volume group on a usb device.
    #    HOOKS=(base udev block lvm2 filesystems)
    #
    ##   NOTE: If you have /usr on a separate partition, you MUST include the
    #    usr, fsck and shutdown hooks.
    HOOKS="base udev autodetect modconf block keyboard keymap consolefont filesystems resume fsck"

    # COMPRESSION
    # Use this to compress the initramfs image. By default, zstd compression
    # is used. Use 'cat' to create an uncompressed image.
    #COMPRESSION="zstd"
    #COMPRESSION="gzip"
    #COMPRESSION="bzip2"
    #COMPRESSION="lzma"
    #COMPRESSION="xz"
    #COMPRESSION="lzop"
    #COMPRESSION="lz4"

    # COMPRESSION_OPTIONS
    # Additional options for the compressor
    #COMPRESSION_OPTIONS=()
  • Added a resume  kernel parameter (additional arguments to the Linux image) to the etc/default/grub and regenerated
    /boot/grub/grub.cfg with
    Code: [Select]
    # grub-mkconfig -o /boot/grub/grub.cfg

However must have missed something important as now the laptop after swithing on  just displays: Welcome to Grub and enters
BIOS/UEFI settings screen.


I booted the laptop from a life usb, the disk seems fine, devices UUID numbers look correct:
Code: [Select]
$ lsblk --fs
NAME       FSTYPE FSVER LABEL        UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
loop0      squash 4.0                                                           0   100% /run/artix/sfs/livefs
loop1      squash 4.0                                                           0   100% /run/artix/sfs/rootfs
sda                                                                                     
├─sda1     vfat   FAT32 EFI          5C20-07FB                                          
└─sda2     ext4   1.0   ROOT         93c9313e-59dc-45bf-bd07-593e8d21fcd9   70.9G    22% /run/media/artix/ROOT
sdb                                                                                     
├─sdb1     exfat  1.0   Ventoy       4E21-0000                                          
│ └─ventoy iso966       ARTIX_202201 2022-01-23-21-00-35-00                     0   100% /run/artix/bootmnt
└─sdb2     vfat   FAT16 VTOYEFI      7502-2467                                          
sdc                                                                                     
└─sdc1     exfat  1.0   NOWY         B02D-D213                               2.5G    67% /run/media/artix/NOWY
So it looks like I have damaged something within Grub.  /boot/grub/grub.cfg currently:
Code: [Select]
#
# 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="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
}

set menu_color_normal=light-blue/black
set menu_color_highlight=light-cyan/blue

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  93c9313e-59dc-45bf-bd07-593e8d21fcd9
else
  search --no-floppy --fs-uuid --set=root 93c9313e-59dc-45bf-bd07-593e8d21fcd9
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=1024x768,800x600
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=pl_PL
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  93c9313e-59dc-45bf-bd07-593e8d21fcd9
else
  search --no-floppy --fs-uuid --set=root 93c9313e-59dc-45bf-bd07-593e8d21fcd9
fi
insmod gfxmenu
loadfont ($root)/usr/share/grub/themes/artix/u_vga16_16.pf2
insmod png
set theme=($root)/usr/share/grub/themes/artix/theme.txt
export theme
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=1
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=1
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Artix Linux' --class artix --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-93c9313e-59dc-45bf-bd07-593e8d21fcd9' {
savedefault
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  93c9313e-59dc-45bf-bd07-593e8d21fcd9
else
  search --no-floppy --fs-uuid --set=root 93c9313e-59dc-45bf-bd07-593e8d21fcd9
fi
echo 'Ładowanie systemu Linux linux...'
linux /boot/vmlinuz-linux root=UUID=93c9313e-59dc-45bf-bd07-593e8d21fcd9 rw net.ifnames=0 resume=UUID=93c9313e-59dc-45bf-bd07-593e8d21fcd9 resume_offset=3739648 quiet
echo 'Ładowanie początkowego ramdysku...'
initrd /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs-linux.img
}
submenu 'Opcje zaawansowane dla systemu Artix Linux' $menuentry_id_option 'gnulinux-advanced-93c9313e-59dc-45bf-bd07-593e8d21fcd9' {
menuentry 'Artix Linux, z systemem Linux linux' --class artix --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-93c9313e-59dc-45bf-bd07-593e8d21fcd9' {
savedefault
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  93c9313e-59dc-45bf-bd07-593e8d21fcd9
else
  search --no-floppy --fs-uuid --set=root 93c9313e-59dc-45bf-bd07-593e8d21fcd9
fi
echo 'Ładowanie systemu Linux linux...'
linux /boot/vmlinuz-linux root=UUID=93c9313e-59dc-45bf-bd07-593e8d21fcd9 rw net.ifnames=0 resume=UUID=93c9313e-59dc-45bf-bd07-593e8d21fcd9 resume_offset=3739648 quiet
echo 'Ładowanie początkowego ramdysku...'
initrd /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs-linux.img
}
menuentry 'Artix Linux, with Linux linux (fallback initramfs)' --class artix --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-93c9313e-59dc-45bf-bd07-593e8d21fcd9' {
savedefault
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  93c9313e-59dc-45bf-bd07-593e8d21fcd9
else
  search --no-floppy --fs-uuid --set=root 93c9313e-59dc-45bf-bd07-593e8d21fcd9
fi
echo 'Ładowanie systemu Linux linux...'
linux /boot/vmlinuz-linux root=UUID=93c9313e-59dc-45bf-bd07-593e8d21fcd9 rw net.ifnames=0 resume=UUID=93c9313e-59dc-45bf-bd07-593e8d21fcd9 resume_offset=3739648 quiet
echo 'Ładowanie początkowego ramdysku...'
initrd /boot/intel-ucode.img /boot/amd-ucode.img /boot/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 ###
if [ "$grub_platform" = "efi" ]; then
fwsetup --is-supported
if [ "$?" = 0 ]; then
menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
fwsetup
}
fi
fi
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/35_fwupd ###
### END /etc/grub.d/35_fwupd ###

### 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 ###

### BEGIN /etc/grub.d/60_memtest86+ ###
if [ "${grub_platform}" == "pc" ]; then
    menuentry "Memory Tester (memtest86+)" --class memtest86 --class gnu --class tool {
        search --fs-uuid --no-floppy --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  93c9313e-59dc-45bf-bd07-593e8d21fcd9
        linux16 /boot/memtest86+/memtest.bin
    }
fi
### END /etc/grub.d/60_memtest86+ ###

I failed trying to attach to the post etc/default/grub so pasting it:
Code: [Select]
GRUB_DEFAULT="0"
GRUB_TIMEOUT="1"
GRUB_DISTRIBUTOR="Artix"
GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=93c9313e-59dc-45bf-bd07-593e8d21fcd9 resume_offset=3739648 quiet"
GRUB_CMDLINE_LINUX="net.ifnames=0"

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable Hidden Menu, and optionally hide the timeout count
#GRUB_HIDDEN_TIMEOUT="5"
#GRUB_HIDDEN_TIMEOUT_QUIET="true"

# Uncomment to use basic console
GRUB_TERMINAL_INPUT="console"

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT="console"

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE="1680x1050x8"
GRUB_GFXMODE="1024x768,800x600"

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX="keep"

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID="true"

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY="true"

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper
# modes only.  Entries specified as foreground/background.
export GRUB_COLOR_NORMAL="light-blue/black"
export GRUB_COLOR_HIGHLIGHT="light-cyan/blue"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/path/to/wallpaper"
GRUB_THEME="/usr/share/grub/themes/artix/theme.txt"

# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"

GRUB_SAVEDEFAULT="true"

GRUB_DISABLE_LINUX_RECOVERY="true"

# Probe for other installed operating systems
GRUB_DISABLE_OS_PROBER="false"
There is also grub.pacnew file in /etc/default/, but I am not sure if it matters.
Have I missed runnng update-grub, as mentioned in the post linked above? Is it possible to repair Grub configuration? Is there any copy of proper Grub configuration anywhere on the disk?
Thanks for any help in advance.
Operating System: Artix Linux x86_64

Re: grub crashes to bios

Reply #1
Is it possible to repair Grub configuration? Is there any copy of proper Grub configuration anywhere on the disk?
Word to the wise: Always backup config files before you do such changes.

Regardless you can choot in, revert your changes to etc/default/grub and regenerate grub.cfg.
Or just mount the partition and edit  /boot/grub/grub.cfg directly, removing
Quote
resume=UUID=93c9313e-59dc-45bf-bd07-593e8d21fcd9 resume_offset=3739648
from the line
Code: [Select]
linux	/boot/vmlinuz-linux root=UUID=93c9313e-59dc-45bf-bd07-593e8d21fcd9 rw net.ifnames=0 resume=UUID=93c9313e-59dc-45bf-bd07-593e8d21fcd9 resume_offset=3739648 quiet
First occurrence should be fine so long as you pick that one in grub but doing them all is an option.

My guess is the offset is wrong. Purely a guess.

If you get back in and want to try again you I would suggest that once you generate the new grub.cfg you edit it and remove the resume bits from the 'failsafe' entry. Then if the top entry with resume fails you should have a simpler way to get back in.

Re: grub crashes to bios

Reply #2
Thanks for the insight. I appreciate. Removing resume=UUID and offset changed nothing. I suppose if only UUIDs or any other params were wrong, GRUB would display properly, and only after progressing to boot any of its menu options it would fail. Therefore I suppose something more fundamental must have gone wrong - may be encoding of config file, may be endofline, may be permissions? Or anything else apart from the grub.cfg?

I compared contents of grub.cfg to another one grub.cfg on the older system and the only difference is in the ### BEGIN /etc/grub.d/30_uefi-firmware ### section. So as not to make whole diff here I just say it has no if lines, but begins in this section already with menuentry and params in curly brackets.

I'll check if I am able to chroot as you advise and stated here, or will be faster to reinstall from scratch.
Operating System: Artix Linux x86_64

Re: grub crashes to bios

Reply #3
I'll check if I am able to chroot as you advise and stated here, or will be faster to reinstall from scratch.
Another option (If you struggle with chrooting):
Go here https://www.rodsbooks.com/refind/getting.html

Download the USB flash drive image file.
Flash to a USB drive with dd
In the UEFI/BIOS chose to boot from the USB drive.
Hopefully you should be able to boot into your system from the rEFInd menu.

Once in, reinstall Grub, or get rid of it and install rEFInd.

Re: grub crashes to bios

Reply #4
https://archlinux.org/news/grub-bootloader-upgrade-and-configuration-incompatibilities/

If you hadn't run grub mkconfig / update-grub since updating to the newer grub it will fail the first time you do so, you need to do grub-install so both parts are a compatible version as there was a breaking change on the version upgrade. This does not apply to BIOS boot setups, only EFI / UEFI.

grub install:
https://wiki.archlinux.org/title/GRUB

Re: grub crashes to bios

Reply #5
  • The described above mkconfig was the only one run of it
  • you mean grub got updated during one of a few runs of pacman -Syu?
  • UEFI is my case
What approach you advise for grub-install in the current conditions when grub is down?
Operating System: Artix Linux x86_64

Re: grub crashes to bios

Reply #6
I compared contents of grub.cfg to another one grub.cfg on the older system and the only difference is in the ### BEGIN /etc/grub.d/30_uefi-firmware ### section. So as not to make whole diff here I just say it has no if lines, but begins in this section already with menuentry and params in curly brackets.
Therefore before taking into consideration all the above solutions, I edited /boot/grub/grub.cfg again and the mentioned section now reads (compare to the previously pasted):
Code: [Select]
### BEGIN /etc/grub.d/30_uefi-firmware ###
###if [ "$grub_platform" = "efi" ]; then
### fwsetup --is-supported
### if [ "$?" = 0 ]; then
menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
fwsetup
}
### fi
###fi
### END /etc/grub.d/30_uefi-firmware ###
Now the system boots correctly as previously.
So my contention is that in my case the "newly-updated" grub-mkconfig introduced to /boot/grub/grub.cfg the hashed-out now lines that the "not-updated" GRUB (grubx64.efi ?) could not recognize. And crashed. I wonder if resume_offset mattered or not...

If anyone reads it, please remember that in your case my solution may not work.
Operating System: Artix Linux x86_64

Re: grub crashes to bios [SOLVED]

Reply #7
Well done, glad you got back into your system, sorry I missed your last question. You could also have chrooted in, this is simpler than it sounds: Plug in a usb with an Artix iso, pretty much any recent-ish one will do, open a terminal, find your relevant partitions, mount those required and chroot, something like:
Code: [Select]
$ lsblk
$ fdisk -l
# blkid

$ mkdir -p mntpoint/boot/efi
# mount /dev/sda? mntpoint
# mount /dev/sda?? mntpoint/boot/efi
# artix-chroot mntpoint
chroot means simply "change root (dir)" so what happens is your current session continues using the kernel you are running in the ISO but all the commands you issue are using the files on the system you have chrooted into, so when you issue any command like grub-install it's the grub in mntpoint/usr/bin that runs, and if you do "ls /" you will be shown the contents of mntpoint/ not the real / root dir outside the chroot.

There is more extensive guidance here, although mixed in with other information too:
https://wiki.artixlinux.org/Main/Installation

I think your solution is a pretty neat alternative though, if it worked then it's OK! You should probably still install the newer grub and run update-grub now you are back in to avoid getting caught out again sometime.

Re: grub crashes to bios [SOLVED]

Reply #8
install the newer grub and run update-grub now you are back in to avoid getting caught out again sometime.
I fully agree. Is it enough and in correct order:
  • Code: [Select]
    # update-grub
    if not dead, then
  • Code: [Select]
    # grub-mkconfig -o /boot/grub/grub.cfg
  • reboot?
Operating System: Artix Linux x86_64

Re: grub crashes to bios [SOLVED]

Reply #9
install the newer grub and run update-grub now you are back in to avoid getting caught out again sometime.
I fully agree. Is it enough and in correct order:
  • Code: [Select]
    # update-grub
    if not dead, then
  • Code: [Select]
    # grub-mkconfig -o /boot/grub/grub.cfg
  • reboot?

 ::)
Code: [Select]
cat /usr/bin/update-grub
"Wer alles kann, macht nichts richtig"

Artix USE="runit openrc slim openbox lxde gtk2 qt4 qt5 qt6 conky
-gtk3 -gtk4 -adwaita{cursors,themes,icons} -gnome3 -kde -plasma -wayland "

Re: grub crashes to bios [SOLVED]

Reply #10
Well....
Code: [Select]
$ cat /usr/bin/update-grub
#! /bin/sh

grub-mkconfig -o /boot/grub/grub.cfg
Am I right that there is not much added value in update-grub? Do I need to reinstall it to make GRUB observe the instructions I  commented out in /boot/grub/grub.cfg?
Operating System: Artix Linux x86_64