0

I just acquired a macbook air. I dual-booted mac os with Ubuntu. It is my first time multiple-booting on a mac. I triple-booted with another Ubuntu. Ater removing the third distro, I experience some issues with grub.

First of all, I made my partitions as follow:

$ lsblk
sda
  sda1  200M    /boot/efi
  sda2  47.3GB              # Mac os
  sda3  620MB               # Mac rescue
  sda4  2GB                 # Swap partition
  sda5  50GB                # Ubuntu 1
  sda6  50GB                # Ubuntu 2
  sda10 100GB               # ext4 file system

I did an install of Ubuntu on sda5. Once finished, it directly boots with Ubuntu which is great. I later installed another ubuntu on sda6 as I would like to test using other ditros and I want to check if I could do that easily. Note that the Ubuntu version is the exact same I installed on another partition. Once the second Ubuntu installed, I reboot and I have the grub screen asking me to chose between the two Ubuntus. Neat. Then, having no use for the second ubuntu, I simply erased sda6 using gdisk:

$ gdisk /dev/sda
> d  # delete partition
> 6  # delete partition 6
> w  # write changes
> Y  # confirmation of writing changes.
> q  # quit gdisk

$ lsblk
sda
  sda1  200M    /boot/efi
  sda2  47.3GB              # Mac os
  sda3  620MB               # Mac rescue
  sda4  2GB                 # Swap partition
  sda5  50GB                # Ubuntu 1
  sda10 100GB               # ext4 file system

Now on reboot, I get the grub command line on black screen. I have to specify the disk where my ubuntu is located. I followed some indications in this thread to boot on Ubuntu: https://askubuntu.com/questions/159846/tried-to-boot-ubuntu-but-the-grub-rescue-shows-up-instead and tried doing the following:

grub> ls (hd2,gpt5)  # That's my Ubuntu partition
grub> root=(hd2,gpt5)
grub> configfile /boot/grub/grub.cfg

Now I succesfully booted in Ubuntu. After logging in, I followed the instrutions on updating grub:

$ sudo update-grub

Alas when rebooting, the grub screen pops up again. So updating grub did not do the trick. I also tried to do with grub 2 in case:

$ sudo update-grub2

It does not change anything.

I also tried to reinstall the second version of Ubuntu on sda6. Same scheme, when I reboot, I am asked to chose between the two Ubuntu versions in the grub menu, so it kind of solves the issue. But as soon as I remove the second Ubuntu partition, the first one won't boot directly unless I specify it in the grub command line screen.

I don't know if this might be useful, but here is my fstab:

$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' 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>
# / was on /dev/sda2 during installation
UUID=85ab4560-729a-4f7d-91d9-69af89ea1219 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=DAC6-DEC2  /boot/efi       vfat    defaults        0       1
# swap was on /dev/sda4 during installation
UUID=9c76739a-5996-43d8-a14e-fe690c06870f none            swap    sw              0       0

What can I do to solve this issue? Is it a matter of EFI? Why removing the second Ubuntu partition makes the first one unrecognized to grub?

Note that I would like to find a clean solution, so I would like to avoid reinstalling Ubuntu to solve it.

1

You need to recreate the grub.cfg using the following command:

grub2-mkconfig -o /boot/grub2/grub.cfg

Or

grub-mkconfig -o /boot/grub/grub.cfg
  • Sorry for the delay and thanks for your answer. Once booted on my ubuntu, I recreated the grub.cfg: grub-mkconfig -o /boot/grub/grub.cfg. Then I updated grub: sudo update-grub. I rebooted but the grub black screen is displayed again. DId I miss something? – kaligne Jun 19 '16 at 9:30
  • Sould I also do a grub install on the hard drive? – kaligne Jun 19 '16 at 10:21
  • Yes you should install grub on the hdd – GAD3R Jun 19 '16 at 10:41
  • Wouldn't that mess with the MAC bootloader or anything? – kaligne Jun 19 '16 at 11:01
  • First partition is an EFI System Partition. Then two mac partitions, 1 linux swap, two linux filesystem with one for ubuntu. What would running a grub install on the whole disk do? – kaligne Jun 19 '16 at 11:19
0

I solved my issue by getting hints from this thread: https://superuser.com/questions/376470/how-to-reinstall-grub2-efi

I did not need to use a live installation, I just booted into my ubuntu session through the grub window. I then reinstalled grub:

$ apt-get install --reinstall grub-efi-amd64

This also did an update-grub automatically. It works and updated the grub.cfg file in /boot/efi/EFI/ubuntu/grub.cfg, updating the right partition to boot ubuntu from:

$ cat /boot/efi/EFI/ubuntu/grub.cfg 
search.fs_uuid 17441147-6b9d-45fe-bccd-bed2451f43f8 root hd0,gpt5 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

Previously, running

$ update-grub

would not update neither the uuid nor the partition, old partition was the latest ubuntu's, named hd0,gpt6. So it seems reinstalling grub was necessary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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