Ubuntu 9.10: grub2 installed on the wrong partition, no booting... (MacBook)
There's a good Grub 2 Guide on Ubuntu Forums; this is what I used during my recent Grub2 adventure. Here's another good Grub2 guide, and Ubuntu's Grub2 wiki page.
-
You "uninstall" Grub from a partition by overwriting the boot code it wrote into the boot sector of that partition. Ideally, you'd have a backup of what was there before Grub was installed to it. I don't believe Grub creates this backup for you, so if you want something particular there (other than Grub), you'll need another tool to provide it.
If you want, you can completely uninstall the Grub package, then reinstall (I doubt this is necessary). To do this from a LiveCD system you'll need to chroot into the system you're trying to fix.# chroot (assumes you've mounted the partition to fix to /mnt) sudo mount --bind /dev /mnt/dev sudo chroot /mnt # backup! cp /etc/default/grub /etc/default/grub.old cp -R /etc/grub.d /etc/grub.d.old cp -R /boot/grub /boot/grub.old # purge apt-get purge grub2 grub-pc # reinstall apt-get install grub2 grub-pc # grub install -- make sure /dev/sda is the right drive!! grub-install /dev/sda4 update-grub
If everything went well, you can exit your chroot, unmount your filesystems (/mnt/dev first), and reboot. -
If all you need to do is install Grub to the correct partition, all you really need to do is boot into a LiveCD/LiveUSB, mount your system partition, check that your system's
/boot/grub
is correctly set, and rungrub-setup
. If you need to reconfigure the Grub menu or perform other steps, use a chroot procedure as described earlier.
Let's assume you've booted the LiveCD and mounted your system drive to/mnt
. Check that/mnt/boot/grub
exists, and contains the proper files (a bunch of*.mod
files, a few.img
files, andgrub.cfg
). If so, run this (not from chroot):# install grub to partition boot sector on sda4 # this assumes the partition table you show is on /dev/sda # make sure path & device are correct !!! sudo grub-setup -d /mnt/boot/grub /dev/sda4
Related videos on Youtube
trolle3000
Physics and math student. Unicorn courtesy of balpha on meta.stackoverflow.com.
Updated on September 17, 2022Comments
-
trolle3000 over 1 year
I recently installed Ubuntu 9.10 on my macbook, hoping to create a dual boot system... I use rEFIt to boot.
Installation went great, up until insatllation of grub. Trying to create a dual boot system, I have a handful of partitions, and Ubuntu didn't ask where to put grub; it just choose a partition and put it there.
In the past, Debian worked well with grub and Debian in the same partition. (Debian, macbook and drivers is a high-maintenance trilogy, though...)
This is what Partition Inspector says:
*** Report for internal hard disk *** Current GPT partition table: # Start LBA End LBA Type 1 40 409639 EFI System (FAT) 2 409640 332556807 Mac OS X HFS+ 3 332820480 391414229 EFI System (FAT) 4 391414230 440242355 Basic Data 5 440242356 476678383 Basic Data 6 476678384 488397134 Linux Swap Current MBR partition table: # A Start LBA End LBA Type 1 1 409639 ee EFI Protective 2 * 409640 332556807 af Mac OS X HFS+ 3 332820480 391414229 83 Linux 4 391414230 440242355 83 Linux MBR contents: Boot Code: Unknown, but bootable Partition at LBA 40: Boot Code: None (Non-system disk message) File System: FAT32 Listed in GPT as partition 1, type EFI System (FAT) Partition at LBA 409640: Boot Code: None File System: HFS Extended (HFS+) Listed in GPT as partition 2, type Mac OS X HFS+ Listed in MBR as partition 2, type af Mac OS X HFS+, active Partition at LBA 332820480: Boot Code: None File System: ext3 Listed in GPT as partition 3, type EFI System (FAT) Listed in MBR as partition 3, type 83 Linux Partition at LBA 391414230: Boot Code: None File System: ext3 Listed in GPT as partition 4, type Basic Data Listed in MBR as partition 4, type 83 Linux Partition at LBA 440242356: Boot Code: None (Non-system disk message) File System: FAT32 Listed in GPT as partition 5, type Basic Data Partition at LBA 476678384: Boot Code: None File System: Unknown Listed in GPT as partition 6, type Linux Swap
I'm pretty sure grub was put in GPT #3. I want it to be in GPT #4, where Ubuntu is. How do I move it, ie. do the old uninstall/install?
LiveUSB? LiveCD? What do I write in Terminal...?
Cheers!
-
trolle3000 about 14 yearsExcellent! The second option is what I was looking for.