You are not logged in.

#1 2011-07-11 03:19:27

MoonSwan
Member
From: Great White North
Registered: 2008-01-23
Posts: 881

[Re-Solved] Grub2 and my LVM have made my system unbootable.

I have spent about a week trying different solutions I've found on this forum and the wiki.  I am my wit's end and finally asking for help. And apologies for the length of this post.  I was just trying to be thorough.

I have an LVM setup with a separate /boot directory.  What precipitated this entire debacle is that for some odd reason my /boot partition was not being recognised by its UUID in /etc/fstab when booting up.  I kept getting an error that said, "unable to resolve [UUID of /boot]."  I'd be dropped to a root shell at that point and I had to try to figure out a way to get that partition bootable again.  I ended up generating a new UUID and inserting it into /etc/fstab and into grub's grub.cfg file.  After this point things went downhill rapidly...see next paragraph.

My problem is:  Grub2 would not give me a bootable system when I started trying to set it up a week ago.  I have tried these solutions :

- letting pacman remove then re-install grub-bios using "pacman -Rns grub-bios;" it suceeded at re-installing it but now pacman refuses to run because there is a lock in-place preventing it from working.  The error says "...pacman cannot (work) due to the database already being locked.  If you're sure no other package manner is in-use, remove (null)."  I would happily love to apply this advice to get pacman moving again but there is no "null" or lock, as far as I can tell by looking at "/var/lock.."

-I've tried many times to force grub to remake grub.cfg.  This is fine and it goes without errors.  However, I looked at the newly minted grub.cfg files and all of them have a line something like this:  "search fs-by-uuid --set root=UUID#Here."  The problem with this is that the UUID changes every time I try to remake the grub.cfg.  Also, according to my fstab, the only number that shows is the physical LVM's partition.  I don't understand why grub-mkconfig is generating UUID's or pulling them from thin air perhaps?  These new UUID's are not found in my /etc/fstab...are they being read from my LVM array somehow?

- My second to last attempt was chrooting into my arch install, running "grub-bios --no-floppy --boot=/boot --recheck /dev/sda"  {I think I mucked up an argument .. it should read ... --boot-directory=/boot?

- Desperate, I edited grub.cfg by hand and tried to let it search by label instead.  This too failed and I was dropped to a grube rescue prompt.  So as of the time of this post, the only way I can get back into my linux install is through a chroot.  Definitely not ideal. 

Edit: now I can't chroot into my system and I get this error, "chroot: failed to run command 'bin/bash': Exec format error."  Apparently I'm quite late with my usual sacrificing to the Gods of Computing and the Murphy Factor is kickin in full time. Yay.

Any help is welcome and thanks in advance.

LVM layout and partitions:

======================>>> fsarchiver probe simple <<<=====================[======DISK======][=============NAME==============][====SIZE====][MAJ][MIN][sda             ] [ST3500320AS                    ] [   465.76 GB] [  8] [  0]
[sdb             ] [WDC WD1002FAEX-0               ] [   931.51 GB] [  8] [ 16]
[sdc             ] [WDC WD5000YS-01M               ] [   465.76 GB] [  8] [ 32]
[sdd             ] [WDC WD5000YS-01M               ] [   465.76 GB] [  8] [ 48]
[sde             ] [Storage Media                  ] [     7.47 GB] [  8] [ 64][=====DEVICE=====][==FILESYS==][======LABEL======][====SIZE====][MAJ][MIN][loop0           ] [squashfs   ] [<unknown>        ] [   265.55 MB] [  7] [  0]
[sda1            ] [ext4       ] [boot             ] [    70.57 MB] [  8] [  1]
[sda2            ] [ext4       ] [data             ] [   232.83 GB] [  8] [  2]
[sda5            ] [ext4       ] [configs          ] [     4.66 GB] [  8] [  5]
[sda6            ] [LVM2_member] [<unknown>        ] [   228.20 GB] [  8] [  6]
[sdb2            ] [ntfs       ] [<unknown>        ] [   101.34 GB] [  8] [ 18]
[sdb3            ] [ntfs       ] [Games            ] [   830.08 GB] [  8] [ 19]
[sdc1            ] [ntfs       ] [archives         ] [   465.76 GB] [  8] [ 33]
[sdd1            ] [ntfs       ] [Multimedia       ] [   465.76 GB] [  8] [ 49]
[dm-0            ] [ext4       ] [<unknown>        ] [   146.48 GB][253][  0]
[dm-1            ] [ext4       ] [<unknown>        ] [    14.65 GB][253][  1]
[dm-2            ] [ext4       ] [<unknown>        ] [     4.88 GB][253][  2]
[dm-3            ] [ext4       ] [<unknown>        ] [     9.77 GB][253][  3]
[dm-4            ] [swap       ] [<unknown>        ] [  1000.00 MB][253][  4]

My grub.cfg file, the "label" lines are my own insertion, usually it shows "search-by-fs-uuid"  instead:

# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  insmod vbe
  insmod vga
  insmod video_bochs
  insmod video_cirrus
}

set menu_color_normal=light-blue/black
set menu_color_highlight=light-cyan/blue

insmod lvm
insmod part_msdos
insmod ext2
set root='(archlinux-root)'
search --no-floppy --fs-label --set=root /dev/mapper/archlinux-root
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  insmod part_msdos
  insmod ext2
  set root='(hd0,msdos1)'
  search --no-floppy --fs-label --set=root /dev/mapper/archlinux-root
  set locale_dir=($root)/grub/locale
  set lang=en_US
  insmod gettext
fi
terminal_input console
terminal_output gfxterm
set timeout=5
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/40_custom.pacsave ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

### END /etc/grub.d/40_custom.pacsave ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ### 

Last edited by MoonSwan (2011-07-12 18:51:23)

Offline

#2 2011-07-12 18:50:39

MoonSwan
Member
From: Great White North
Registered: 2008-01-23
Posts: 881

Re: [Re-Solved] Grub2 and my LVM have made my system unbootable.

I resolved some of my issues by using gparted to see why i couldn't get grub2 installed correctly.  It turned out that my boot partition was corrupted beyong repair.  I was forced to remake the partition and re-install grub2 in the end.

I am marking this as solved but with a small caveat  if someone else tries to install Grub2 to a corrupt partition.  Take this as a warning:  grub2 never (not once!) gave me an error that the partition it was attempting to install upon was corrupted.  It never gave an error code or any hint that it did not complete properly.  I tried, when I found out the partition (/boot) was really unwriteable, to install other things to it.  Of course these experiments failed but grub2 never complained, i always got a "completed without errors" message.

I hope this will help someone else in the future to avoid the misfortune I encountered.

Offline

Board footer

Powered by FluxBB