9

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
  • 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 '16 at 7:15
  • There was an option in grub to chain boot another grub. You'd need to look it up in the Internet. – akostadinov May 21 '18 at 15:58
4

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.

  • 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 '16 at 9:36
  • Then you can boot antergos, configure and reinstall grub to the MBR and all should be how you want it. – Michael Daffin Sep 13 '16 at 9:40
1

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).

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.