Methods of payment Abuse

How to fix the incorrect name of the Grub root partition

12.10.2023, 21:53

The name of the Grub root partition is the path to the root partition (usually denoted as /) in the Linux operating system. Grub (GRand Unified Bootloader) is a Linux operating system loader that allows you to select and load operating systems at computer startup.

The role of the root partition name

When the computer boots, Grub searches for the specified root partition, which contains the main files of the operating system. The name of the Grub root partition is usually specified in the grub.cfg bootloader configuration file or in other Grub configuration files that are configured during the installation of the Linux operating system.

The value of the Grub root partition name may vary depending on the specific configuration of the computer and the operating system installed. For example, if you have one operating system installed, the root partition may simply be "/", but if you have multiple operating systems or partitions installed, then the name may be more complex, for example, "/dev/sda1" or "/dev/nvme0n1p2". By the way, if the error vfs unable to mount root fs on unknown block appears, it very often happens because of the incorrect name of the root partition. We have described how to fix the problem here, but there is another way.

How to solve the problem?

In many distributions, the name of the root partition is passed to the kernel in the UUID format in the Grub configuration file. But there is one problem with this. If the root partition has changed in any way, for example, change its size, then the UUID will change. And if you reboot without updating the Grub configuration, the system will not work, because the kernel simply will not be able to find the desired partition.

How to solve the problem? If you know exactly which partition the root is on, you can fix the configuration directly in the Grub menu. In the menu, select the desired item with the up and down arrows, and then press the E button. The configuration editor opens. You need to find a line similar to this one:

linux /boot/vmlinuz-4.15.0-36-generic root=UUID=9d8d92de-74a6-4e64-8281-b8548c690e0c ro quiet splash $vt_handoff

In the line, change the UUID=9d8d92de-74a6-4e64-8281-b8548c690e0c to the usual name of the root partition, for example, /dev/sda2. To start downloading, press F10. If the system boots up, then that was the problem. In the future, you can simply update the Grub configuration:

sudo update-grub

You can also ask Grub to no longer use the UUID to designate the root partition:

sudo vi /etc/default/grub

GRUB_DISABLE_LINUX_UUID=true

The error has disappeared, but the system is still not booting? systemd can use the /etc/fstab file to mount file systems. And if the root file system is specified incorrectly there, the system will not boot. You can use Ubuntu recovery mode. Here, too, you need to replace the UUID with a regular entry or with the correct UUID.