2

After spending hours debugging a problem where systemd-boot started skipping its boot menu and in general ignoring its configuration file /loader/loader.conf (on the EFI partition), I've discovered that I can invoke the boot menu by pressing down some key at start-up, and that the problem is caused by certain EFI variable which I have apparently inadvertently created. (I do not know how this happened, but the issue appeared shortly after I re-installed Ubuntu 18.04.1 on one partition.)

In particular, I've discovered that had the variable LoaderConfigTimeout-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f set to 0 somehow, which overrode the timeout defined in /loader/loader.conf, and I also had the variable LoaderEntryDefault-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f defined, which was overriding the default menu entry set in /loader/loader.conf.

See the bottom of "systemd-boot UEFI Boot Manager" page on freedesktop.org for the list of EFI variables used by systemd-boot. Their values can be inspected with, for example

cat /sys/firmware/efi/efivars/LoaderConfigTimeout-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f

After I made the boot menu appear by pressing some key, and then pressed d twice to set and unset a new default entry, this removed my LoaderEntryDefault-... variable. However, I am still stuck with LoaderConfigTimeout-.... I know that I can change the timeout by using t T(Shift-t) keys in the menu, which modifies LoaderConfigTimeout-..., but I want to remove it altogether, so that the configuration in /loader/loader.conf be used again.

What is the correct and safe way to modify and unset EFI variables, such as LoaderConfigTimeout-...?

Alexey
  • 1,131
  • 3
  • 11
  • 25
  • Possible duplicate of [Tools to modify UEFI Variables in Windows/Linux?](https://superuser.com/questions/421415/tools-to-modify-uefi-variables-in-windows-linux) – harrymc Aug 04 '18 at 19:10
  • Similar, but somewhat confusing and not really duplicate, i think. I am asking specifically about variables visible in `/sys/firmware/efi/efivars` under Linux, not about issues with legacy/non-legacy modes. – Alexey Aug 04 '18 at 21:49

1 Answers1

3

In systemd-boot, press ShiftT or Num - enough times that the setting reaches zero, and one more time to unset it completely removing the variable.

On Linux, first use chattr -i on the /sys/… file to remove the kernel-applied protection, then use rm to delete the variable entirely.

In the UEFI Shell, use dmpstore -d <name> (with optional -guid <guid>) to delete a variable (see documentation in UEFI Shell Spec 2.0, page 113).

u1686_grawity
  • 426,297
  • 64
  • 894
  • 966
  • Indeed, i've just discovered it myself that `Shift-t` does the job for `LoaderConfigTimeout-...`. About removing arbitrary EFI variables with `chattr -i` and `rm`, how safe is it? How can I know which variables are safe to remove? See, for example, the discussion about [issue #2402](https://github.com/systemd/systemd/issues/2402) for `systemd` on GitHub. – Alexey Aug 04 '18 at 21:55
  • Search for its name and/or vendor guid. If you find documentation about what it's doing, decide whether that's an important function. If you don't, then assume it's used by the firmware for possibly critical purposes. – u1686_grawity Aug 04 '18 at 22:09