17

I installed Antergos on my laptop, then installed Ubuntu after that. Ubuntu detected that I had another Linux installed, so it added Antergos to its grub menu. Every time I boot up, grub is loaded from the Ubuntu partition. How can I make the other grub file the default one?

My partitions are:

  • Antergos boot partition (want to load grub.cfg from here) - /dev/sda1
  • Antergos root partition - /dev/sda2
  • Ubuntu partition (grub loads from here) - /dev/sda6
2
  • 1
    You need to install grub on partition /dev/sda1. That could be done by executing command grub-install --root-directory /mnt/sda1 /dev/sda. Provided /dev/sda1 is mounted at /mnt/sda1
    – SHW
    Sep 13, 2016 at 7:15
  • There was an option in grub to chain boot another grub. You'd need to look it up in the Internet. May 21, 2018 at 15:58

3 Answers 3

5

In legacy bios systems, the bios looks up the Master Boot Record (MBR) of the disk it is set to boot. This is the first 512 bytes of the disk and contains the first stage of the bootloader process, this will be grub in your case. The sole job of this stage is to locate and load the second stage normally on the drive that contains /boot. The MBR has these paths hardcoded into it and in order to change them you must reinstall the MBR from the system (or chroot of the system) you want it to point to using grub-install. If you can boot the system then this is trivial, but if you cannot then you must use a livecd and chroot into your system; see the instructions here on how to do that.

However, in your case the antergos grub config will not have the ubuntu distro in it so you will lose the ability to boot that until you add it. You can also configure the ubuntu grub config to boot antergos by default if this is your intended goal. Either approach is acceptable and depends on what you want to achieve.

2
  • My goal is not only to boot Antergos by default, I also want to be able to edit my grub config without having to boot to Ubuntu just to do that. By the way running "sudo grub-mkconfig -o /boot/grub/grub.cfg" on Antergos detects Ubuntu.
    – Chris
    Sep 13, 2016 at 9:36
  • Then you can boot antergos, configure and reinstall grub to the MBR and all should be how you want it. Sep 13, 2016 at 9:40
4

Use grub-install to install grub to /dev/sda (pointing to the grub directory on /dev/sda1 as described by @SHW) and set the boot flag on /dev/sda1 using fdisk or parted.

You may need to remove the boot flag on /dev/sda6 (again using fdisk or parted).

1

In a UEFI system (I don't know about legacy BIOS) :

  1. Find your efi partition using sudo lsblk -f and note its UUID (it should be a vfat partition of couple of hundred Mbs). Let's take this partiton as /dev/mmcblkx and UUID as XXXX-XXXX in this example .

  2. Create /boot/efi/ folder and mount EFI partition under /boot/efi using command

    sudo mount /dev/mmcblkx /boot/efi
    
  3. Verify whether we have mounted the correct EFI partition and check if it has an /boot/efi/EFI folder and inside that EFI folders for the operating systems installed in your system.

    My /boot/efi/EFI looks like this :

    user@user-mypc:~> sudo ls /boot/efi/EFI/
    BOOT  GRUB  linux  opensuse  ubuntu
    
  4. Add entry for EFI partition to mount under /boot/efi in /etc/fstab.

    UUID=XXXX-XXXX /boot/efi vfat utf8 0 2
    
  5. Install GRUB via

    sudo grub2-install --target=i386-efi --efi-directory=/boot/efi/ --bootloader-id=GRUB
    
  6. sudo update-bootloader --refresh .

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

  8. Reboot

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .