At Clinic today, Wes and I frobbed around helping John Jordan fix
the hosed grub2 boot on his Fedora 16 laptop.  We learned quite a
bit, found a few dead ends, and based on that I will outline a
simpler way to fix things next time.  John was busy helping others
while we worked on his laptop, so I am guessing he is interested,
too.

Fedora is installed to boot the kernel with "rhgb", which shows
a pretty picture instead of the long list of console messages 
that all True Geeks want to see during startup.  It also installs
with lvm, logical volume management, which is useful for some
systems, but complicates bootup simple systems.  And it uses
grub2, which fills /boot with all sorts of funny little files
that are supposed to be written by grub2-mkconfig from other
funny little files in /etc .  OK when it works, a P.I.T.A. if
you make a small mistake while fooling with grub.

Which John did.  John edited /etc/default/grub, and removed
rhgb from the "linux /vmlinuz- ..." line.  And accidentally
created a two character error later in that line (which looks
like line noise anyway).  He saved the original line after a #
comment just above (good practice), but just this once he missed
the other good practice of replacing "rhgb" with "    " (four
blanks), so that the two lines were easy to compare.  That
made the typo (turning the fragment "lv=" into "lv=v=" harder
to spot.  When he did "grub2-mkconfig -o /boot/grub2/grub.conf",
that screwed up the some files in /boot/grub2 .   Grub still
worked enough to load initrd, a tiny-toy version of a kernel
and tools, but everything necessary to run grub2-mkconfig again,
including the script itself, was on unmounted LVM partitions.

How to fix this?

I won't go into all the dead ends.  The simplest way to fix it
approximates the following (I didn't write enough notes, some 
of this is from memory, some is simplified, YMMV):

-------------------
mkdir /boot
mkdir /r
mount /dev/mapper/vg_devil8-lv-root /r
mount /dev/mapper/vg_devil8-lv-boot /boot

/r/bin/vi /r/etc/default/grub  
   (find the typo fragment, WRITE DOWN WHAT IT IS, and fix it)

/r/bin/grep [typofragment] /boot/grub2/*
   (find the files with the typos - probably /boot/grub2/grub2.cnf)

/r/bin/vi /boot/grub2/[file with typos]
   fix the typos in each affected file

umount /r
umount /boot
-------------------

Pray, or sacrifice a goat, or cross fingers, or whatever works for you.

Hit the power switch (shutdown -r  and reboot are not available)
and restart.  With luck, and perhaps some fixes to the instructions
above, you should have fixed the /etc/default/grub typo that
propagated into /boot/grub2/ , and the machine will boot normally.


This is excessively difficult.  There should be a small binary
in the initrd image that will help you fix grub.  Or the live
CD should have more tools for this.  Or the edit window available
during grub2 boot when you hit "e" should show the "linux" line
(it didn't) so that it can be edited during bootup.  The older
grub on my RHEL5 laptop permits this, and is a much easier way to
work around grub.conf typos.  This may be a bug in grub2 or FC16.


BTW, some may differ, but when I install redhat/fedora systems,
I usually go into custom partitioning and set my own partitions,
avoiding LVM.  LVM is nice when it works, and permits all sorts
of fancy resizing of partitions across physical media, but it
is quite a bit more complicated to debug.  For this and other
reasons, I set up my systems without LVM.  


If there are flaws in the above, I hope someone will post a 
corrected or simplified version.  I hope the result will permit
others to make this fix in a few minutes, rather than the two
hours Wes and I spent on a fascinating but time-needed-elsewhere
frobbing festival.

Keith

-- 
Keith Lofstrom          [email protected]         Voice (503)-520-1993
KLIC --- Keith Lofstrom Integrated Circuits --- "Your Ideas in Silicon"
Design Contracting in Bipolar and CMOS - Analog, Digital, and Scan ICs
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to