383.5 – Bootloader Boot Camp

0:32 Linux Innards
56:54 Check This Out
1:01:28 Announcements

In our Innards section we discuss tips and tricks around GRUB, as well as a couple alternatives.

Twitter. Discord. Telegram. Matrix. Reddit. Youtube.

Linux Innards

GRUB bootloader, troubleshooting, tips & tricks, alternatives

Lines in the standard configuration file for Grub:

  • GRUB_TIMEOUT=5
    • the length of time in seconds that you will see the bootloader menu
  • GRUB_DISTRIBUTOR=“$(sed ‘s, release .*$,,g’ /etc/system-release)”
    • extracts the release information from the /etc/system-release file and makes names in the grub menu
  • GRUB_DEFAULT=saved
    • can be used to set the default kernel that is booted, usually the most recent kernel but you can change it to a later number instead of 0 and that will be the default one to get loaded.  If a new kernel is installed then your list is iterated
  • GRUB_SAVEDEFAULT=
    • not normally used, but if set to true, then every time you select a different kernel at boot then that will be the new default instead of just a one time load
  • GRUB_DISABLE_SUBMENU=true
    • Submenus are used to pick things like a testing kernel or a safe mode kernel.  Setting to false gets rid of this
  • GRUB_TERMINAL_OUTPUT=”console”
    • can be used to redirect output to another terminal.  I have never used this
  • GRUB_CMDLINE_LINUX=”rd.lvm.lv=fedora_fedora25vm/root rd.lvm.lv=fedora_fedora25vm/swap rd.lvm.lv=fedora_fedora25vm/usr rhgb quiet”
    • contains the cmd line arguments that will be passed to the kernel.  Will be used for all installed kernels.  Removing quiet gives terminal output to help diagnose issues in boot sequence
  • GRUB_DISABLE_RECOVERY=”true”
    • Set to true or false to add recovery entries

Source: https://opensource.com/article/17/3/introduction-grub2-configuration-linux#:~:text=GRUB%20stands%20for%20GRand%20Unified,it%20is%20no%20longer%20needed.

  • That is a broad overview of a standard grub setup.
  • GRUB troubleshooting
    • When grub can’t see any of your kernels and dumps you to a grub rescue prompt, it means that grub is working but it can’t find an actual linux distro anywhere.
    • You will need to find the vmlinuz and initrd files, which are usually in /boot.
    • Then enter the commands:
      • set root=*the drive you found*
      • linux “path to vmlinuz” root=/dev/”where its mounted”
      • initrd “path to initrd”
      • boot
    • Your system should boot.  This is a one time fix and you will need to reinstall grub before rebooting or you will need to do it all again.  You can do this using sudo grub-install /dev/”where its mounted”
      • With any manual changes to your grub always remember to use sudo update-grub
      • You may also need ‘echo GRUB_DISABLE_OS_PROBER=false|sudo tee -a /etc/default/grub && sudo update-grub’
      • In order to re enable os prober
    • Londoner sent this video from “Thor” for fixing a Linux kernel panic, on Manjaro and Endeavour installations on a multiboot system with Mint controlling GRUB.
  • systemd-boot (alternative boot menu for UEFI systems)
    • These instructions are for replacing GRUB with systemd-boot.
    • First, execute the command “sudo bootctl install”
      • This will copy the systemd-boot boot loader to the ESP: on a x64 architecture system /usr/lib/systemd/boot/efi/systemd-bootx64.efi will be copied to esp/EFI/systemd/systemd-bootx64.efi and esp/EFI/BOOT/BOOTX64.EFI, and systemd-boot will be set as the default EFI application.
      • If you have your EFI system partition mounted somewhere else other than the boot partition, you can specify these locations by executing the “sudo bootctl –esp-path=/efi –boot-path=/boot install” command.
    • Next, you need to enable the systemd service which will update the bootloader if and when there is an update to the systemd stack.
      • Execute “sudo bootctl update”
    • There are two types of tiny config files you have to write to get this to work, and on a single boot system there will only be two files total. You have to write a loader.conf, and an entry file for each operating system. As I said – if you only have one operating system, you’ll only have one entry file.
    • In the  esp/loader/ directory, create the file loader.conf and add the following:
      • default  name of your operating system.conf
      • timeout  4
      • console-mode max
      • editor   no
    • In the esp/loader/entries/ folder, add the file name of your operating system.conf and add the following:
      • title – operating system name. Required.
      • version – kernel version, shown only when multiple entries with the same title exist. Optional.
      • machine-id – machine identifier from /etc/machine-id, shown only when multiple entries with the same title and version exist. Optional.
      • efi – EFI program to start, relative to your ESP (esp); e.g. /vmlinuz-linux. Either this parameter or linux (see below) is required.
      • options – space-separated command line options to pass to the EFI program or kernel parameters. Optional, but you will need at least root=dev if booting Linux. This parameter can be omitted if the root partition is assigned the correct Root Partition Type GUID as defined in
  • An example of a well written entry configuration would look like this:
    • title   Linux Mint
    • linux   /vmlinuz-linux
    • initrd  /intel-ucode.img
    • initrd  /initramfs-linux.img
    • options root=”/dev/sda1″ rw quiet
  • Once these files are written, you can safely remove GRUB from your system, and it may be a good idea to delete the GRUB directory from the EFI system this way it removes possible confusion when telling the UEFI what boot entry to load.
  • As I said, consult online documentation and be sure you understand what you are doing before attempting to replace any bootloader, as a mistake can leave your machine in an unbootable state. I recommend practicing in a virtual machine, using the exact same operating system you have installed on bare metal several times before attempting to do it on your system.
  • rEFInd (alternative boot menu for UEFI systems)
      • Distros usually install GRUB to different directories, you might have multiple ones
      • GRUB is both a boot manager (presents menu) and a bootloader (loads kernel)
      • rEFInd is a boot manager, but not a boot loader
      • “In theory, EFI implementations should provide boot managers”
      • all EFI-capable OSes include one, so the above limitation isn’t a problem
      • since version 3.3.0, the kernel can function as an EFI boot loader for itself
    • Installing rEFInd: apt install refind and sudo refind-install
    • rEFInd fully lives on the EFI partition, once installed on it.
    • refind.conf – a single configuration file (timeout, log level, background, icons, text,font, custom menu entries are optional, not necessary)
    • Scans your drives at every boot, lists bootable entries (bootloaders, kernels)
    • refind_linux.conf – separate config file in the /boot dir of each distro, boot options

Check This Out

  • Audio Sharing (a new Gnome Circle app)
  • The “stat /” command lets you check when your system was installed
  • How to stop video tearing in XFCE without the use of an alternative compositing manager.
    • xfconf-query -c xfwm4 -p /general/vblank_mode -s glx

Wrap-up

Before we leave, we want to make sure to acknowledge some of the people who make mintCast possible:

  • Norbert and Tony H for our audio production
  • Leo for timestamps and publishing
  • Josh Lowe for all his work on the website
  • Hobstar for our logo
  • initrd for the animated Discord logo
  • Londoner for our time sync
  • Bytemark Hosting for hosting mintcast.org and our Mumble server
  • Archive.org for hosting our audio files
  • HPR for our backup Mumble room
  • The Linux Mint development team for the fine distro we love to talk about.Thanks, Clem!

2 Replies to “383.5 – Bootloader Boot Camp”

  1. ebsf

    Sadly, the only consequence of installing and configuring systemd-boot on a multiboot Linux system is that it boots to the GRUB shell.

    If you have any suggestions to get systemd-boot to observe its configuration, I’m all ears.

    • mintcast

      I’ve not had this problem. If you’re switching from grub to systemd-boot, you have to be sure to uninstall grub, get rid of the grub config, and be sure you’re UEFI is pointed to the systemd-boot image

Leave a Reply

Your email address will not be published.

Linux Mint

The distribution that spawned a podcast. Support us by supporting them. Donate here.

Archive.org

We currently host our podcast at archive.org. Support us by supporting them. Donate here.

Audacity

They’ve made post-production of our podcast possible. Support us by supporting them. Contribute here.

Episode Archives