bootloader/zipl: No-op if run as non-root
authorColin Walters <walters@verbum.org>
Tue, 24 Oct 2023 14:40:51 +0000 (10:40 -0400)
committerSimon McVittie <smcv@debian.org>
Mon, 6 Nov 2023 09:45:08 +0000 (09:45 +0000)
Not the most elegant fix but should get the job done.

Bug: https://github.com/ostreedev/ostree/issues/3084
Origin: upstream, 2023.8, commit:75c7e51a8bedb5edeadb9f54e84ccfff2adcc755

Gbp-Pq: Name bootloader-zipl-No-op-if-run-as-non-root.patch

src/libostree/ostree-bootloader-zipl.c

index c0a2a1450726b92843affa261e6434da1700d4e9..4579a894b169fe2d1aabb2cf0120a1bddca2748a 100644 (file)
@@ -381,6 +381,12 @@ _ostree_bootloader_zipl_post_bls_sync (OstreeBootloader *bootloader, int bootver
 {
   OstreeBootloaderZipl *self = OSTREE_BOOTLOADER_ZIPL (bootloader);
 
+  // This can happen in a unit testing environment; at some point what we want to do here
+  // is move all of the zipl logic to a systemd unit instead that's keyed of
+  // ostree-finalize-staged.service.
+  if (getuid () != 0)
+    return TRUE;
+
   /* Note that unlike the grub2-mkconfig backend, we make no attempt to
    * chroot().
    */