Skip to content

libvirt provider: VM fails to start with "Permission denied" on snapshot creation #13821

Description

@tomislav-varga

Summary

Snapshot creation fails with "Permission denied" error when using libvirt provider on Ubuntu, even though file permissions are correctly set. The issue appears related to improper URL-encoding of the box image filename (containing "VAGRANTSLASH" instead of forward slash).

Debug output

Full debug output available at: https://gist.github.com/tomislav-varga/1fbe48ce2bd328526b20ce684475c10d

Key error from journalctl:
libvirtd[4298]: internal error: process exited while connecting to monitor:
2026-06-14T08:38:06.896141Z qemu-system-x86_64: -blockdev
{"driver":"file","filename":"/var/lib/libvirt/images/cloud-image-VAGRANTSLASH-ubuntu-24.04_vagrant_box_image_20260518.0.0_box.img"...}:
Could not open '/var/lib/libvirt/images/cloud-image-VAGRANTSLASH-ubuntu-24.04_vagrant_box_image_20260518.0.0_box.img': Permission denied

Expected behavior

VM should start successfully and snapshots should be created without permission errors. The box image filename should be properly encoded without "VAGRANTSLASH" placeholders.

Actual behavior

When vagrant up --provider=libvirt runs and attempts to create a snapshot:

  1. Vagrant creates a box image with malformed filename: cloud-image-VAGRANTSLASH-ubuntu-24.04_vagrant_box_image_20260518.0.0_box.img
  2. QEMU fails to open the file with "Permission denied" error
  3. VM fails to start
  4. Subsequent vagrant up attempts fail with: Call to virStorageVolCreateXML failed: storage volume 'cloud-image-VAGRANTSLASH-ubuntu-24.04_vagrant_box_image_20260518.0.0_box.img' exists already

Reproduction information

Vagrant version

vagrant -v output: Vagrant 2.4.9

Host operating system

Ubuntu 24.04 LTS with libvirt/QEMU virtualization

Guest operating system

Ubuntu 24.04

Steps to reproduce

  1. Create a minimal Vagrantfile with libvirt provider and Ubuntu 24.04 box
  2. Run VAGRANT_LOG=info vagrant up --provider=libvirt
  3. Observe permission denied error during snapshot creation
  4. File permissions are correct: -rw-r--r-- libvirt-qemu kvm on the image file
  5. /var/lib/libvirt/images/ directory permissions are correct: drwx--x--x libvirt-qemu libvirt-qemu

Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "cloud-image/ubuntu-24.04"
   config.vm.box_version = "20260518.0.0"
   config.vm.synced_folder ".", "/vagrant", disabled: true

    libvirt.driver = "kvm"
    libvirt.cpu_mode = "host-passthrough"
  end
end

Additional Information

  • AppArmor: Disabled to rule out security policies - issue persists
  • File attributes: No immutable or restrictive attributes set
  • Filename issue: The presence of "VAGRANTSLASH" (likely URL-encoded %2F) in the image filename suggests a metadata/encoding bug in how Vagrant generates or references box images
  • Workaround attempted: Removing and re-adding boxes does not resolve the issue
  • libvirt version: libvirtd (libvirt) 10.0.0
  • QEMU version:
    QEMU emulator version 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.16)
    Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions