41 votes
Accepted

How to change the default Storage Pool from libvirt?

Before following the steps, be sure that you are running these commands as normal user and that your user belongs to the group libvirtd (on some systems libvirt). Here are the following commands which ...
ivanleoncz's user avatar
  • 1,721
16 votes

how to rename a VM using libvirt+KVM

virsh implemented domrename in release 1.2.19: Sep 02 2015. So the current best practice is just: virsh domrename oldname newname As you might expect, thedomain must be stopped, but also it cannot ...
reedstrm's user avatar
  • 261
12 votes

How do I make a persistent domain with virsh?

If you don't have the xml for the running vm (eg. after transient migration), you can do virsh dumpxml vm_name > vm_name.xml virsh define vm_name.xml To check: virsh list --all --persistent The ...
samesame's user avatar
  • 121
12 votes

custom dnsmasq (or custom options) with libvrt?

Libvirt v5.6.0 (2019-08-05) added support for passing custom options to dnsmasq. From the documentation: A special XML namespace is available for passing options directly to the underlying dnsmasq ...
Jonathon Reinhart's user avatar
12 votes
Accepted

How to set keyboard layout with a VNC client to KVM (libvirt)

The standard key handling in VNC protocol is a very bad match for virtualization because it involves sending X keysyms to the server. Hardware scancodes on the VNC client machine are turned into key ...
DanielB's user avatar
  • 1,708
10 votes

virt-install cannot use ISO file as location

If runing virt-install as root, it connects to qemu:///system and by default libvit will run QEMU as a qemu:qemu user/group pair. Home directories on most distros prevent any other user from seeing ...
DanielB's user avatar
  • 1,708
9 votes
Accepted

How to Restart Centos 7 KVM Host safely without corrupting guest VMs/data?

The best bet for upgrading servers is to use live migration. Have a spare host which is given a fully upgraded software stack, then live migrate all running VMs to that host. Now you can safely ...
DanielB's user avatar
  • 1,708
8 votes

How to change the default Storage Pool from libvirt?

If you just want to change the image path, you can also edit the storage path in the default pool by running: $ virsh pool-edit default The above command will open the default pool xml in an editor (...
Junaid's user avatar
  • 211
8 votes
Accepted

host port forward with qemu through libvirt in user-mode networking

the missing part from your configuration is described here: https://www.linux-kvm.org/page/Networking. You have to add another netdev with new address like so: <domain type='kvm' xmlns:qemu='http:/...
mihais's user avatar
  • 96
7 votes
Accepted

KVM/libvirt: how to migrate between 2 hosts with different CPUs

You should edit the part of the xml definition of your guest so that it contains a subset of CPU capabilities that are found in both CPUs (Intel and AMD). You can use virsh to find this subset. Here'...
ndemou's user avatar
  • 1,365
6 votes

virsh: VM console does not show any output

I've found the most applicable answer here: Suppose your virtual domain is myGuest, your preferred editor is vi, and your guest is installed with grub2 and uses systemd. If the last assumption is not ...
AbdolHosein's user avatar
6 votes

Install virt-sysprep on Ubuntu 14.04

I found out that libguestfs-tools was available and solve all my problems. Don't know how I missed that one...
André Jacques's user avatar
6 votes

custom dnsmasq (or custom options) with libvrt?

I've been in the exactly same situation, trying to configure libvirt dhcp for matchbox. For reference I was working on Fedora 25 first option is impossible due to limitations of xml parsing in ...
Michal Wasilewski's user avatar
6 votes
Accepted

Offline migrating KVM guests using virsh?

The message <domain> trying as domain NAME just means that the code is trying to lookup the guest based on its name (as opposed to UUID or ID). IOW, it is normal to see that here, no sign of ...
DanielB's user avatar
  • 1,708
6 votes
Accepted

How to move KVM image to another directory/partition?

Backup Original VM: virsh shutdown wwe virsh list --all cp /etc/libvirt/qemu/wwe.xml /etc/libvirt/qemu/orig-wwe.xml cp /kvm/vhdd/wwe.img /kvm/vhdd/orig-wwe.img Move VM image to partition /mnt/kvm: ...
Saqib Hashmi's user avatar
6 votes
Accepted

Do not start guest after virt-install

The --print-xml option to virt-install might get closer to what you want. You could then feed the XML it prints into the virsh define command to create, but not start, the guest. Alternatively ...
DanielB's user avatar
  • 1,708
6 votes

Do not start guest after virt-install

Use the option --noreboot virt-install \ .. .. --noautoconsole \ --video vga \ --memballoon none \ --noreboot UPDATE: Added the --memballoon option for those who spin up a Windows ...
MrCalvin's user avatar
  • 383
6 votes
Accepted

Disable or change port of dnsmasq service in libvirt

You can disable DNS for a network with <dns enable="no"/> in the network XML. See the documentation.
Michael Hampton's user avatar
6 votes
Accepted

Networking between KVM VM and docker container on same host

The solution was as simple as stated in the linked article. I am not sure why my configuration did not change the first time I restarted the docker daemon. After I found evidence in the Docker daemon ...
sdittmar's user avatar
  • 383
6 votes
Accepted

Libvirt has no KVM capabilities even though qemu-kvm works

Most distro libvirt packages will be configured to run qemu as qemu:qemu user. See the UID+GID reported by virsh --connect qemu:///system capabilities | grep baselabel. If that's the case for your ...
Cole Robinson's user avatar
5 votes

virsh: VM console does not show any output

systemctl enable [email protected] systemctl start [email protected] has been sufficient for an Ubuntu guest (20.04), VM been initialized with virt-manager. No need to change GRUB ...
mahatma's user avatar
  • 51
5 votes

WARNING KVM acceleration not available, using 'qemu'

This went away for me when I ran virt-install as root. Almost too simple...
mlissner's user avatar
  • 1,090
5 votes

Clone KVM virtual machine with snapshots

There are two parts to a VM - the disk image (or set of images in a snapshot chain) and the VM definitions. Cloning VM definitions can be both simple and complex. For the clone to run on another host,...
dyasny's user avatar
  • 18.9k
5 votes
Accepted

Why do I need restart a VM after restarted a bridge to get network working?

When you take the bridge down it disconnects all the attached IFs, when you bring it back up, only the IFs defined in ifcfg files (or whatever ubuntu uses instead) are added automatically. KVM guests ...
dyasny's user avatar
  • 18.9k
5 votes
Accepted

virt-install cannot use ISO file as location

Seems you're facing some permissions issues. Could not open '/home/user/Fedora-Server-dvd-x86_64-25-1.3.iso You could either give permissions to the folder /home/user, or move your file to another ...
Tolsadus's user avatar
  • 1,193
5 votes
Accepted

Cpu pinning strategy for kvm / centos7

If I understand your question correctly what you want to achieve is to restrict the hypervisor so it can only use a single CPU/core (or a limited number) for it's own processes, interrupt handling ...
HBruijn's user avatar
  • 80.3k
5 votes

How to add virtual storage as SSD in KVM

There is no mechanism in QEMU today to mark a SCSI, ATA or VirtioBlk disk as being backed by non-rotational storage. So the guest OS wouldn't do the optimal settings out of the box. As a workaround, ...
DanielB's user avatar
  • 1,708
5 votes

Terraform Libvirt - How to use local qcow2 file in the hypervisor instead of cloud images?

You will have to specify it like this: resource "libvirt_volume" "terraform-test" { name = "terraform-test.qcow2" pool = "default" source = "file:///...
Michal Muransky's user avatar
5 votes

Where are libvirt "saved states/snapshots" stored?

You can view the location of the VM block devices by using the following command: virsh domblklist VM1 The whole backing chaing of the block device can be seen: qemu-img info --backing-chain /var/...
Stuka's user avatar
  • 5,775
5 votes

Should I use "detect-zeroes" for TRIM/discard support on QEMU guests?

Modern operating systems are capable of sending TRIM/UNMAP commands to the virtual storage to free up the space, so detect_zeroes is not necessary for such OSes. The only reason I can think of to use ...
Michael Hampton's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible