How to modify systemd-boot on Linux

Do you have multiple kernels on your Linux server, but aren't prompted to select which you want to run? The fix for that might lie in systemd-boot configuration.

How to modify systemd-boot on Linux Do you have multiple kernels on your Linux server, but aren't prompted to select which you want to run? The fix for that might lie in systemd-boot configuration.

When you boot up a Linux server or desktop that uses systemd, you might not have noticed that the boot process is slightly different than the old school method. However, if you've run into an issue with a kernel, it becomes quite clear something has changed.

It used to be, when your had a machine with multiple available kernels, you could gain access to the GRUB menu and select which kernel to boot. If that option wasn't configured by default, you could alter the /etc/default/grub file in such a way as to give you access. The option for configuration is:

GRUB_HIDDEN_TIMEOUT=

By default that option is set to 0. Change that to a value of, say, five and you would then have five seconds (after initial boot) to select what kernel you wanted to use. Of course, after making the change to the grub configuration file, you'd have to run sudo update-grub so the changes would take effect.

That's all fine and good, if you're using a machine that doesn't rely on systemd-boot. If your machine does use systemd-boot (and depends on UEFI boot mode) you have to go about things a bit differently. How? Let me show you.

SEE: Choosing your Windows 7 exit strategy: Four options  (Tech Pro Research)

Configuring systemd-boot

Open a terminal window and issue the command:

sudo -s

After typing your user's sudo password you will find yourself at a root prompt. You must have that level of access, otherwise you cannot view or edit the contents of the necessary directory.

Now that you have the proper access, issue the command:

sudo nano /boot/efi/loader/loader.conf

That file might only contain a single line, or a short few lines (depending on your distribution). For example, Pop!_OS contains only two lines:

default Pop_OS-current
timeout 0

What you need to do is set the timeout to a value of five or ten seconds (or whatever value will give you enough time to select the kernel you want to boot). Once you've made that change, save and close the file.

That's it. Reboot your machine, and you should be greeted by a screen allowing you to select the kernel you wish to run.

Failsafe

One of the things that has always set Linux apart from other operating systems is the ability to keep multiple kernels on a single machine, and selecting which one you want to boot. This makes it possible for you to always have a failsafe kernel at the ready, should an upgrade cause problems. Now you know, whether your machine uses the tried and true grub or the newer systemd-boot process, how to make it possible to select that kernel.

Also see

linuxhero.jpg

By Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.