GRUB is messed up

blackguyza

Well-Known Member
Joined
Mar 6, 2009
Messages
453
Reaction score
11
Location
Heilbron, Free State
Hi guys,

I installed Ubuntu twice on different drives and now my GRUB is messed up. I don't know anything about GRUB and I am new to Linux.
 
Well uumm, err, you are not going to get anywhere by saying its just messed up!

Post details, I am going to assume you are using ubuntu 1.0 on a 486 with 512k RAM and the problem is its trying to boot off the floppy disk instead?
 
I am using ubuntu 9.10 on 3Ghz P4 with 2GB ram.

I get the following error: initrd too big

I can still boot to my second OS (WinXP) on the second hard drive though.
 
Last edited:
Thought so, its a known bug. You can resolve this by doing an system update from the livecd:

sudo mkdir /mnt/karmic
sudo mount /dev/sdb1 /mnt/karmic/
sudo mount -o bind /proc /mnt/karmic/proc
sudo mount -o bind /dev /mnt/karmic/dev
sudo mount -o bind /dev/pts /mnt/karmic/dev/pts
sudo mount -o bind /sys /mnt/karmic/sys
sudo cp /etc/resolv.conf /mnt/karmic/etc/resolve.conf
sudo chroot /mnt/karmic /bin/bash
sudo apt-get update
sudo apt-get upgrade

In my opinion 9.10 is still a bit shaky if you new to linux. Give the above a shot I hope it helps.
 
I still can't load linux from my hard drive because I get the following error message from grub: "initrd is too big"

I also want to restore grub to enable me to choose to boot from linux on my "/dev/sdb1" and windows xp on my "/dev/sdb1". I tried "sudo update-grub" after mounting to /dev/sda1 and got the following error messages
sudo: unable to resolve host ubuntu
grub-probe: error: cannot find a device for /.

Please help
 
I think you are not following what has been suggested to you.

Boot the Ubuntu CD and choose the "try out" option so that it boots with a desktop session you can use. Once it is booted, go to applications and choose terminal, now follow the above steps.
 
I think you are not following what has been suggested to you.

Boot the Ubuntu CD and choose the "try out" option so that it boots with a desktop session you can use. Once it is booted, go to applications and choose terminal, now follow the above steps.

I managed to fix the GRUB to enable me to boot ubuntu without a cd, no more initrd error. But now I want to be able to choose between Ubuntu and Windows XP once again. I now don't even get the options. The computer just says "GRUB loading" and then load up ubuntu.
 
I assume you have to adjust the menu timer display period in the grub config and add WinXP to the menu if it's not there already.
 
Post the output of:

sudo fdisk -l
sudo cat /etc/fstab
sudo cat /boot/grub/grub.cfg

When you paste it here, put it around the code tags

<code>
paste output
</code>

Except use [ and ] instead of < and >
 
Code:
Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x4d82d1f7

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1216     9767488+  83  Linux
/dev/sda2            1217        9483    66404677+   5  Extended
/dev/sda3            9484        9729     1975995   82  Linux swap / Solaris
/dev/sda5            1217        9483    66404646   83  Linux

Disk /dev/sdb: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x7a9672a1

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1       30853   247818690    7  HPFS/NTFS
/dev/sdb2           30853       60801   240565342+   5  Extended
/dev/sdb5           30853       60049   234524871   83  Linux
/dev/sdb6           60050       60801     6040408+  82  Linux swap / Solaris

sudo cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# / was on /dev/sda1 during installation
UUID=e4ed1eae-54c8-449c-bd60-9f4a9c43b8f0 /               ext4    errors=remount-ro 0       1
# /home was on /dev/sda5 during installation
UUID=4b9ed9be-b6eb-4853-8b15-fd52775bc213 /home           ext4    defaults        0       2
# swap was on /dev/sda3 during installation
UUID=a89166ab-d904-449e-a16f-3aad15a197af none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0

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

### BEGIN /etc/grub.d/00_header ###
if [ -s /boot/grub/grubenv ]; then
  have_grubenv=true
  load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
  saved_entry=${prev_saved_entry}
  save_env saved_entry
  prev_saved_entry=
  save_env prev_saved_entry
fi
insmod ext2
set root=(hd0,1)
search --no-floppy --fs-uuid --set e4ed1eae-54c8-449c-bd60-9f4a9c43b8f0
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  insmod gfxterm
  insmod vbe
  if terminal_output gfxterm ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal gfxterm
  fi
fi
if [ ${recordfail} = 1 ]; then
  set timeout=-1
else
  set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/white
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Ubuntu, Linux 2.6.31-14-generic" {
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
	set quiet=1
	insmod ext2
	set root=(hd0,1)
	search --no-floppy --fs-uuid --set e4ed1eae-54c8-449c-bd60-9f4a9c43b8f0
	linux	/boot/vmlinuz-2.6.31-14-generic root=UUID=e4ed1eae-54c8-449c-bd60-9f4a9c43b8f0 ro  splash vga=769  quiet splash
	initrd	/boot/initrd.img-2.6.31-14-generic
}
menuentry "Ubuntu, Linux 2.6.31-14-generic (recovery mode)" {
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
	insmod ext2
	set root=(hd0,1)
	search --no-floppy --fs-uuid --set e4ed1eae-54c8-449c-bd60-9f4a9c43b8f0
	linux	/boot/vmlinuz-2.6.31-14-generic root=UUID=e4ed1eae-54c8-449c-bd60-9f4a9c43b8f0 ro single  splash vga=769
	initrd	/boot/initrd.img-2.6.31-14-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
	linux16	/boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
	linux16	/boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows NT/2000/XP (on /dev/sdb1)" {
	drivemap -s (hd0) ${root}
	chainloader +1
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# 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 ###

I still have to format the second partition in my 500GB. I will need it for storing music, videos, etc; so I will have to format it as NTFS.
 
Last edited:
Try this:

$ sudo gedit /etc/grub.d/50_personal

Copy and paste the below into the file
Code:
#!/bin/sh                                                 
cat << EOF
menuentry "Windows (Own Grub) (on /dev/sdb1)" {
	set root=(hd1,1)
	chainloader +1
}
EOF
Save and close

$ sudo chmod +x /etc/grub.d/50_personal
$ sudo update-grub

Reboot and grub should now have an entry called Windows (Own Grub) (on /dev/sdb1). See if it boots.
 
Last edited:
I got the following output:

Code:
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.31-14-generic
Found initrd image: /boot/initrd.img-2.6.31-14-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Windows NT/2000/XP on /dev/sdb1
grub-probe: error: Cannot find a GRUB drive for /dev/sdb1.  Check your device.map.

/etc/grub.d/50_personal: 1: menuentry: not found
/etc/grub.d/50_personal: 2: Syntax error: "(" unexpected
 
Last edited:
Sorry, that file should look like this
Code:
#!/bin/sh                                                 
cat << EOF
menuentry "Windows (Own Grub) (on /dev/sdb1)" {
	set root=(hd1,1)
	chainloader +1
}
EOF
 
I get the following output and when I try booting windows, it doesn't - it just hangs:

Code:
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.31-14-generic
Found initrd image: /boot/initrd.img-2.6.31-14-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Windows NT/2000/XP on /dev/sdb1
grub-probe: error: Cannot find a GRUB drive for /dev/sdb1.  Check your device.map.
done
 
If your Xp is on /dev/sdb1 then the "set root" in that script should be:
set root=(hd1,0)

hd1,1, would be pointing to the extended partition, /dev/sdb2

EDIT:
Never mind, just now saw that Grub2 changed the partition numbering, so that script is in fact correct.

Interesting that distros throw Grub2 into the fray when the wiki clearly states:
Considering Installation

GRUB 1 works great for most things, and will for some time to come. This version is called GRUB 2 because you should think twice about upgrading (because it's in development), and twice about rebooting (because it has a new config system).

Now why would one then use this on a stable release??? It should be in testing!!!
 
Last edited:
Top
Sign up to the MyBroadband newsletter
X