Skip to content

Commit

Permalink
Ensure /run/elemental/efi is RW for upgrades
Browse files Browse the repository at this point in the history
Signed-off-by: David Cassany <dcassany@suse.com>
  • Loading branch information
davidcassany committed Feb 26, 2024
1 parent e04b8c2 commit 547cb93
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,22 @@ stages:
# enable_boot_assessment to 'yes'.
# This can be then customized easily by having a cloud-config file which always enables boot assessment on
# the boot stage.
- &remountEFIrw
name: "Mounting EFI as RW"
if: 'mountpoint -q /run/elemental/efi'
commands:
- mount -o rw,remount /run/elemental/efi
- name: "Remove GRUB sentinels"
if: '[ -f "/run/elemental/active_mode" ]'
commands:
- |
mount -o rw,remount /run/elemental/efi
grub2-editenv /run/elemental/efi/boot_assessment set enable_boot_assessment=
grub2-editenv /run/elemental/efi/boot_assessment set boot_assessment_tentative=
mount -o ro,remount /run/elemental/efi
- &remountEFIro
name: "Mounting EFI as RO"
if: 'mountpoint -q /run/elemental/efi'
commands:
- mount -o ro,remount /run/elemental/efi
- name: "Create upgrade failure sentinel if necessary"
if: cat /proc/cmdline | grep -q "upgrade_failure"
files:
Expand Down Expand Up @@ -88,6 +96,7 @@ stages:
# Here we do enable boot assessment for the next bootup.
# Similarly, we could trigger boot assessment in other cases
after-upgrade:
- <<: *remountEFIrw
- name: "Set upgrade sentinel on active"
if: '[ ! -f "/run/elemental/recovery_mode" ]'
commands:
Expand All @@ -99,8 +108,10 @@ stages:
# We do re-install hooks here if needed to track upgrades of boot assessment
- <<: *customhook
- <<: *bootgrub
- <<: *remountEFIro

after-reset:
- <<: *remountEFIrw
- name: "Remove GRUB sentinels"
commands:
- |
Expand All @@ -109,3 +120,4 @@ stages:
# Reset completely restores COS_STATE, so we re-inject ourselves
- <<: *customhook
- <<: *bootgrub
- <<: *remountEFIro

0 comments on commit 547cb93

Please sign in to comment.