37

today I installed Ubuntu 64-bit on a netbook. When the netbook boots this, error report appeared. I think there is a problem with the partitions.

Gave up waiting for root device. Common problems:
  — Boot args (cat /proc/cmdline)
    — Check rootdelay= (did the system wait long enough?)
    — Check root= (did the system wait for the right device?)
  — Missing modules (cat /proc/modules; ls /dev)
ALERT! /dev/mapper/ubuntu--vg-root does not exist. Dropping to a shell! 

BusyBox v.1.21.1 (Ubuntu 1:1.21.1-1ubuntu1) built-in shell (ash)   
Enter 'help' for list of built-in commands.  

(initramfs)

Output of lsblk as requested:

$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 232.9G  0 disk 
├─sda1   8:1    0   231G  0 part 
├─sda2   8:2    0     1K  0 part 
└─sda5   8:5    0     2G  0 part [SWAP]
sr0     11:0    1   1.2G  0 rom  /cdrom
loop0    7:0    0   1.1G  1 loop /rofs
2
  • 2
    run lsblk and add the output to your question.
    – psusi
    Jan 1, 2015 at 19:54
  • 8
    @psusi What if lsblk is not available?
    – sitilge
    Aug 15, 2015 at 20:06

9 Answers 9

38

In certain Ubuntu versions (e.g. Xubuntu 18.10) this issue might be caused by an apt autoremove. Due to this bug apt will suggest to remove

cryptsetup cryptsetup-bin cryptsetup-initramfs cryptsetup-run dmeventd libdevmapper-event1.02.1 liblvm2app2.2 liblvm2cmd2.02 libreadline5 lvm2

which makes the system non-bootable (because the root partiation cannot be mounted and unencrypted using LVM).

If you are not using LVM and disk encryption this answer is probably not for you.

I was able to fix it by re-installing cryptsetup and lvm2 in a chroot environment: boot from a live USB stick, run commands below in a terminal, reboot.

# find root partition
sudo fdisk -l

# unencrypt partition
#   Note: replace /dev/nvme0n1p3 with your disk
#         replace "nvme0n1p3_crypt" with the correct name 
#         check by running this in chroot:
#         $ cat /etc/crypttab | cut -f1 -d " "
#         nvme0n1p3_crypt
sudo cryptsetup luksOpen /dev/nvme0n1p3 nvme0n1p3_crypt

# mount root partition
sudo vgscan 
sudo vgchange -ay
sudo mount /dev/mapper/xubuntu--vg-root /mnt

# prepare chroot environment
sudo mount /dev/nvme0n1p2 /mnt/boot/   # replace nvme0n1p2 with your boot partition!
sudo mount -o rbind /dev/ /mnt/dev/
sudo mount -t proc proc /mnt/proc/
sudo mount -t sysfs sys /mnt/sys/

# make dns available in chroot
sudo cp /etc/resolv.conf  /mnt/etc/resolv.conf 

# enter chroot
sudo chroot /mnt /bin/bash

# re-install missing packages
apt install cryptsetup lvm2

# re-generate  (this might be done also by apt in the step before, I'm not sure)
update-initramfs -u -k all

# Leave chroot environment - not sure if the following is really necessary...
exit
# Write buffers to disk
sudo sync
# Unmount file systems
sudo umount /mnt/sys
sudo umount /mnt/proc
sudo umount /mnt/boot

This Q&A helped me collecting the commands.

This Q&A is kind of related, but maybe not relevant for you anylonger if you are having this issue already.

17
  • 4
    Ohh, you just saved me about three days of work I'd put into setting up a new device. Worked perfectly! Replaced nvme0n1p3 with sda5 and nvme0n1p2 with sda1 (linux partition inside the LVM and the small boot partition outside the LVM, respectively)
    – Oliver U
    Feb 26, 2019 at 16:51
  • 1
    @OliverU great that it worked! Even if you can't make it boot anymore, you should be still able to copy your home directory and maybe parts of /etc or so to a fresh install. That should be probably less work than the inital setup.
    – lumbric
    Feb 27, 2019 at 12:10
  • 3
    Worked perfectly for Ubuntu 18.10, where the problem happened to me after apt autoremove issue. Like Oliver above, I just had to replace the following in the instructions: nvme0n1p3sda5, nvme0n1p3sda5_crypt, nvme0n1p2sda1. Wit the right guess like that, no need to enter chroot twice as cat /etc/crypttab | cut -f1 -d " " inside chroot will just confirm you made the right guess. If you need to enter twice, do so after a reboot as closing and reopening the crytpsetup + LVM2 environment without rebooting seems … complex.
    – tanius
    Sep 29, 2019 at 20:58
  • 3
    In my case, the missing bit was apt install cryptsetup-initramfs from chroot environment.
    – Adobe
    Jul 12, 2021 at 10:55
  • 1
    In my case, nothing seemed to get installed when I ran apt inside the chroot shell. I think what did the trick was modifying /etc/crypttab (inside the chroot shell) to say nvme0n1p3_crypt UUID=[…] none luks,discard instead of crypt_dev_nvme0n1p3 UUID=[…] /etc/luks-keys/crypt_dev_nvme0n1p3 luks,discard. But I don't know for sure. Jan 17, 2022 at 17:48
17

Please add the outputs of lsblk -fs, fdisk /dev/sda with p flag and the report of grub repair to the question as pastebin links.

Based on searching, there seems to be similar questions on Ask Ubuntu that has no answer up to date here and Here one answer is given which explains about raid and ubuntu.

There seems to be several suggestions, some of which seem to work for some people.

  1. From the initframs prompt try typing ls /dev/mapper and see if your root volume is listed. If it is not listed, try waiting 10 seconds and run ls again.

    If it is now listed, type exit and it should now find the root device and boot (taken from here

  2. Edit the boot config by pressing e when grub alert to choose OS, and replace root=UUID-6500... by root=/dev/sdx where sdx is the boot partition. The problem here seems to be that the UUID is either wrong, or /dev/disk/by-UUID... does not exist(1)

  3. Adding the parameter all_generic_ide to the end of the boot-line like kernel /boot/vmlinuz-2.6.27-7-generic root=UUID=43206294-74ef-434d-aca2-db74b4257590 ro quiet splash all_generic_ide seems to work for some people (2)
  4. The Super User question here, seems to suggest the error is due to LVM. The solution is also given in the same which is to install lvm2.
  5. The same Super User site also suggests booting using an older Kernel, if available. It seems to work for some people. Trying to boot using the Recovery option might work for some people
  6. Post by nux_man777 here seems to suggest the error may be in the installation medium.
  7. The error /dev/mapper/ubuntu-vg-root seems to be related to raid as described here.

    "In the installer summary screen right before the copy process starts, click the Advanced button. Change the boot partition (this is the MSDOS-style "parent" partition not the Linux partitions) to /dev/mapper/pdc_feddabdf (or whatever dmraid lists as your fakeraid partition) Make sure the checkbox is clicked to boot from this disk. note that the installer will modify grub2 to point to the correct logical partition /dev/mapper/pdc_feddabdf1 or whatever / is on."

    Detailed instructions regarding installation is given in the referred site. Please check there for more info on installation of grub.

  8. Booting into a live installation media and updating ubuntu by changing root using chroot seems to work for some people (suggested by cpttripzz here). Instruction regarding chroot is here. You can also refer to this question at Unix & Linux. More details can be found at Arch Wiki and Gentoo Wiki.
  9. Changing the SATA Controller to Native IDE from RAID and doing a fresh install seems to work for some people here and here
  10. IDE cable or the hard disk may be bad (the same ubuntu forum as above page 40)
15
9

I had this problem and nothing on any posts here or elsewhere were able to help. Specifically in my case, I could see that /dev/mapper did not contain ubuntu--vg-root or anything else for that matter. This means that something either went wrong when LVM tried to mount/map the volumes OR something went wrong earlier in the boot process, and this error is just a catch-all symptom for any earlier problem.

The second of these was the case for me and only because of my reading about initramfs I was able to understand and diagnose the issue. This should be the first thing you do if you suspect something has gone wrong prior to LVM doing its thing.

In my case (which may not be the same as you but is worth documenting), I had full disk encryption (LUKS) enabled, and somehow the cryptsetup tools had been removed from initramfs, therefore I was not being prompted for the passphrase to unlock, and the drives were not accessible, which meant that /dev/sdaX could not be mounted, and therefore ubuntu--vg-root could not be mounted/mapped into /dev/mapper. If you try to run cryptsetup from the BusyBox prompt, youll know you have the same issue if thecryptsetup` cannot be found.

The solution was to boot from a LiveCD, unlock the drive manually with cryptsetup, chroot into the root filesystem, reinstall cryptsetup and call update-initramfs.

2
  • Welcome to Ask Ubuntu! :-) Can you expand the last line into actual commands?
    – Fabby
    Mar 23, 2018 at 12:24
  • 1
    I wrote a script for this case (LUKS + LVM) on an NVMe drive, but may expand it to /dev/sd* style drives as well. unix.stackexchange.com/a/467113/103652
    – dragon788
    Sep 5, 2018 at 19:27
5

For those here suffering from encryption-related problems, as in @Zanna's answer, you'll need to follow a procedure similar to this:

  1. Boot into your system using a live distro / USB.

  2. Mount the encrypted partition (in Ubuntu, you should see the encrypted volume available on the desktop; double-clicking and entering the password should suffice). The partition will be mounted at /media/ubuntu/[mount point]. (The username will change based on distro; e.g., Xubuntu uses xubuntu.)

  3. Open a terminal window and a bourbon.

  4. Set appropriate bindings for mount points within the system:

    sudo su -
    mount -t auto /dev/sdX /media/ubuntu/[mount point]/boot
    mount --bind /dev /media/ubuntu/[mount point]/dev
    mount --bind /dev/pts /media/ubuntu/[mount point]/dev/pts
    mount --bind /sys /media/ubuntu/[mount point]/sys
    
  5. chroot into the root directory of your encrypted disk: chroot /media/ubuntu/[mount point]

  6. Ensure that your system has appropriate initramfs packages installed: sudo apt install cryptsetup-initramfs lvm2.

  7. Critically, you'll also need to ensure that your configuration files force initramfs to include the cryptsetup binaries, which were removed at some point, it seems: nano /etc/cryptsetup-initramfs/conf-hook, uncomment the CRYPTSETUP line, and make sure it reads CRYPTSETUP=Y.

  8. Finally, run update-initramfs -u -k all, shut down, pull the live media, and start back up.

Your mileage here may vary depending on what's happened with your system. If, for example, you've changed the LVM group name or the UUID, you may need to align /etc/crypttab and /etc/fstab to use the right identifiers. If, like me, you were migrating from one release to another, you may find that you have two encrypted volumes with the same group name—this makes mounting the disk rather difficult (you need to use the UUID explicitly).

All in all, the upgrade to Xubuntu 18.10 was awful because of this. (A stock system wouldn't reboot once the upgrades to the kernel were pulled in!) At least in the current setup I have, the system is stable through reboots.

N.b., the ACPI errors that led me all over the Internet looking for a solution were a red herring: they have no bearing on whether you can boot from an encrypted disk.

2
  • What is sdX in this case? When booting from a LiveCD, there is no /boot partition, so it is not clear what should go in there.
    – ralien
    Apr 18, 2019 at 13:16
  • @ralien — sdX is the drive holding the encrypted partition, probably sda in most systems. In my case, I encrypted the main disk (sda) during a fresh installation.
    – Ethan
    Apr 18, 2019 at 15:14
4

Had a very similar issue after an update of Ubuntu 20.04 on a Dell XPS13 (2020). Searched for hours, the solution was actually super easy.

reboot and go to BIOS using "fn and F2" BIOS > System Configuration > Sata Operation > switch to "AHCI" from "RAID On"

For some reason this BIOS settings was switched.

3
  • I remember having to switch from RAID On to AHCI initially for something related to disk encryption when I first installed Ubuntu 20.04 so I should've thought of it. I had this same thing happen to me, and your answer solved it (thank you so much!!), how in the world did you figure it out? I'm on Dell Latitude.
    – fraiser
    Dec 7, 2020 at 2:04
  • Worked on a Dell XPS 13 7390, running Ubuntu 20.04.3 LTS. It seems to switch to RAID upon very low power by itself (well there was a yellow, Support Assist warning screen I had to click "Continue" through, but still). Running Ubuntu from a flash drive on the machine didn't even show any other drives on it so I was really worried but this fixed everything perfectly.
    – zulu
    Sep 28, 2021 at 11:26
  • Wow you are awesome. It worked :) None of the above answer matched for my Dell Optiplex Booting via LVM on 2TB nvme disk Nov 20, 2022 at 16:04
0

Try the following:

(initramfs) reboot

Then, at the OS chooser prompt, try booting with an older kernel.

If you succeed, then probably this will fix the problem, as suggested in @One Face's bullets 4 and 5, and the link it refers:

sudo apt-get install lvm2
1
  • If lvm2 not installed older kernel will not to boot. lvm2 package and kernel is not linked things. It need to boot with Rescue System and install package through chroot.
    – PRIHLOP
    Sep 12, 2018 at 21:00
0

My system couldn't boot after an update and wasn't prompting me to enter my LUKS passphrase for my root partition. However, I was able to boot after a manual unlock.

Note: Change /dev/vda3 to your root partition that contains Ubuntu.

(initramfs) cryptsetup luksOpen /dev/vda3 ubuntu
            Enter passphrase: *****
(initramfs) exit

The system boots.

3
  • I get 'sh: cryptsetup: not found' when I do this.
    – ohnoplus
    Jan 8, 2023 at 20:14
  • 1
    @ohnoplus That's unfortunate. You don't have cryptsetup-initramfs package installed. This answer might be helpful for the case when the partition is encrypted only.
    – Wild Bear
    Jan 12, 2023 at 23:04
  • Anyone have a permanent fix for this particular solution? Nov 29, 2023 at 19:18
0

Use boot-repair-disk

Download source: https://sourceforge.net/p/boot-repair-cd/home/Home/

I had the same problem, I solved it running an image with boot-repair-disk and less than 15 seconds it was solved. Try it.

0

In my case, booting with the oldest kernel version available in the "Advanced options for Ubuntu" menu in Grub worked.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .