Rootless virtual machines with KVM and QEMU

Which command / program is supposed to create folder ~/.local/share/libvirt/images? In other words, pls delete the folder, re-run the KVM installation commands, in between keep checking the folder exists yet.

For the fun of it, I used AI to create a CI script to find that out. Finding:
virsh pool-build creates the folder.

Virt Manager might create the folder but that doesn’t seem reliable. Also instructions “run Virt Manager, then go back to terminal” sounds weird. There shouldn’t need to be any dependency on Virt Manager anyhow.

According to AI research, there is also a different way without mkdir and without cp / mv.

virsh -c qemu:///session pool-create-as default dir --target "$HOME/.local/share/libvirt/images" --build
virsh -c qemu:///session vol-upload --pool default test.img ./test-src.img

But that seems quite cumbersome.


1 Like