Sometimes error messages can result in more scared than they are, especially those strictly related to the boot loading. In that situation, when the error message is not much clear, we wrongly assume that a clean reinstallation is the only solution.
How this story started
I have a dual boot computer, and someday ago I had a good idea to update Windows 10 to the 1909 version.
After spending a couple of days doing it, at the reboot I tried to select my main OS, the current openSUSE Leap 15.1.
What I saw later was, at a first sight, a message as unexpected than terrific:
Failed to start Switch Root. See 'systemctl status initrd-switch-root.service' for details.
And then executing the suggested command:
# systemctl status initrd-switch-root.service
I got this one:
Failed to switch root: Specified switch root path /sysroot does not seem to be an OS tree. os-release file is missing. initrd-switch-root.service: main process exited, code=exited, status=1/FAILURE Failed to start Switch Root.
Running the dmesg command was also pointing out a mistake in the hibernation partition.
In that situation is easy to think that Windows corrupted some partitions and the only way to come out of the problem is a reinstallation from scratch.
A careful analysis
Luckily any Linux distro provides valid command-line tools that help to better investigate what’s going on.
Looking for the
/sysroot path, I noticed that the folder list was matching with my home partition content.
blkid command I annotated the number assigned to any partitions like /dev/sdaX and the respective label.
Rebooting the system and editing the GRUB menu made it clear. Looking at the partition values assigned to root and resume key we have something like:
Which doesn’t match with the previous annotation.
For some reason the Windows update shifted the partition number, the good news is that only fixing the appended number did the trick:
Fix it permanently
To make these fix permanent, after the system started I applied the same corrections through the YaST Control Center at the Bootloader applet, updating the Kernel Command Line Parameter in the Kernel Parameter tab.
To proceed through the command line we have to edit the file used by YaST which is used to regenerate the configuration file for GRUB:
$ sudo vi /etc/default/grub
And after updating the GRUB_CMDLINE_LINUX_DEFAULT key we can rebuild the GRUB menu configuration file:
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Probably if it was happening some year ago, during my early studies about Linux and its ecosystem, I would have reinstalled my distro from scratch, wasting precious time to set it up again.
Linux these years became stronger and even more reliable, error messages are more verbose and able to put the user in the right direction although at a first sight they look intimidating. As seen in this article with a little of patience and the right attitude make the job done!