Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm on Ubuntu 11.10 64bit booting using rEFIt on a 8,3 2011 Macbook Pro.

I recently switched out the hard drive and modified the order of the partitions when duplicating the disk. Everything's working fine, it's just that I get a "Missing operating system" message when trying to boot into Linux. I'm assuming that the problem is that what was once root at /dev/sda5 is now something else.

How can I update GRUB2 to point to the right partitions for my root directory and swap? I know which partitions are which, I just need to reconfigure things. (GRUB is installed at /dev/sda4, not /dev/sda, to allow rEFIt to work.) I already tried using Boot-Repair, but it didn't fix things as it still won't boot. I'm currently running from a LiveCD and I've mounted the drive, looking for the right configuration file.

What do I need to change and where?

share|improve this question

1 Answer 1

You first need to identify your root and boot partitions.

Assuming your root partition is /dev/sda4 , and you do not haev a separate boot partition, we are going to mount your root partition, install grub, and update the grub menu.

# mount your root partition
sudo mount /dev/sda4 /mnt

# Mount your virtual file systems
for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done

# Install grub
sudo grub-install --boot-directory=/mnt/boot /dev/sda

# chroot , update, and then install grub
sudo chroot /mnt
update-grub
grub-install /dev/sda

To fix your swap, list your partitions

sudo blkid

Edit /mnt/etc/fstab with the correct swap uuid

# graphical
gksu gedit /mnt/etc/fstab

# command line
sudo -e /mnt/etc/fstab

Update your swap UUID

UUID=xxx-yyy-zzz  swap  swap  defaults  0  0

Change "xxx-yyy-zzz to your swap uuid ;)

reboot and all should be working.

share|improve this answer
    
shouldn't gksu /mnt/etc/fstab be gksu gedit /mnt/etc/fstab ? –  Michał Šrajer Dec 25 '11 at 22:18
    
@Michał Šrajer thanks, fixed that –  bodhi.zazen Dec 25 '11 at 22:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.