5

When I boot up I get a screen saying:

Gave up waiting for root device

Then it lists common problems:

ALERT! /dev/mapper/ubuntu--vg-root does npt exist. Dropping to a shell!

Then I get an initramfs prompt.

Is this fixable without a backup?

I can't remember exactly what I did to make this stop working...

(My hard disk is NOT encrypted.)

8

Ubuntu's LVM autodetect didn't work at all for me either. To fix it, I made a script in

/etc/initramfs-tools/scripts/local-top/forcelvm

with the following contents:

#!/bin/sh
PREREQ=""
prereqs()
{
   echo "$PREREQ"
}
case $1 in
prereqs)
   prereqs
   exit 0
   ;;
esac
. /scripts/functions
# Begin real processing below this line

# This was necessary because ubuntu's LVM autodetect is completely broken. This
# is the only line they needed in their script. It makes no sense.
# How was this so hard for you to do, Ubuntu?!?!?
lvm vgchange -ay

Then did

# chmod +x `/etc/initramfs-tools/scripts/local-top/forcelvm`

for good measure and

# update-initramfs -u -k all

That fixed everything, while persisting after a system update.

  • This is the real working solution to this annoying problem. I encountered this issue when upgrading my long running VirtualBox VM (initially built back in 2008 @ 8.04) from 16.04 to 18.04. It failed to boot into the latest kernel (4.15.0-23) while it can still boot into the 16.04 kernel (4.4.0-xx whose initramfs / initrd image was not updated during the process). Looking at the error message in console it indicated that the LVM VGs/LVs were not activated (root found found) and thus dropped into initramfs. I am yet to understand why such a bug can still hit us in 18.04. – Terry Wang Jun 19 '18 at 23:46
  • Worked well and restored my boot after upgrading to 16.04 – Oleg Gryb Dec 15 '18 at 1:58
2

Try a temporary workaround

In initramfs prompt type:

vgchange -ay

Sample output:

logical volume(s) in volume group "vg1000" now active

Followed by:

exit

If you have a LVM snapshot of root partition, that's a bug #360237. I solve this issue removing/deleting that snapshot.

If not your case, try fix doing this.

Another related bugs: #1396213, #29858, #1163406

  • 1
    This saved me after 2 days logged out of my machine in initramfs with a similar error. Can someone explain what vgchange -ay actually does? and why it worked? thank you. – Massagran Sep 8 '15 at 19:55
  • 1
    vgchange -ay in the (initramfs) prompt returns /bin/sh: vgchange: not found for me :( – knocte Oct 2 '16 at 10:17
1

For some of you it might be a problem in your grub.cfg:

Stumbled about the same problem (root not found as lvm volume groups were not activated by initrd) today on 18.04. I figured out that the volume groups are automatically activated if you specify your root device in the "grub.cfg" via device name

linux   /vmlinuz root=/dev/mapper/vg-root

where as they are not automatically activated if you specify it per UUID

linux   /vmlinuz root=UUID=abcd-[...]

Thus there had to be some script in initrd which contains this logic.

0
  1. Backup

    /usr/share/initramfs-tools/scripts/local-top/lvm2
    
  2. Edit

    /usr/share/initramfs-tools/scripts/local-top/lvm2
    
  3. Between modprobe -q dm-mod and activate_vg "$ROOT" add this line to initialize your lvm:

    lvm vgchange -ayactivate_vg "$ROOT"
    
  4. Rebuild your initramfs:

    sudo update-initramfs -u
    
  5. Rebuild your grub cfg:

     sudo update-grub
    

Enjoy! :-)

  • what if /usr/share/initramfs-tools doesn't exist for me? – knocte Oct 2 '16 at 10:18
  • That's a terrible idea. Make your changes in /etc/initramfs-tools/scripts for them to persist between system updates. – enigmaticPhysicist Oct 8 '16 at 16:03
  • Not recommended approach to make changes to files provided by a package. The change may get overridden by package updates or the change can be unintentionally kept (hidden), causing more issues than it solves. – Terry Wang Jun 20 '18 at 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.