0

I’m dual booting two Ubuntu Linux distributions. There was made only one boot entry for both of them:

Boot000A* ubuntu

Since the second one (not often used) was installed after my primary distro (used daily), kernels are not automatically updated within that distro through “sudo update-grub”. I have to login to other ubuntu distro, type “update-grub” to be able to use newly updated kernels from my primary distro.

How can I make my main ubuntu distro’s grub entry to be default one and not secondary (UEFI) ?

banuy
  • 231
  • Each linux have its' own kernel, but when installed, both linuxes share one single grub. Grub is just a bootloader, and you can install as many linuxes as you want on a single device, and all of them will still share one single GRUB. You can edit the GRUB menu by installing this: sudo apt-get install grub-customizer. You have to update each linux (and kernel) separately, but you have to update GRUB only one time, from either linux you want (no particular importance which one). – ipse lute Jun 28 '16 at 18:22
  • Like I said, if I could just update grub and be able to use updated kernels from both ubuntu derivatives without going to another distro (that was installed after first one), I would’ve not asked this question. This might be a bug then. I would like to do this from terminal. – banuy Jun 28 '16 at 19:23

2 Answers2

0

In your ESP - efi system partition is a 3 line grub that is a configfile entry to the full grub in your install. I have multiple installs of Ubuntu and quickly learned to back up ESP, but more importantly backup grub.cfg in ESP. You can easily edit that grub.cfg if you know partition and UUID, just by changing entries to correct ones for your main working install.

sudo blkid

Entry will look like this which is mine with my UUID & hd0,gpt6

fred@Asusz97:~$ cat /boot/efi/EFI/ubuntu/grub.cfg
search.fs_uuid 255a2800-b871-4fdf-a809-16987e64b8b3 root hd0,gpt6 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

If you have not run Boot-Repair or manually edited fstab, you may not be able to edit that grub.cfg. Ubuntu changed from defaults to 0077

/boot/efi was on /dev/sda1 during installation 14.04 fstab entry defaults

UUID=FD76-E33D  /boot/efi       vfat    defaults        0       1

16.04 fstab entry umask=0077

UUID=68CD-3368  /boot/efi       vfat    umask=0077      0       1

sudo nano /etc/fstab

Edit fstab and change umask=0077 to defaults and reboot. The sudo mount -a should be run to confirm no typos, but will not remount the efi partition, only reboot will.

Then you can edit grub.cfg

sudo nano /boot/efi/EFI/ubuntu/grub.cfg

You probably want to edit fstab in both installs and make backups of entire ESP and grub.cfg. I typically create new folder in ESP as copy of /boot/efi/EFI/ubuntu to version.

fred@Asusz97:~$ ls -l /boot/efi/EFI
total 24
drwxr-xr-x 2 root root 4096 Apr 15 13:54 asus_ar
drwxr-xr-x 2 root root 4096 Jun 22 12:13 Boot
drwxr-xr-x 3 root root 4096 Jun 24 17:43 mate
drwxr-xr-x 2 root root 4096 Apr 23  2015 trusty
drwxr-xr-x 3 root root 4096 Jun 23 13:57 ubuntu
drwxr-xr-x 2 root root 4096 Sep 27  2015 xenial

I then turn off os-prober, so grub does not add other installs by searching system.

Skip Grub at boot

And add my own boot stanza's to 40_custom to boot link to newest kernel in all my other installs. Then I do not have to run sudo update-grub twice and reboot multiple times.

https://help.ubuntu.com/community/Grub2/CustomMenus

https://help.ubuntu.com/community/Grub2/Setup#Specific_Entries

oldfred
  • 12,100
  • Is there any simple way to overwrite grub setting in my main distro, issuing some simple command (reverse the position between two distros) ? – banuy Jun 28 '16 at 22:51
  • Editing file is not all that difficult. But you can do a full uninstall reinstall from the install you want to primarily use. Possibly easier to use Boot-Repair to do that and you can run it from either install but specify main install, I think. You still may have to reboot at least once for Boot-Repair's edit of fstab to take hold. – oldfred Jun 28 '16 at 22:54
0

I have found the answer to my question in here.

I had to reinstall grub:

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

then I was asked:

A new version of configuration file /etc/default/grub is available, but the version installed currently has been locally modified.

What do you want to do about modified configuration file grub?

  • install the package maintainer's version (*)
  • keep the local version currently installed
  • show the differences between the versions

I have chosen first option, and my primary distro's grub became main again.

banuy
  • 231