3

During startup, if Ubuntu does not find itself within the UEFI Boot Order, it tries to automatically add another new entry before each other. but my UEFI setup has a setting called "Boot Order Lock", preventing any external changes to it.

Now on every boot, Ubuntu tries to add it's entry, prints "Reset System", then reboots and it starts from the beginning, since the new entry is not persisted due to the boot order locking.

This raises the question why it has to enforce a custom entry in the uefi boot order anyway during startup. I use an external SSD with a fully portable installation, which already has a custom standalone GRUB Bootloader installed, which also handles the Ubuntu startup. Therefore I simply don't want Ubuntu to insert or change anything in the boot order or prioritize itself over other boot options.

Now the system is stuck in a boot loop every time until I let it apply it's changes and insert that "ubuntu" entry as the primary boot option, over everything else. This is also not desired in cases, where it would be allowed to create an entry though, because as I said, this is a portable installation and it should never mess with the host system for any reason.

Is there any possibility to prevent this behavior entirely?

What I've found so far is:

  • running dpkg-reconfigure grub-x86_64-efi which is referred to often does not give any configuration options, the command just returns instantly
  • running dpkg-reconfigure grub-pc just asks for the desired Linux kernel parameters and nothing else
  • setting grub2/update_nvram to false via dpkg-communicate alternatively doesn't change anything either

The system in question is a Lenovo Thinkpad P15v Gen 1, also with a full Ubuntu Setup. Other than usual in these posts I don't have any Dual-Boot setup present at the moment and Windows isn't installed anywhere. Nevertheless I might add other OSes in the future, therefore simply accepting Ubuntu booting for itself with it's own GRUB install is also not acceptable for me.

Any help or advice is greatly appreciated!


EDIT 2021-09-02:
Regarding the points raised in the comments, I would like to add to my previous information to make my concern a little clearer.

My external drive has it's own EFI partition right at the beginning of the disk. The disk layout currently consists roughly of:

  • 1MiB free space (for compatibility with MBR)
  • 256 MiB EFI partition, fat32, flags: boot, hidden, esp
  • 512 MiB partition for standalone grub, fat32, flags: bios_grub
  • 32 GiB swap partition for Ubuntu, linux-swap
  • 256 GiB partition for Ubuntu, ext4
  • a whole lot of free space for later use

I'm aware of the issue with Ubuntu always writing to the first EFI partition, regardless of what I choose as target during the installation. I already worked around that by installing it from a disk-less computer with only my external drive connected.
So this is less of a problem to me, I'm sorry if I didn't made this clear enough previously. My question is actually only about the UEFI boot order and preventing Ubuntu from adding a new entry for itself and it's own root partition on every boot (which I found it does).

As you may see from my partition layout before, there is a standalone boot partition for GRUB which contains the i386-pc version of it, with the x86_64-efi version installed properly inside the EFI partition. I initially set up the disk to boot my custom GRUB by default (which also has been overwritten meanwhile, but that's another issue I guess).
My goal is to boot only from this standalone version of GRUB, idependently from Ubuntu or any OS I might add in the future.

So this is actually two issues but with the same cause:

  1. It is meant to be portable, so I don't want it to leave footprints on any system I connect it to
  2. Ubuntu adding an entry in the UEFI boot order also entirely breaks my initial idea of using a standalone GRUB installation

What I want to achieve is booting into Ubuntu, without it searching, creating or reordering any boot list entry. Is that possible?

  • You mention your Ubuntu installation is on an external drive. Does this drive have an EFI System Partition (ESP)? Add this information in your question above. – user68186 Sep 01 '21 at 20:23
  • If you have Ubuntu/grub in ESP on external drive, you should be able to set external first in boot order, and then have internal drive installs later in boot order. But full install of Ubuntu defaults to first drive's ESP. External drives always boot from drive entry in ESP on external drive, using /EFI/Boot/bootx64.efi not "ubuntu" entry. Check your fstab entry as it may want to mount internal drive's ESP, you want it to use external drive's ESP. – oldfred Sep 01 '21 at 21:33
  • @user68186 I have updated my question accordingly and provided more information about my setup. I hope my intention is now a little more understandable. – Max Schmidt Sep 02 '21 at 14:56
  • @oldfred Thanks for the tip, I did not know this way until now. Unfortunately, my question was really only about the UEFI boot order. I have already completed the installation of the system a while ago. – Max Schmidt Sep 02 '21 at 15:01
  • I thought I saw where they were going to allow both grub-pc for BIOS and grub-efi-amd64 for UEFI to be installed. You had to install one, configure system, uninstall it & install the other. You then could boot with either BIOS or UEFI, but updates got the grub configuration out of sync and only one worked. Best to be either UEFI only or BIOS only. The bios_grub partition only has to be 1MB but is not required unless using BIOS boot on gpt drive. My work arounds have been to not install grub, or install to another ESP as a throw away & update main working install''s grub to boot new install. – oldfred Sep 02 '21 at 18:32
  • I assume this is a full installation on an external drive including it's own ESP. Reinstall grub with the --removable option. Use lsblk -f to find out correct device names. Use them following this answer. When it comes to grub-install-command, then use grub-install --removable (devicename not needed). – mook765 Sep 02 '21 at 19:27
  • @mook765 The standalone version of grub is already installed with that option, but I did not try using it also for the Ubuntu installation. Thanks a lot for the suggestion, I'll try that out as soon as possible! – Max Schmidt Sep 04 '21 at 07:39

0 Answers0