Hello,
I suppose "vagrant up" should also create storage for me right? Does Cannot access storage file '/var/lib/libvirt/images/vagrant_default.img' mean that I should have image there already? If not, could it be any permission issue?
The VM should be created and able to ssh in.
==> node1: Checking if box 'debian/stretch64' is up to date...
==> node1: Starting domain.
There was an error talking to Libvirt. The error message is shown
below:
Call to virDomainCreateWithFlags failed: Cannot access storage file '/var/lib/libvirt/images/vagrant_default.img' (as uid:0, gid:0): No such file or directory
OS/Distro version::
Ubuntu 17.10
Libvirt version:
libvirtd (libvirt) 3.6.0
Output of vagrant version; vagrant plugin list:
Installed Version: 1.9.1
vagrant-libvirt (0.0.43)
Output of VAGRANT_LOG=debug vagrant ... --provider=libvirt
........
==> node1: Starting domain.
ERROR warden: Error occurred: There was an error talking to Libvirt. The error message is shown
below:
Call to virDomainCreateWithFlags failed: Cannot access storage file '/var/lib/libvirt/images/vagrant_default.img' (as uid:0, gid:0): No such file or directory
A Vagrantfile to reproduce the issue:
Vagrant.configure("2") do |config|
config.vm.box = "debian/stretch64"
config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 1
libvirt.memory = 256
libvirt.storage_pool_name = "default"
end
end
Are you using upstream vagrant package or your distros package?
Upstream / Distro
upstream version
@ryanmusic this suggests that '/var/lib/libvirt/images/' directory does not exist or the permissions on libvirt/qemu are preventing creation of the resulting disk image with the expected user/group.
Normally this directory is owned by root, as is the parent directory and it would be up to the libvirtd service to create the missing directory though I've seen some issues in the past, so maybe you can help us pin it down.
Can you take a look at the directory tree around it:
sudo ls -la /var/lib/libvirt/
total 28
drwxr-xr-x 7 root root 4096 Aug 17 14:37 .
drwxr-xr-x 94 root root 4096 Jun 29 12:59 ..
drwx--x--x 2 root root 4096 Apr 2 2017 boot
drwxr-xr-x 2 root root 4096 Aug 20 09:24 dnsmasq
drwx--x--x 3 root root 4096 Jul 9 19:29 images
drwxr-x--- 7 libvirt-qemu kvm 4096 Jul 9 19:29 qemu
drwx------ 2 root root 4096 Apr 2 2017 sanlock
Similarly run:
sudo ls -la /var/lib/libvirt/images/
To let us see if the file is there and any permissions on this and other files.
Additionally libvirt should create some apparmor files based off of some templates under /etc/apparmor.d/libvirt/, worth listing these to see if the vagrant_default.img file is appearing in any.
Suggest dumping the contents of one of the sets of these.
Sometimes all that is needed is to install apparmor and apparmor-utils as these are used sometimes to work out the correct files to be injected into the above templates.
dpkg -l apparmor*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=============================-===================-===================-===============================================================
ii apparmor 2.10.95-0ubuntu2.9 amd64 user-space parser utility for AppArmor
un apparmor-docs <none> <none> (no description available)
un apparmor-easyprof <none> <none> (no description available)
un apparmor-easyprof-ubuntu <none> <none> (no description available)
un apparmor-parser <none> <none> (no description available)
un apparmor-profiles <none> <none> (no description available)
un apparmor-profiles-extra <none> <none> (no description available)
ii apparmor-utils 2.10.95-0ubuntu2.9 amd64 utilities for controlling AppArmor
If it turns out that all that is missing is the install of apparmor/apparmor-utils then we should probably add it as a check with warning for ubuntu/debian based hosts.
I got the same issue and I solved it with:
qemu.conf @ etc/libvirt/qemu.confexample:
# Some examples of valid values are:
#
# user = "qemu" # A user named "qemu"
# user = "+0" # Super user (uid=0)
# user = "100" # A user named "100" or a user with uid=100
#
#user = "root"
user = "stellaartuois"
# The group for QEMU processes run by the system instance. It can be
# specified in a similar way to user.
#group = "root"
group = "users"
This seems like a permissions/user/group setup for libvirt where libvirt would refuse to access the storage image for the storage image for the user until the setup was corrected.
Assuming his was corrected by the distro
Most helpful comment
I got the same issue and I solved it with:
qemu.conf@etc/libvirt/qemu.confexample: