update-grub does not update /boot/efi/EFI/ubuntu/grub.cfg

(EDIT 3: User error. Copied over /boot/efi/EFI/ubuntu/grub.cfg while debugging a boot problem)

After installing recently released Ubuntu 18.04 Server in UEFI Secure Boot mode the installer has put grub.cfg in this location:

  • /boot/efi/EFI/ubuntu/grub.cfg

This matches the tables created when selecting Filesystem: manual partition, which mounts the boot partion at /boot/efi (/dev/sda1).

However, sudo update-grub and sudo update-grub2 does not overwrite the grub configuration, instead updating /boot/grub/grub.cfg, i.e. a file not on the boot partition.

Question 1: Has update-grub, update-grub2 etc been superseded by some new procedure? Question 2: If not, is this a bug to be filed?

EDIT: Confused++.

  • Computer 1, actual hardware, manual portioning in installation and minor updates, e.g. sudo apt install tboot, problem can be reproduced.

  • Computer 2, vmware image: vanilla install, problem cannot be reproduced.

Both computers are UEFI Secure Boot and have same/similar partioning. the different grub.cfg experience the same update behaviour, but on the vmware image, grub respects the file /boot/grub/grub.cfg, on hardware install grub respects the /boot/efi/EFI/ubuntu/grub.cfg.

EDIT 2:

  • Computer 1 has now been re-installed both with manual filesystem portioning and then again with the original partitioning (250GB disk, 120GB used, rest left free). Neither re-install could reproduce the original problem, so basically now the problem is gone. All three installations on the computer was from the same ISO / USB stick.

I ran into this as well. To update your EFI grub.cfg, you want to do:

grub-install --efi-directory=/boot/efi

If your EFI is mounted at /boot/efi.


Just to close the loop on this query - I needed updates to /boot/efi/EFI/ubuntu/grub.cfg because I had changed the location of my /boot directory (UUID changed). update-grub doesn't update that file, but

sudo dpkg-reconfigure grub-efi-amd64

will trigger a re-write, after you have answered some questions.


blaufish notes that

the original /boot/efi/EFI/ubuntu/grub.cfg had just been a three lines file referring /boot/grub.cfg.

This three line grub.cfg is not used, at least on my grub 2.02-2ubuntu8.6 with btrfs. The 2nd line reads

set prefix=($root)'/@/boot/grub'

There is now no @ on $root, and there wasn't when grub-install was run. (@ was a zesty install that became corrupt, and deleted some time ago.) Instead, the grub path to grub.cfg is written into the grubx64.efi executable. One might see what this is by running

strings grubx64.efi | tail

I mention this because somebody might imagine, as I did once, that changing this grub.cfg to point somewhere else would be useful. I use the --boot-directory option to grub-install to set this. I have the btrfs root mounted (subvolid=5,subvol=/) at /mnt/top, and want to boot to /@grub:

--boot-directory=/mnt/top/@grub/boot

(I'm not sure this has always worked. When I first tried to set up grub independently of any install on btrfs, I had trouble, and ended up using a snapshot that I could boot from to make grub-install write what I wanted. But it's good now.)