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

SOLVED: Always falling to grub prompt



Finally my problem is solved.

The problem was that I had to reinstall grub in the MBR of the first
disk, *telling it that /boot was in a different partition*. I booted
from a LiveCD (I was using GParted's one, as it booted faster than the rescue
option of Debian's LiveCD, and I had to boot quite a few times in the
last hours), then typed "grub". This led to the grub prompt. I set the
root device to (hd1,0), since this is the boot partition (where
grub/stage1 file is):

grub> root (hd1,0)

And then I install grub in the MBR of *the first disk*, where Windows
is installed, and quit the grub shell:

grub> setup (hd0)
grub> quit

Then reboot, and... voila, the grub menu I was missing so much, after
one week of absense. All my kernels and Windows are booting normally,
and I'm very happy. Thanks to all those of you who helped. It was
really difficult to be sure what to do just by browsing the web. Two
particularly useful websites were the grub manual,
http://www.gnu.org/software/grub/manual/html_node/Installing-GRUB-natively.html#Installing-GRUB-natively,
and 
http://www.terabyteunlimited.com/kb/article.php?id=232

Anyway, for the record, for anyone browsing the web, 
here is a "short" summary of this adventure :-)

1. Initial setup:
   hda  : cdrom
   hdc1 : Windows partition in first disk (10G)
   hdd1 : Linux bootable partition in second disk (160G)
   hdd2 : Linux swap in second disk
   
2. The problem:
   Some kernel upgrade left the system unbootable. Booting with the
   new kernel led to Error 18 (more cylinders than BIOS can manage).
   Old kernel booted. Subsequent kernel upgrades and playing with
   menu.lst completed the mess. In the end, I had two kernels (the
   oldest and the newest) booting, and two kernels with Error 18. 
   None of them booted normally, though, and I always got the grub
   prompt. I had to manually give "root", "kernel", "initrd" and 
   "boot" commands at the prompt, to boot.
   
3. The diagnostics: 
   As someone pointed out, kernels and menu.lst must
   have been written beyond the zone visible by the BIOS, so after
   months of normal operation, suddenly I could not boot. 

4. Solution (first step):
   Following suggestions from this list, I left a small boot partition
   at the beginning of /dev/hdd. I used GParted Live CD 0.3.4-8, which
   was able (amazingly) to move the beginning of the /dev/hdd1
   partition. I left 500 M free. With GParted, I set it as ext3. After
   "executing pending actions", which meant 1h40m of waiting until the
   resize of hdd1 completed, I had a new "/dev/hdd3" partition at 
   the beginning of the 160G disk. Then I set the bootable flag on it,
   also with GParted. 
   
   Now open a terminal, and followed the suggestions I received:
   
   - Mounted both partitions, /dev/hdd3 as /mnt/new-part and /dev/hdd1 as
   /mnt/old-part.
   - Copy /mnt/old-part/boot/* to /mnt/new-part
   - Moved /mnt/old-part/boot to /mnt/old-part/old-boot, 
     then mkdir /mnt/old-part/boot [probably not necessary?]. 
   - Edit /mnt/old-part/fstab (see later for the final setup that works)
   - Umount /mnt/new-part, remount on /mnt/old-part/boot
   - Chroot into /mnt/old-part
   - Edited menu.lst (see later for the final setup that works)
  
   I rebuilt initrd's:
   update-initramfs -k "all" -u
   
5. Solution (second, probably unnecessary, step)

   The previous procedure didn't work, and I was still left with an
   unbootable system. It failed with "Error 15", and not even got a
   grub prompt. I thought there was a problem with partition order,
   and I fixed that. fstab and menu.lst were edited accordingly,
   and that's the setup that is working now, but I don't think 
   this step was necessary. Anyway:
   
   fdisk /dev/hdd
   
   Used commands: m (menu), p (print partition table), x (extra
               	  functionality), f (fix partition order),
		  w (write partition table to disk)
		  
   Final /etc/fstab:
   
   /dev/hdd2	    /	ext3	defaults,errors=remount-ro	0 1
   /dev/hdd1	    /boot  ext3	defaults,errors=remount-ro	0 2
   /dev/hdd3	    none   swap	sw				0 0
   [other lines]
   
   Final /boot/grub/device.map:
   
   (hd0) /dev/hdc
   (hd1) /dev/hdd
   
   Final /boot/grub/menu.lst [only relevant lines]:
   
   [...]
   # kopt=root=/dev/hdd2 ro
   [...]
   # groot=(hd1,0)
   [...]
   root		(hd1,0)
   kernel	/vmlinuz-<version> root=/dev/hdd2 ro
   initrd	/initrd.img-<version>
   savedefault
   [...]
   title	Windows
   root		(hd0,0)
   savedefault
   makeactive
   chainloader	+1

6. Solution (third and final, and critical, step)

   The problem persisted, and the solution was to reinstall grub
   in the MBR of the first disk (hd0, hdc), with root in (hd0,1) [hdd]:
   
   After booting from LiveCD:
   
   # grub
   grub> root (hd0,1)
   grub> setup (hd0)
   grub> quit
   #
   
Ok, that's it. Thanks again for the help.

Victor
   
   



Reply to: