2

So I guess I messed up my Ubuntu Server just now.

I installed a 500GB hard drive, formatted it with ext4 and then wanted to statically mount via editing /etc/fstab and the UUID.

For some reason I somehow removed the '-' in the UUID because I don't know why. So after rebooting now i get the following:

"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 module (cat /proc/modules; ls /dev)
ALERT! /dev/mapper/server--vg-root does not exist. Dropping to shell!"

Then I get a very limited BusyBox shell.

What I've tried so far is booting with a live USB Ubuntu desktop and mounted the Boot drive but when accessing it there are only the Kernel versions and grub and some more stuff, but not the root files "/etc, /usr, /home, etc" otherwise I'd just have undone the changes to fstab and tried but I don't even get there.

edit (output of fdisk -l):

Disk /dev/sdb: 320.1 GB, 320072933376 bytes
81 heads, 63 sectors/track, 122504 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00094364

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048   625142447   312570200   83  Linux

3 Answers 3

2

In initramfs, type:

#/sbin/lvm vgchange -a y
#vgchange -a y
#exit

If you're unable to solve the issue, type this:

ls /dev/mapper

Now, you should have found root (like /dev/vgname/lvname).

reboot

And then select a kernel on the screen and select e to edit and paste a root value (like /dev/vgname/lvname) at:

/boot/vmlinuxxxxx root=uuid/dev/xxx.

Then, finally, press Ctrl+X to boot.

If problem repeats when reboot the server

go to

  #/boot/grub/grub.cfg

at /vm/vmlinuz root=write your full lv path

if problem not fixed try fix initramfs as below

1.Go to server terminal

      # sudo rmmod floppy

       #echo "blacklist floppy" | sudo tee /etc/modprobe.d/blacklis-floppy.conf
 #dpkg-reconfigure initramfs-tools
 #update-initramfs -u
 #update-grub
 #reboot
  1. Execute this

     #/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
       lvm vgchange -ay
    

Then do

       # chmod +x `/etc/initramfs-tools/scripts/local-top/forcelvm`
       # update-initramfs -u -k all
  1. take backup of lvm2

            #apt-get install lvm2
            #cp /usr/share/initramfs-tools/scripts/local-top/lvm2  /tmp
    

Edit lvm2

          #vi /usr/share/initramfs-tools/scripts/local-top/lvm2

write Between modprobe -q dm-mod and activate_vg "$ROOT" add this line to initialize your lvm:

lvm vgchange -ayactivate_vg "$ROOT" if you not find this line

write below two line at the end of the file above exit 0

           #lvm vgchange -ayactivate_vg "$ROOT"
           #activate_vg="$ROOT"
save the file

then

            #update-initramfs -u
            #update-grub
            #reboot
1
  • thank you, you save my day Nov 21, 2023 at 3:46
1

Follow the steps to mount lvm partitions:

In live session, open a terminal

Press Ctrl+Alt+T

and run:

sudo fdisk -l

This lists out the partition table of the system and it looked something like this:

Device Boot Start End Blocks Id System
/dev/sda1* 1    4864 39070048+ 83 Linux
/dev/sda2  4865 6691 14675377+ 83 LVM2_member ...

The next step was to access the /dev/sda2 partition. It is an lvm partition.

In order to install the required tools, run the following command.

sudo apt-get update
sudo apt-get install lvm2

Once you are done with this run pvs:

sudo pvs

This will list the volume groups to which our physical volume /dev/sda2 belonged. It would be of the form

PV VG Fmt Attr PSize PFree /dev/sda2 VolGroup01 lvm2 a- 148.94G 32.00M

The field VG: shows the Volume group.

The above output is just an example, showing that we are concerned with the Volume group "VolGroup01".

The next step is to list the information about this volume group:

sudo lvdisplay /dev/VolGroup01

It will throw a bunch of ouput, but the one we are concerned with is LV Name. It will look something like this:

LV Name /dev/VolGroup01/LogVol00

Assuming that the above one is the partition that we need to mount, just use the usual method to mount it:

sudo mount /dev/VolGroup01/LogVol00 /mnt

Now, you can to find the data you were looking for in the /mnt folder.

6
  • When I run "sudo pvs" it returns exacty nothing o.O? There is only one Partition on the Harddrive (sdb1, Linux) but it still only shows the /boot Folder when mounted.
    – Fabian
    Jul 26, 2015 at 9:11
  • Please, put out of command: 'sudo fdisk -l'
    – kyodake
    Jul 26, 2015 at 14:16
  • Edited start post!
    – Fabian
    Jul 26, 2015 at 17:11
  • Something serious happened to your hdd: You say "I installed a 500GB hard drive" Fdisk say "Disk /dev/sdb: 320.1 GB" and root device is missing!
    – kyodake
    Jul 26, 2015 at 20:58
  • Well, yes. The boot partiton we're discussing is on the 320GB drive, the 500GB drive was an addition to storage and is not really the problem
    – Fabian
    Jul 26, 2015 at 21:10
0

To me this happened after a vgrename went south. Editing the grub.cfg for the new root did it. In addition I had to also edit the /etc/fstab because it remained with old root vg/lv values.

You must log in to answer this question.

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