4

I am loading Linux (Debian Lenny) on VirtualBox but there is apparently something wrong with the GRUB. When I start the system, a grub menu appears:

enter image description here

Then I run the following commands:

root (hd0,0)
kernel /vmlinuz root=/dev/hda1 ro quiet
initrd /initrd.img
boot

After the system boots, how should I continue to repair the grub file? Any advice would be appreciated!

1
  • How about update-grub (as root)? This should rebuild your grub.cfg.
    – sr_
    Jun 3, 2012 at 9:30

2 Answers 2

2

First (for future visitors), if you can't manage to boot into your system, pop in a Debian rescue CD or USB drive, mount your root partition at /mnt, and open a terminal and run

chroot /mnt

so that you can type commands in your installed system. If you have a separate /boot partition, type mount /boot to mount it.

You should have a file called /boot/grub/menu.lst. If you don't, run update-grub to create an initial file. The file contains “magic” comments, which the update-grub command transforms into actual Grub directives. Look for the following two lines (which begin with a #) and edit them if they don't match what worked for you:

# kopt=root=/dev/hda1 ro quiet
# groot=(hd0,0)

Once you've edited these lines, run update-grub (again, if you had to run it once to create the file).

If you prefer to write menu.lst manually (which is only necessary in odd setups), here's how the section to boot Linux would look like:

title           Debian GNU/Linux
root            (hd0,0)
kernel          /vmlinuz root=/dev/hda1 ro quiet
initrd          /initrd.img
3
  • Why would this fix anything? May 17 at 12:26
  • 1
    @steveantwan Grub consists of multiple pieces. The first piece needs to know where the second piece is, and the first piece can't read the filesystem. Running update-grub writes the first piece outside the filesystem and embeds the location of the second piece based on information in /boot/grub/menu.lst. For whatever reason, something in the asker's system is not up to date, and following this answer should rewrite the parts of grub that are outside the filesystem with a correct configuration. May 17 at 13:57
  • However, note that this answer was written a long time ago, and is not necessarily valid for modern versions of Grub. May 17 at 13:58
0

Maybe you can load an alternative kernel? You can use TAB to look for other available kernels? The error message can mean you didn't have a disk driver compiled into the kernel or as a module.

3
  • I could manage to boot the system. Please see the updated question.
    – B Faley
    Jun 2, 2012 at 10:32
  • Just add the kernel parameter to your grub line. The root=... ro helps me sometimes, too.
    – Micromega
    Jun 2, 2012 at 10:36
  • But maybe change ro to rw?
    – Micromega
    Jun 2, 2012 at 10:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .