6

After installing a Kubuntu on a second hard drive, it changed the boot order of my main hard drive GRUB and I can't change it back since.

Any change to the grub configuration file (/etc/default/grub) applied with update-grub has no effect.

The update-grub change the /boot/grub/grub.cfg file correctly, but does not modify any file in the /boot/efi/ directory, while this should happen since the mounting point of my GRUB is boot/efi.

I thought it was due to write permission, but I checked, root has write permission over these files.

The output of the sudo update-grub command:

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.15.0-33-generic
Found initrd image: /boot/initrd.img-4.15.0-33-generic
Found linux image: /boot/vmlinuz-4.15.0-32-generic
Found initrd image: /boot/initrd.img-4.15.0-32-generic
Found Ubuntu 18.04.1 LTS (18.04) on /dev/sdb2
Adding boot menu entry for EFI firmware configuration
done

Content of the /etc/default/grub file:

GRUB_SAVEDEFAULT=true
GRUB_DEFAULT=saved
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

EDIT, IMPORTANT:

It seems like the GRUB is only affected by configuration at booting time by reading the configuration file. So, if I understand, mine is loading its configuration on the Kubuntu partition. But how can I change this behavior? This question has already been asked but not correctly answered.

Melebius
  • 11,431
  • 9
  • 52
  • 78
uben
  • 201
  • 1
  • 2
  • 6
  • You do not have to chroot, but just boot into the install you want to be default and reinstall grub from there. The actual control file is /EFI/ubuntu/grub.cfg which is just 3 lines and a configfile entry to full grub.cfg in your install. You can edit that with correct UUID. See this for details: https://askubuntu.com/questions/957914/dual-boot-14-04-17-04-lost-grub-menu/958220#958220 – oldfred Aug 28 '18 at 14:44

2 Answers2

4

I solved it by executing the grub-install command, explanations:

As said before, the GRUB is only affected by configuration at booting time by reading the configuration file. The GRUB binaries store the path to this configuration file. In order to set the correct path to the desired configuration file, it is required to update these binaries.

I managed to do it very easily by executing the sudo grub-install command from the OS where the desired configuration is stored (the command does not required any additional parameters).

Now, the GRUB is affected by any change at /boot/grub/grub.cfg.

uben
  • 201
  • 1
  • 2
  • 6
  • 1
    Welcome to Ask Ubuntu! I recommend to edit your answer to expand it with specific details about what you did. – abu_bua Aug 28 '18 at 13:35
  • I'm just getting this: grub-install: error: install device isn't specified. – Steven Lu Mar 04 '20 at 02:19
  • grub-install requires the device path, use lsblk to find your installation disk, the one with the / mount point. – uben Mar 20 '20 at 17:28
1

I have a similar problem. I have triple boot: windows 10, linux mint and ubuntu. It broke after I update linux mint from 20.3 to 21. I kept running update-grub in mint, it did show mint 21 detected (kernel 5.15.0-52) and said it updated. But the boot stayed as mint 20 and failed to load (because old kernel had been removed). ( I can temporarily updated it with "e" in grub menu.)

It turned out that grub that was effective was setup with ubuntu, which was installed before mint. I logged into ubuntu and ran "update-grub". And the grub menu was fixed.

Hope it might be useful for somebody.

zggame
  • 111