Link to home
Start Free TrialLog in
Avatar of zotfarms
zotfarmsFlag for United States of America

asked on

Updated Clean install of Ubuntu 10.04 but now it won't boot

just did a clean install of Ubuntu 10.04.  This is the only OS on the computer.  After the install I went to the update manager and did all of the updates that it asked for.  After the update, it asked for a reboot.  At reboot, I get some text at the top of the screen referring to GRUB, and a prompt that looks like "grub>" but no options of available OS to boot to.
Avatar of gmckeown99
gmckeown99

You have to wipe the MBR (Master Boot Record) on the drive and reinstall it. Boot Ubuntu into the live desktop, open a console, su to root and enter dd if=/dev/zero of=/dev/DRIVE bs=512 count=1 (replace DRIVE with your actual drive id - usually sda)

This will wipe the boot record and you will have clean drive to install. This happens when you reinstall over a previous install and the grub installer fails.

Er, you don't need to wipe the whole thing just to get grub working.

Can you remember the partitioning set up you used?  Normally there is a separate boot partition.  I will assume that your boot partition is /dev/sda1 and your root partition is /dev/sda2.  You may need to adjust for your setup.

Boot from the ubuntu live CD, and go to a console

mkdir /mnt/disk
mount /dev/sda2 /mnt/disk
mount /dev/sda1 /mnt/disk/boot
mount --bind /proc /mnt/disk/proc
mount --bind /dev /mnt/disk/dev
chroot /mnt/disk

With the above commands, we have set up your disks as they would appear if you had booted.

The first thing to do is take a look at grubs menu.lst to see if it makes sense.  This is in /boot/grub/menu.lst

It will refer to root= in the kernel line, and if I recall right, ubuntu uses uuid to let you know which is the right disk.  So where you see root=/dev/by-uuid/[lots of characters] do
 
  ls -la /dev/by-uuid/[lots of characters]

And confirm that this is pointing at the partition you expect - like /dev/sda2 in this case.

If it is right, we can re-install grub.

Type grub and you will get the grub> prompt

Type root(hd0,0)
Type setup(hd0)

The "root" command tells grub where the boot partition is.  In this example, I have said sda1 is the boot partition.  If sda2 was the boot partition, this would read root(hd0,1) - ie the partition number is one less than the /dev partition number.

The setup command will install grub into the MBR.  Watch for any errors.

Good luck.
ASKER CERTIFIED SOLUTION
Avatar of TobiasHolm
TobiasHolm
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zotfarms

ASKER

I used the automatic setup.  This is not a dual boot setup, so I don't know how the partitioning is done.  How would I determine the partitioning?
The disks will almost certainly be sda1, sda2, sda3 etc

So once you boot from the live CD and get to a console, you can just type:

  fdisk -l

This will show you the partitioning for your disks.  There will be two small partitions (probably), boot and swap, and one or more larger partitions.

If LVM was used, a single large partition on the sda disk, and then a bunch of /dev/dm-x disks.  No need to get into that unless they are there.

So the easiest way is to mount each of the partitions and have a look:

mount /dev/sda1 /mnt
ls /mnt
umount /dev/sda1

mount /dev/sda2 /mnt
ls /mnt
umount /dev/sda2

The boot partition will have kernels and vmlinux files and system maps, and a folder called grub

The root partition will contain /etc /bin /sbin/ /usr /var etc.
You can use 'sudo fdisk -l' to see the partitions and their names.
If you have Ubuntu in sda1 (check with 'sudo fdisk -l'):

Boot Ubuntu LiveCD and start a terminal window:

sudo mount /dev/sda1 /mnt
sudo mount --bind /dev /mnt/dev
sudo chroot /mnt
sudo update-grub

Reboot!