[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Fixing boot problems with grub



Hugo Vanwoerkom wrote:
William Ballard wrote:

Whenever Lilo used to mess up with Woody, I'd:

1) Boot from the Woody CD.
2) Mount my existing single Debian partition as /
3) Execute a shell
4) Make sure /vmlinuz and /vmlinuz-old pointed to the right
places in /boot.
5) Exit the shell.
6) Run "make system bootable." which would Lilo it up.

Today I horked my Sarge Grub install, booted from the Sarge CD,
screwed up my paritions when I tried to do (2) (because creating,
formatting, and mounting partitions is all connected), verified
4) was correct, couldn't figure out how to do 6), and running
"upgrade-grub" from within a chroot didn't work.

When I entered "partition my disks," formatting my swap part was
already highlighed.  I picked my big Debian ReiserFS part and told
it not to format it, but to mount it as /, and clicked Finish.
D-I told me it was going to make changes to my partition table,
even though I didn't tell it to change any partitions.  Somehow
when it was done my swap part was gone.

In Sarge D-I, how can I just mount something as / without changing
part tables or formatting anything, and run the "make system bootable" step to recover from botched grub?

Or how can I do it from within a chroot.  I don't usually keep a second
install of Debian around to chroot from, so I'd have to chroot from
the Sarge emergency shell or (less desirably) a Knoppix CD.

For now I just reinstalled the OS.  It takes me 30 minutes with scripts.
But I looked like a tool having to do that.



What does "30 minutes with scripts" mean?

I guess you ended up with a partition that can't be booted by either Lilo or Grub. So I am still a Lilo fan, I modified Lilo's mkrescue to create an iso that is a little more descriptive than "linux" and I keep that around, *always* when using d-i. Because it does grub natively I just let it do grub and use the lilo-rescue to set lilo straight again.

My take on grub vs. lilo from a while ago was that if lilo does me good, keep it.

H.



I'm trying to understand Grub as well. I finally found out how to make a boot disk from the FAQ (see link). The Grub project calls this the "legacy" version (0.9x).

http://www.gnu.org/software/grub/grub-legacy-faq.en.html

The relavent Q&A is:
4. How to create a GRUB boot floppy with the menu interface?

   1. Create a filesystem in your floppy disk (e.g. mke2fs /dev/fd0).
   2. Mount the floppy on somewhere, say, /mnt.
3. Copy the GRUB images to the directory /mnt/boot/grub. Only stage1, stage2 and menu.lst are necessary. You may not copy *stage1_5.
   4. Unmount the floppy.
5. Run the following commands (note that the executable grub may reside in a different directory in your system, for example, /usr/sbin):

/sbin/grub --batch --device-map=/dev/null <<EOF
device (fd0) /dev/fd0
root (fd0)
setup (fd0)
quit
EOF


I tried the result, and it worked. My take is that this won't "fix" anything that breaks, and there must be a working Grub install on the HD to get the files from.

Jim



Reply to: