Public bug reported:

Ubuntu: 26.04 LTS (Resolute), amd64
Package: grub2-common, upgrading from 2.14-2ubuntu2 to 2.14-2ubuntu2.1
systemd: 259.9-0ubuntu0.1
init-system-helpers: 1.69

Summary

The fix for LP #2156423 orders the two GRUB services correctly at normal
boot. During package configuration, however, the new grub2-common
postinst can start them concurrently. Either service can fail with
"grub-editenv: error: invalid environment block" while APT still exits
successfully.

Timelines on the same host (UTC)

APT, Nov 20:
13:54:42 - dpkg begins configuring grub2-common 2.14-2ubuntu2.1
13:54:43.318209 - systemd finishes reloading units
13:54:43.448536 - grub-initrd-fallback.service starts
13:54:43.451796 - grub2-common.service starts
13:54:43.527882 - grub2-common's grub-editenv reports "invalid environment 
block"
13:54:43.566898 - grub-initrd-fallback.service finishes successfully

Normal boot, Nov 21:
07:35:40.239370 - grub2-common.service starts
07:35:40.583237 - grub2-common.service finishes successfully
07:35:40.618028 - grub-initrd-fallback.service starts
07:35:40.744380 - grub-initrd-fallback.service finishes successfully

After the APT failure, grubenv was readable but still contained
recordfail=1. Running only the failed service later succeeded and
cleared it. On another host, the same upgrade failed in the opposite
service: fallback reported the error while grub2-common finished
successfully. We also saw overlapping starts without a failure on two
hosts, so the error is intermittent.

Suspected cause and expected behavior

The postinst calls deb-systemd-invoke restart with grub-initrd-
fallback.service first and grub2-common.service second. On systemd 259,
the two jobs are queued separately. After=grub2-common.service does not
pull in the second job, so fallback can start before it is queued. Both
services rewrite the same grubenv file via grub-editenv, which truncates
it before rewriting it. This would explain the transient invalid block.
The journals show the overlap; we did not trace the file operations.

The two services should run in order during package configuration as
well as at boot. A narrow packaging fix to evaluate is running the two
services sequentially on systemd versions without atomic multi-unit job
submission.

Related: LP #2156423 (https://bugs.launchpad.net/bugs/2156423), systemd
#8102 (https://github.com/systemd/systemd/issues/8102).

** Affects: grub2 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2175534

Title:
  grub2-common: package upgrade can still race on grubenv after the
  #2156423 boot-order fix

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/2175534/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to