Konubinix' opinionated web of thoughts

Setup Ubuntu With Vagrant

Fleeting

Setup Ubuntu with vagrant.

cd ~/test
if ! [ -e "ubuntu2004" ]
then
    mkdir ubuntu2004
fi
cd ubuntu2004
vagrant init generic/ubuntu2004
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

Then

vagrant up
Bringing machine 'default' up with 'libvirt' provider...
Error while connecting to Libvirt: Error making a connection to libvirt URI qemu:///system?no_verify=1&keyfile=/home/sam/.ssh/id_rsa:
Call to virConnectOpen failed: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory

Hmm, what now?

apt info libvirt-daemon
Package: libvirt-daemon
Version: 6.9.0-1+b2
Priority: optional
Section: admin
Source: libvirt (6.9.0-1)
Installed-Size: 1846 kB
= 2.17.2), libc6 (>= 2.28), libcap-ng0 (>= 0.7.9), libdevmapper1.02.1 (>= 2:1.02.97), libfuse2 (>= 2.8), libgcc-s1 (>= 3.3.1), libglib2.0-0 (>= 2.31.8), libnetcf1 (>= 1:0.2.2), libparted2 (>= 3.1), libpcap0.8 (>= 1.5.1), libpciaccess0, libselinux1 (>= 3.1~), libudev1 (>= 183), libxml2 (>= 2.9.2+really2.9.1+dfsg1-0.2)
= 0.9.1)
Suggests: libvirt-daemon-driver-storage-gluster, libvirt-daemon-driver-storage-rbd, libvirt-daemon-driver-storage-zfs, libvirt-daemon-system, numad
Enhances: qemu, qemu-kvm, xen
Homepage: https://libvirt.org/
Download-Size: 501 kB
APT-Sources: http://deb.debian.org/debian testing/main amd64 Packages
Description: Virtualization daemon
 Libvirt is a C toolkit to interact with the virtualization capabilities
 of recent versions of Linux (and other OSes). The library aims at providing
 a long term stable C API for different virtualization mechanisms. It currently
 supports QEMU, KVM, XEN, OpenVZ, LXC, and VirtualBox.
 .
 This package contains the daemon libvirtd to manage the hypervisors.

N: There is 1 additional record. Please use the '-a' switch to see it

Ok, let’s install this, as well as libvirt-daemon-driver-vbox libvirt-daemon-system libvirt-daemon-system-systemd.

Great, libvirt is running. Now let’s try again

vagrant up
Bringing machine 'default' up with 'libvirt' provider...
Error while connecting to Libvirt: Error making a connection to libvirt URI qemu:///system?no_verify=1&keyfile=/home/sam/.ssh/id_rsa:
Call to virConnectOpen failed: authentication unavailable: no polkit agent available to authenticate action 'org.libvirt.unix.manage'

You must be kidding me…

It looks like it could add my user to the virt group, as said in here.

Next try, and the virtual machine is running.

Notes linking here