My thoughts on Slackware, life and everything

How I switched us.slackware.nl from lilo to grub

Today I finally switched my US server from lilo to grub as its bootloader.

The reason for doing it now, is that I usually do not have a remote IP console (KVM) to that physical server which is located in a US datacenter whereas I live in Europe. This server’s storage is configured as software RAID1 and has been running for years on a Slackware huge kernel, since I was unable to make a generic kernel plus initrd work. That was many years ago.
Now this server runs Slackware-current and the recent updates to Slackware-current include automatic recreation of an initrd, followed by an update of the Grub configuration when installing a new kernel. Essentially, when you have configured Grub to boot your machine, you won’t have to re-install the bootloader until the actual grub package is upgraded to a new version.

I wanted this switch from lilo to grub to ease future upgrades. But had to wait until the server owner was able to connect a KVM and gave me access. The reason for being hesitant to just install grub and reboot are obvious: what if the server won’t come up after boot, for whatever reason? I won’t be able to fix that remotely without access to the console and maybe the BIOS.

I did my research on installing Grub to a software RAID and in the course of that, discovered that Linux does not even read the file “/etc/mdadm.conf” anymore, because the RAID metadata is written to the disks themselves and mdadm extracts it on the fly. Anyway, I also learned that there’s a peculiarity that you need to take into account when using Grub to boot off a software RAID: you need to install Grub to both of the hard drives that together form the software RAID1. I thought, well I can do that!

Then I scribbeled down some possible iterations of the “grub-install” command that I would try until one actually worked. Why that doubt about a successful outcome? Obviously because I was bitten before! I have switched a Linode server from lilo to grub last year and the grub-install command crapped out with:

grub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
grub-install: error: will not proceed with blocklists

What I eventually needed to do was add “–force” to the grub-install command because apparently Grub works fine with blocklists despite the error. The command eventually became:

# grub-install --recheck /dev/sda --force

… and the Linode rebooted just fine into Grub. Goes to say, Grub is at least as finicky as lilo.

Of course, when you anticipate bad things to happen, you’re jinxed and bad things will happen.
When I was ready to start the switch from lilo to grub, had a KVM connected, installed the latest kernel-generic and let that generate an initrd.img and write a Grub configuration, I proceeded with:

# grub-install --recheck /dev/sda

What I did not anticipate was the resulting error:

Installing for i386-pc platform.
grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won’t be possible.
grub-install: error: embedding is not possible, but this is required for RAID and LVM install.

I had to search for that warning and the error to find out what was happening. Searching for the error message (last line) was not returning much useful information but when searching for the warning, I found the GRUB article on the Arch Linux Wiki (Arch to the rescue once again): GRUB#GUID_Partition_Table_(GPT)_specific_instructions

It is a really informative and instructive article! Basically, my disks are formatted as GPT and not equipped with a MBR. Grub’s requirements are vastly different in those two cases:

  • When installing to a MBR disk, it squeezes the ‘core.img’ code in the post-MBR gap, between byte number 512 and the start of the first partition. Now it also makes sense why disk partitioning utilities start the first partition at sector 2048 which leaves almost 1 MB for the Grub bootloader.
  • When installing to a GPT disk, Grub wants to install its ‘core.img’ to a separate “BIOS Boot Partition” (partition number ‘EF02’)

Oops… my disk was already partitioned, not leaving any space and was already running as ‘us.slackware.nl’ for years! I could not simply erase the disks and start from scratch.
Luckily the Arch Wiki article pointed out that this BIOS Boot partition can still be created, in the space before the first partition.  Modern disk partition tools, as said earlier, create the first partition at sector 2048. The trick is to use gdisk (because this is a GPT disk) and prompt it to create a new partition. Gdisk will tell you that it can create one that starts at sector 34 and will end at sector 2047. Perfect for our needs.
So, I created that partition and assigned partition type ‘EF02’ to it (equivalent to GUID ‘21686148-6449-6E6F-744E-656564454649’ and skipped creating a filesystem on it – not needed.

It turns out that this partition can be in any position order as long as it is on the first 2 TiB of the disk. In my case, it became partition number ‘4’ even though it’s physically located at the start of the disk.

After creating the partition, I re-ran the grub-install commands:

# grub-install --recheck /dev/sda
# grub-install --recheck /dev/sdb

There were no errors, I double-checked my KVM access and rebooted. The server came back up without a hickup.

I hope this write-up will help someone somewhere in the future.
Cheers, Eric

7 Comments

  1. Jen

    Definitely helpful! My old hard drive bought the farm last October, and my computer wouldn’t boot an nvme without grub. So…grub it was. I have to admit it was pretty painless switching. The update process for bigger packages (like kernel source) has been sped up, too. It used to be that I had time to get a fresh cup of coffee while it ran. Not so anymore. 😉

  2. Christopher

    Excellent article Eric. I discover the same issue when switching to grub on my main computer. Had to add a EF02 partition. I did the same procedure using gdisk to create the partition.

  3. Didier Spaier

    Hello Eric,

    As I rent a VPS to linode (now Akamai) located in Frakfurt (Gemany) you made me curious.

    Actually initially he system was a Slackware-14.2 a installed by Linode (not by me) that I upgraded to Slackware-15.0. Funnily no kernel is installed in the VM. lilo is not installed, grub is installed but not used. The first line of “dmesg -H” says:
    [Feb24 13:57] Linux version 6.10.2-x86_64-linode165 (maker@build.linode.com) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #1 SMP PREEMPT_DYNAMIC Tue Jul 30 15:03:21 EDT 2024
    so it’s a kernel built by Linode on an Ubuntu host, loaded in RAM through KVM: no boot loader in the VM 😉
    In case of an issue if I am unable to ssh I can log in @ linode.com and manage the VM from there (power off, reboot, login in in a Lish console, restore a backup…) so that’s all I need.
    Other than that the Slint installer uses GRUB. In “auto” partitioning mode it creates a GPT including a BIOSBoot partition and en ESP so the system can boot in Legacy as in EFI mode.
    In case of “manual” (by the use prior to start the installation) partitioning mode, the requirements are listed in the scripts functions:
    https://slackware.uk/slint/x86_64/slint-15.0/source/build_ISO_for_slint64-15.0-6/files-in-initrd/functions from line number 695 and the booting equipment put in the system in the function bootingsetup from line number 3054.
    Sorry for the off-topic.
    Cheers,
    Didier

    • alienbob

      I think we have different kinds of Linodes, you and me. I run the actual Slackware kernel here:
      Linux booboo.slackware.nl 6.12.15 #1 SMP PREEMPT_DYNAMIC Tue Feb 18 15:40:14 CST 2025 x86_64 AMD Some Processor AuthenticAMD GNU/Linux

      • Didier Spaier

        Not really a different kind I think, just that I didn’t install kernel and booting stuff in it. Would I do it I assume that I would get a similar kernel command line as yours. I have only 395 packages in it, including 18 I built in the host. I could shrink that, as you made me realize that there are some, including big ones, that I probably don’t need But I didn’t install the system, Linode being one of the hosting providers that offer to install Slackware for you (initially Slackware 14.2 on 25 October 2017, upgraded by me to Slackware 15.0 on 15 October 2023). By the way this illustrates that they know how to manage dependencies better than me 😉
        Loosely related: I find the Arch way of managing set of packages interesting at least for Slackware derivatives: https://wiki.archlinux.org/title/Meta_package_and_package_group. This would need some implementation work but not that Slackware provides dependencies management (although that would make things easier), which will most probably not occur during my life time anyay 😉

  4. Michael

    Wow, thank you so much! Just what I needed for my Slackware current install. I just made a big update after a long time and wanted to recreate initrd and all that and now I can take the kernel stuff off my blacklist and just update it with the rest of it all. I think Slackware 16 will be a nice milestone 🙂

  5. fredmyra

    Thanks Eric !

    You have clarified several questions i have been confronted with for many years. Since I always multiboot several distros I have always been able to start Slackware from Grub in some other distro, which I don’t find much elegant as Slackware is my main distro. Not only that but I must often tweak the <slaclware stanza in Grub's meny.

    Now I can finally try to install Grub under Slackware.. Hmmmmm! I run stable… Will that be a problem ????

    P.S: I didn't know that besides a data-genius you are also a good storyteller, enjoyed the quality of your text.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2025 Alien Pastures

Theme by Anders NorenUp ↑