Software & AppsOperating SystemLinux

Fixing “Can’t find LVM root dropped back to initramfs” Error on Ubuntu Boot

Ubuntu 19

If you’re an Ubuntu user, you might have encountered the error message “Can’t find LVM root dropped back to initramfs” during boot. This error indicates that the system can’t locate the root device for the Logical Volume Management (LVM) volume group. In this article, we’ll guide you on how to resolve this issue.

Quick Answer

To fix the "Can’t find LVM root dropped back to initramfs" error on Ubuntu boot, you can try using the vgchange -ay command in the initramfs prompt. If that doesn’t work, you can modify the forcelvm script or the lvm2 file. Remember to backup your data before attempting any changes.

Understanding the Error

Before we delve into the solution, it’s important to understand what the error message means. The error “Can’t find LVM root dropped back to initramfs” implies that the system is unable to find the root filesystem. This could be due to a variety of reasons, such as improper configuration of the LVM or issues with the initramfs.

Solution 1: Using the vgchange -ay Command

One of the simplest solutions to this problem is to use the vgchange -ay command in the initramfs prompt. Here’s how you can do it:

  1. When you encounter the error, you’ll be dropped to an initramfs prompt. Here, type the command vgchange -ay and press Enter.

The vgchange command is used to change attributes of an LVM2 volume group. The -ay option activates all known volume groups in the system.

If the command runs successfully, it should activate the LVM volume group and resolve the issue, allowing your system to boot normally.

Solution 2: Modifying the forcelvm Script

If the first solution doesn’t work, you can try modifying the forcelvm script. This script is located in the /etc/initramfs-tools/scripts/local-top/ directory. Here’s how to do it:

  1. Create the script with the following content:
#!/bin/sh
PREREQ=""
prereqs()
{
 echo "$PREREQ"
}

case $1 in
prereqs)
 prereqs
 exit 0
 ;;
esac

. /scripts/functions
# Begin real processing below this line
lvm vgchange -ay
  1. Make the script executable by running the command chmod +x /etc/initramfs-tools/scripts/local-top/forcelvm.

The chmod +x command changes the permissions of the file to make it executable.

  1. Update the initramfs by running the command update-initramfs -u -k all.

The update-initramfs command is used to generate an initramfs image. The -u option updates the existing initramfs, and the -k all option specifies that all kernels should be updated.

After these steps, the changes should persist even after a system update.

Solution 3: Modifying the lvm2 File

In some cases, you might need to modify the lvm2 file located in the /usr/share/initramfs-tools/scripts/local-top/ directory. Here’s how to do it:

  1. Open the file and add the line lvm vgchange -ayactivate_vg "$ROOT" between modprobe -q dm-mod and activate_vg "$ROOT".
  2. Rebuild the initramfs by running the command update-initramfs -u.
  3. Update the grub configuration by running the command update-grub.

Please note that modifying files provided by a package is not recommended as the changes may be overridden by package updates or cause unintended issues. Therefore, it’s always better to make changes in the /etc/initramfs-tools/scripts directory to ensure persistence between system updates.

Conclusion

The “Can’t find LVM root dropped back to initramfs” error on Ubuntu boot can be quite frustrating, but it’s not insurmountable. By using the vgchange -ay command or modifying the appropriate scripts, you can resolve the issue and get your system back up and running. Remember, it’s always important to have a backup of your data to prevent any potential loss.

What is LVM in Ubuntu?

LVM stands for Logical Volume Management. It is a method of managing disk space on Linux systems that allows for dynamic allocation and resizing of logical volumes. It provides flexibility in managing storage by allowing you to create virtual partitions that can span multiple physical disks.

How can I access the initramfs prompt?

To access the initramfs prompt, you can interrupt the boot process by pressing the "Ctrl" and "Alt" keys simultaneously, along with the "Del" key if needed. This will take you to the GRUB menu. From there, select the desired Ubuntu entry and press "e" to edit. Look for the line starting with "linux" or "linuxefi" and add "break=init" at the end of the line. Then press "Ctrl" + "X" or "F10" to boot into the initramfs prompt.

How do I open a file for editing in Ubuntu?

To open a file for editing in Ubuntu, you can use a text editor such as Nano or Vim. For example, to open the file named "example.txt" using Nano, you can run the command nano example.txt. This will open the file in the Nano editor, where you can make changes. After editing, press "Ctrl" + "X" to exit, and you will be prompted to save the changes.

Can I undo changes made to the `/etc/initramfs-tools/scripts/local-top/forcelvm` file?

Yes, you can undo changes made to the /etc/initramfs-tools/scripts/local-top/forcelvm file by reverting to a previous version of the file. If you have a backup of the file, you can simply replace the modified file with the backup. If not, you can try reinstalling the initramfs-tools package, which should restore the original file. However, it’s always recommended to create backups before making any modifications to system files.

Will modifying the `lvm2` file cause any issues with package updates?

Modifying the lvm2 file located in the /usr/share/initramfs-tools/scripts/local-top/ directory is not recommended. Changes made to this file may be overridden by package updates, and it can also cause unintended issues. It’s best to make modifications in the /etc/initramfs-tools/scripts directory, as mentioned in Solution 3, to ensure persistence between system updates.

Leave a Comment

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