3

My Linux Mint 17.1 (64-bit) uses LVM on its OS drive (an SSD). I must have done "something" to wreck my system, because last time I rebooted, the boot failed. Instead, I got the message "Alert! /dev/mapper/mint--vg-root does not exist. Dropping to a shell!" and an initramfs shell. I've no idea how to continue.

I'm usually up to date with normal system updates, but don't use a custom kernel or anything like that. I also go for long periods without rebooting, so I've no idea whether this is a recent problem or just went undetected for want of rebooting.

I know neither grub nor initramfs, nor do I have any experience recovering from this sort of thing. Of course, I'm in urgent need of accessing my data!

Other posts say this may be caused by upgrading to a kernel with no lvm2 support, and say it can be fixed with this or that Live DVD. The thing is, I can no longer boot from USB or DVD, because I still just end up on this screen.

My next step is to disconnect the SSD to see if I can then boot from other media, but that's not really a solution.

Assuming I figure out how to boot from media, what can I do? What more do I need to tell you about my situation?

screen shot

Update:

"lvm lvs" and "lvm pvs" says the following. I don't know how this output is supposed to look when everything works. Does this mean they're all in a similar (bad) state, or what?

enter image description here

I have one SSD with two LV's for root and swap, and another LV based on two PV's on each of two separate drives. The number and naming of LV's and VG's is as I expected.

However, I don't know how to read the other columns. It appears that all volumes are in similar state (either all good or all bad), but I may be wrong.

"fdisk -l" is not available on my initramfs shell, but I figured out booting from media, so this is the output of that command (after mounting the volume) when run from a LinuxMint 17.1 Live USB (which is the same as the current OS):

$ fdisk -l
$ fdisk -l /media/mint/verylonguuidstring
last_lba(): I don't know how to handle files with mode 40755
$ fdisk -v
fdisk (util-linux 2.20.1)
$

Hmm, not much of a result. Here is the result from a Live CD named REDO Backup & Restore which I use on occasion. This gives much better results, or at least, actual output.

enter image description here

At least, all my disks can be mounted and seem to be intact, so it's just booting that's the problem.

Update!

I did a daring thing, which seems to have worked. Having booted on a different medium, I mounted the boot partition and modified /boot/grub/grub.cfg. In that file, the "offending" identifier "/dev/mapper/mint--vg-root" appeared a number of times. I changed all of them to "/dev/mapper/ssd_vg-root_lv", saved, and rebooted. And lo! It works, I can now boot my normal OS to my usual desktop. Phew!

Only, the GRUB selection screen remained waiting for 10 seconds, but I managed to turn down the "TIMEOUT" setting in "/etc/default/grub".

@Bratchley, @nkms, I'm very grateful for your support!

  • 1
    usually if it's saying a Volume Group isn't accessible, it's because there are too many physical volumes missing. The root of the issue in that case would be to see why it's not able to find all the pv's. Not sure what ubuntu puts into their initramfs but you might try checking the output of both fdisk -l and pvs to see if any of your volumes are missing. Removing the ssd isn't likely to fix the problem and is probably the wrong thing to do. – Bratchley Aug 24 '15 at 23:29
  • 2
    They're not going to remove LVM support mid-stream on any distro, so you can forget the stuff where people are saying the kernel might not support it. That could cause this, but it's not what's hitting you. Also, this shouldn't stop you from booting from DVD, though. You might have to check your boot order for that. – Bratchley Aug 24 '15 at 23:30
  • Thanks, for both your comments. I can type 'lvm' in the initramfs shell, and it says that my OS PV+VG+LV are active and they seem okay. I'll try 'fdisk -l' in the morning. – KlaymenDK Aug 24 '15 at 23:34
  • 1
    the above output is saying the device file for your LV doesn't exist at all which usually only happens if the logical volume isn't active. You may check the output of lvm lvs to ensure the logical volume shows as active and not just that it's there (it's possible that it's just not able to find enough extents for the logical volume itself). lvm pvs might also tell you which PV's it actually did find and you can figure out which one is missing by process of elimination. – Bratchley Aug 24 '15 at 23:39
  • 1
    Try booting with an older kernel in the boot menu or else try with the kernel option root=/dev/mapper/ssd_vg-root_lv . I suspect somehow the new initramfs was created with a default volume group of 'mint-' (?) instead of your ssd_vg. – nkms Aug 25 '15 at 10:13
0

Make sure your "/boot/grub/grub.cfg" lists the correct VG and LV. In my case, the VG is named "ssd_vg" and the LV is named "root_lv", so the grub.cfg file needs to reference "/dev/mapper/ssd_vg-root_lv" (note use of slashes and dashes!).

  • 1
    tbh it sounds like you renamed the VG without updating grub. It's important to remember to regenerate initramfs and update grub if you rename the VG. Installing a new kernel probably generated a new initramfs for you by itself though. Glad you found the solution, though. – Bratchley Aug 25 '15 at 20:35
0

in initramfs type

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

if you unable to solve the issue type this

  #ls /dev/mapper

you found root (like /dev/vgname/lvname) #reboot then select a kernel on a screen and select e to edit and paste a root value (like /dev/vgname/lvname) at /boot/vmlinuxxxxx root=uuid/dev/xxx. then 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

2. 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

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.