I am booting four operating systems: Windows 7, Ubuntu, Kali Linux, and Linux Mint. They were installed in that order, with Linux Mint most recently and Windows 7 first. I am able to edit the /etc/default/grub file and update grub with sudo update-grub
, but only configurations saved in the config file for Linux Mint are used. Is there a way to specify which configuration file grub uses or a way to set the default?
3 Answers
Yes you can add some custom menu entries in /etc/grub.d/40_custom
This is just an example one I am currently using. More can also be added.
menuentry "NetBSD on sda1" {
insmod ufs2
set root=(hd0,msdos1)
knetbsd /netbsd --root=wd0a
}
Setting the default menu entry for your setup you could just modify and change the GRUB_DEFAULT=
entry
/etc/default/grub
Choose which ever you want to be default.
GRUB_DEFAULT=0 (Windows) GRUB_DEFAULT=1 (Ubuntu) GRUB_DEFAULT=2 (Kali) GRUB_DEFAULT=3 (Linux Mint)
Yes. When grub-install prepares the GRUB binary (no matter if MBR or EFI), it embeds a reference (my guess is UUID, but I am not sure) to the file-system which contains the grub.cfg
. By default, this may be the root of the current system, or /boot in case of a separate boot-partition. The default can be overridden via grub-install's --boot-partition
or --root-partition
. This means, by default the last system which executed grub-install "wins" the authority over the configuration file.
You can only have one bootloader in the MBR (Master Boot Record) at a time.
Since Linux Mint was installed more recently, if you selected to install GRUB during the installation, it was installed on your drive and overwrote the previous one. If you want to use another distribution's configuration file, you would have to reinstall GRUB through that distribution on your main drive.
In Ubuntu, for example, you can do this with grub-install
.
-
1Be careful not to assume the OP is using MBR. Even in 2016 with Windows 7, EFI was becoming more common. Now (2020) with windows 10, MBR is much less common and EFI the default. EFI does support multiple boooaders where MBR didnt.
grub install
would of course still work, but otherwise this answer might be quite misleading. Jan 19, 2020 at 12:20