Skip to content

Instance: Mount VM volume when accessing UEFI vars while stopped - #19302

Open
LubabaKhalid wants to merge 1 commit into
canonical:mainfrom
LubabaKhalid:fix/uefi-vars-stopped-vm
Open

LubabaKhalid wants to merge 1 commit into
canonical:mainfrom
LubabaKhalid:fix/uefi-vars-stopped-vm

Conversation

@LubabaKhalid

Copy link
Copy Markdown
Contributor

Fixes #19223.

The NVRAM file lives on the VM's config volume which, on storage drivers like ZFS, is only mounted while the VM is running. lxc config uefi get/set on a stopped VM therefore read and wrote the empty mountpoint instead: changes were silently lost once the volume got mounted on start, and the leftover file made lxc delete fail with "directory not empty".

UEFIVars() and UEFIVarsUpdate() now mount the volume for the duration of the operation when the VM is stopped, as is already done when regenerating the NVRAM on boot.mode changes.

The existing test/snap/efi-vm test covers the set/unset flow but uses a dir pool, where the config volume is not a separate mount. I'm happy to extend it with a ZFS or LVM pool if that's wanted.

Checklist

…stopped

The NVRAM file lives on the VM's config volume which, on storage drivers
like ZFS, is only mounted while the VM is running. Reading or updating
UEFI variables on a stopped VM therefore accessed the empty mountpoint
instead: changes were silently lost once the volume got mounted on
start, and the leftover file made deleting the VM fail.

Mount the volume for the duration of the operation, as already done
when regenerating the NVRAM on boot.mode changes.

Signed-off-by: Lubaba Khalid <129605617+LubabaKhalid@users.noreply.github.com>
@LubabaKhalid

Copy link
Copy Markdown
Contributor Author

@mihalicyn could you take a look when you have a moment? This mounts the VM volume when UEFI variables are read or updated on a stopped VM, which fixes the lost changes on ZFS reported in the issue. Thanks!

tomponline pushed a commit that referenced this pull request Oct 19, 2026
Labels added by actions/labeler use GITHUB_TOKEN, and events created that way
do not start other workflows. The domain reviewer job therefore never saw the
labels of PRs labeled by the labeler, and the domain label check could read
the labels before the labeler applied them and add d/missing. Call both
jobs from triage after the labeler has run. The label check no longer runs
on opened and synchronize directly.

Seen on #19302, an external PR that got
labels but no reviewers.

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>

@tomponline tomponline left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UEFI variables silently ignored when VM is stopped

2 participants