systemd to Allow Automatic Fallback to an Older Kernel in Case of Boot Failure

Recently, systemd launched a new feature to manage boot failure. Let’s read about it in this short coverage on the same.

What is systemd, again?

systemd to Allow Automatic Fallback to an Older Kernel in Case of Boot Failure

Systemd is a system daemon that serves as a software suite of basic building blocks for a Linux system. It facilitates system and service management and starts the rest of the system. It is conventionally represented all in lowercase letters as systemd (system daemon) according to Unix/Linux standards.

It was started as a developer project in 2010 by Lennart Poettering and Kay Sievers. Fedora became the first major distribution to include systemd by default since May 2011.

Inclusion of systemd created some sort of revolt in veteran Linux users. Distributions like Devuan were created just to keep systemd away.

I am not going into the systemd vs init debate here. That’s entirely your call if you understand the technicalities. I am going to share the new feature of systemd along with my experience in fixing boot failure with it.

Boot Counting: Systemd’s Newest Feature

As the phrase suggests, counting boot attempts is a part of a revised version of systemd’s “Automatic Boot Assessment”, which allows tracking kernel boots and failures.

With the help of this assessment, the system can automatically revert to a previous version of the OS/kernel, in case a newer one refuses to boot successfully due to failure.

The revised set of features of systemd’s new Automatic Boot Assessment is available on the GitHub documentation. You may read it if you are interested in the technical details.

The developers also suggest that in addition to providing a complete solution on UEFI systems, the different components may also be used independently in combination with other software.

Diagnosing issues with systemd: My Experience

I am excited about this new feature of systemd. This could save a lot of time and trouble for Linux users. I’ll share my experience with boot problem BEFORE systemd introduced this boot failure feature.

Systemd has helped me diagnose an issue in the past on my dual boot system and I think it would be useful to share the experience here, to know about its resourcefulness:

Once, while attempting to boot my Ubuntu 16.04 LTS system, I got the following error message after selecting the same from GRUB:

systemd to Allow Automatic Fallback to an Older Kernel in Case of Boot Failure

I was alarmed as to why being “greeted” with such an annoying message all of a sudden after a busy day at work. When I read that it is mentioning one of my PC hard disks (/dev/sdb3), I got the hint that it might have to do something with Windows 10’s hibernate feature and the fact that shutdown attempts on Windows 10 are actually partial hibernations for a faster bootup.

As soon as I got this hint, I booted into Windows and did a complete shutdown by holding on to the Shift key and then clicking on Shutdown from the Windows Startup menu, after which I was successfully able to login to Ubuntu. Henceforth, I disabled “fast startup” and hibernation on Windows.

When I looked into the logs with the help of the command, back on Ubuntu, I found out that the error message is a part of systemd’s features. I used the following command to store the complete output of the command in a log file:

journalctl -xb | tee systemdlogged.log

On going through the log file, I could reconfirm that it was indeed due to a partial hibernation on Windows 10 (Cannot create session: Already running ina session).

Love it or hate it?

As you can see that this new automatic fallback to older kernel would save Linux users some trouble here.

This idea would enable implementation of similar schemes on other boot loaders or non-UEFI systems. Perhaps systemd can also be considered for use with LinuxBoot in future?

systemd to Allow Automatic Fallback to an Older Kernel in Case of Boot Failure


Related Post

Leave a Reply

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