It's best not to mix the two technologies. Here is how to fix things but break Docker.
If you do an iptables -L you will notice even if you deleted all the Docker chains that the iptables FORWARD policy is enabled and is set to drop, this causes your VMs to not have networking, at least not outside the host machine.
Chain FORWARD (policy DROP)
target prot opt source&nb........
Let's say you have a VM file that uses 200G of dynamic space, but really only has 40G in usage. If you add fles and delete, at some point the file will be larger than the current space you are using.
Take this image which shows is using 71G of space on the host:
The actual space being used inside the image is about 43G as we can see:........
For a lot of reasons, it may be convenient to detach or attach live disks to a running VM without having to reboot it. Sure, you can use some network based storage, but when performance counts, attaching a new virtual disk will usually give you better throughput and lower latency in a quick testing situation.
This doesn't work, why not?
drive_add 0 if=virtio,file=/tmp/vm.qcow2,if=virtio,format=qcow2,id=rtt
Here is the scenario, you are using QEMU/KVM and are using something like the AC97 sound driver to pass the host audio to the guest via pulseaudio. This is useful because you can transparently pass your mic input from the host which means you can mute your microphone from the host, which prevents the guest from receiving any mic input even if unmuted.
Mute / Unmute Fix
This issue also seems to happen even if you press the mute button on the microphone and then unmute,........
Just a quick note and warning is that if you are testing to see if EFIPXE booting works on a VM, MAKE SURE it actually works. For example Iinitially tested using my Distro's QEMU 2.5+dfsg-5ubuntu10.46 and ovmf BIOS firmware (OVMF supports EFI). However, I found on old versions of QEMU (like 2.5), EFIbooting with GRUB NEVER works so it may appear that you have made a mistake when everything is fine when you boot a physi........
It seems that QEMU/KVM's default PS2 mouse and keyboard doesn't work right in most cases. I have especially observed issues using Ctrl+C and Ctrl+V and in Linux you may see repeated key presses in the terminal and you will wonder why you copied something and it's not in the clipboard when you try to paste. The way to temporarily fix it is to press the key that is repeating once(works in Linux but not really in Windows).
Sometimes when moving your mouse it will also s........
How To Compile QEMU Manually (using sensible options)
1.) Download the QEMU source file you want.
2.) Extract The Source File
tar -Jxvf qemu-4.2.0.tar.xz
3.) Switch to the extracted source
4.) Make sure we have the right libraries and tools to compile QEMU manually
sudo apt install build-e........
Interestingly enough Windows 2000 works fine on QEMU 64-bit but you have to specify Pentium as your CPU otherwise it doesn't complete the install (it will not pass the detecting/setting up devices phase).
-vga cirrus is wise because it is supported by Windows 2000 and allows higher resolutions and 24-bit color.
-cpu Pentium emulates an old computer and is necessary for install to complete
-device rtl8139 is important as this oldschool Realtek 8139 NIC is supported by W........
qemu-img can convert many formats.
Here is an example of how to convert different images to different formats for QEMU-KVM
The example above converts a raw windows2019.img file from QEMU to a Virtualbox .vdi
qemu-img convert -f raw -Ovdi windows2019.img windows2019.vdi
-f raw = this means the format of the source image (instead of raw it could be vdi, vmdi, qcow2 etc..)........
In QEMU 4 or higher you can no longer use the normal "-soundhw ac97" flag and it is much more complicated but here is a simple copy and paste on Linux that will just work:
-audiodev you have to use -audiodev to specify the driver and id
-device you have to specify the same audiodev id you used in -audiodev and driver
-audiodev driver=pa,id=pa1 -devic........
/usr/libexec/qemu-kvm -enable-kvm -boot order=cd,once=dc -vga cirrus -m 4096 -drive file=~/23815135.img,if=virtio -usbdevice tablet -net nic,macaddr=DE:AD:BE:EF:D4:AB -netdev bridge,br=br0,id=net0
qemu-kvm: -usbdevice tablet: '-usbdevice' is deprecated, please use '-device usb-...' instead
access denied by acl file
qemu-kvm: bridge helper failed
[root@CentOS-82-64-minimal 23815135]# /usr/libexec/qemu-kvm -enable-kvm -boot order=cd,once=dc -vga cirrus -........
Iam going to build this based on a series of small howto QEMU / KVMposts I've made as I feel much of the information is actually hard to find and piece together from the rest of the web.
What I'm going to focus on is how to use virtio as the NIC because if you don't you get very slow NIC speeds but with the virtio NIC model you basically get host speeds.
/usr/libexec/qemu-kvm -enable-kvm -smp 8 -m 16000 -net user -net nic,model=virtio -drive file=ubuntu-gpt2l........
This is caused because the user is running as qemu for virt-resize and if qemu does not have privileges to read from the source and write to the destination, it will fail with the below. So either change the uid of qemu or change the ownership of the source and target.
virt-resize --expand /dev/sda2 /root/kvmtemplates/windows2019-eval-template.img /root/kvmguests/kvmkvmuser4515........
It's as simple as below where you just specify the dev device of the CDROM which is usually /dev/sr0. You can boot actual bootable discs like Windows, Linux, etc straight from a physical drive this way.
sudo qemu-system-x86_64 -cdrom /dev/sr0 -m 4096
sudo usermod -a -G groupname username
It's really simple like above, the -a is for append so that you are not changing their main group, but adding them to another additonal group. Just change "groupname" to your group and "username" to the user you want to be added to "groupname".
A common task these days is getting your user access to kvm for virtualization so the KVM/QEMUprocess........
This should work but the key thing is having the "-cpu host" flag.
Once you add the correct -cpu host flag then it should boot just fine on KVM.
qemu-system-x86_64 --enable-kvm -cpu host -smp 8 -m 8192 -drive format=raw,file=the-file.img
Examples can be found here on how to boot Windows properly with KVM.........
Now older versions of qemu-kvm didn't throw this error say if you just had "-video cirrus" when starting qemu-kvm. But newer versions do care.
And this probably only applies to you if you are running from bash/terminal with remote kvm images.
What you need to do is remove the "-video" part and just add -vnc :5
eg. this would fix the error:
qemu-system-x86_64 -enable-kvm -boot order=cd,once=dc -m 1024 -drive........
CPU:Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz
MOBO: Manufacturer: ASUSTeK COMPUTER INC.
Product Name: P8H61-M LX3 PLUS R2.0
This is weird but the only OS I've found this machine doesn't work with is Windows 2019 Server. Ihave no idea, when 2008, 2012 work f........
Install Errors on Version 12:
This error happened on QEMU emulator version 2.11.1 pve-qemu-kvm_2.11.1-5
on Proxmox/Debian but installing on QEMU.12 on Centos 6 did not produce the error.
*Update it is not related to the OS or QEMU version. This happened in Centos 6 too after a second install.
What really causes this even though you successfully install........
The strange thing is that usually the first install or two will work on any new machine but then it suddenly won't. I had this experience on QEMU 2.13 on a different machine. There is something finicky or buggy about the CUCM installer even when choosing the same virtual hardware specs.
QEMU PC emulator version 0.12.1 (qemu-kvm-0.12.1.2-2.506.el6_10.1), Copyright (c) 2003-2008 Fabrice Bellard
2,6,A or E is what the second digit of your MAC address must be otherwise a lot of OS's will not work. They will say the NIC is down/not connected even though it is.
This is because if the second digit is not set properly it will not view as a valid MAC or device uplink. This is especially an issue with VMs whether in QEMU etc.. if you are making your own MAC.
MAC address is invalid
To fix it just........
Pass QEMU this flag:
Or you could use (for a Ensoniq soundcard):
However on some machines I get this error:
pulseaudio: pa_simple_new for capture failed
pulseaudio: Reason: Connection terminated
pulseaudio: pa_simple_new for capture failed
pulseaudio: Reason: Connection terminated
audio: Failed to create voice `ac9........
You may have noticed if you are running QEMU/KVMmanually that in Windows the the position of the physical mouse does not match where the mouse is positioned within Windows.
There is an easy command to pass to qemu-kvm or qemu-system (whatever you call your binary):
The above flag will fix your mouse pointing problems whether you are running Windows 95, 98, NT, XP 2000, 2003, Vista, 7, 8 10 or Server 2000, 2003, 2008, 2012, 2016 or 2........
WARNING: Image format was not specified for '/mnt/space/cucm12.img' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
#you should manually specify the format
The key thing is that you must use a "machine"id of "pc-1.3" or it will say your hardware is not supported.
Additionally you MUST use a virtio disk or you will get a ks_pre.sh error as soon as the install starts (a look at logs will show it can't find a disk). This is funny because even though the OS finds the disk and an fdisk -l shows it, it looks like the script looks for a /dev/vda device (virtio) and nothing else, so if you didn't use Virtio as you........
What you need to do if you have taken a dd or real raw image dump of a hard disk:
VBoxManage convertdd windows2019-eval-template.img windows2019.vdi --format VDI
The .img is the raw dd dump and the .vdi is the output file.
--format VDIspecifies to output to .vdi format
If you are in a pinch you can always use qemu-kvm binary and manually specify the .img as your disk and i........
I tried to stop a qemu-img copy or clone and it broke everything. It was fine to "stop" it from the GUI but a process still persisted so I killed the relevant qemu-img and the kernel went crazy. It also may not have helped that I tried to lvremove a different volume (an unused disk). But either way it breaks LVM (you cannot even run lvdisplay) so a reboot is necessary.
Jan 17 06:45:21 testserver kernel: [ 5680.439337] systemd-udevd D 0&nbs........
If Proxmox won't start aVM with an error like this:
trying to acquire lock...
TASK ERROR: can't lock file '/var/lock/qemu-server/lock-102.conf' - got timeout
Then try to restart the VM and it should be good.........
1.) Create Image using qemu-img
qemu-img create -f qcow2 skype.img 40G
2.) Start VM using flags
-m = memory in MB
qemu-system-x86_64 -m 4096 -drive file=skype.img -cdrom ~/Downloads/SfB-E-9319.0-enUS.ISO
Enable Bridged Networking........
sudo apt-get install hwloc-nox
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 530 not upgraded.
Need to get 151 kB of archives.
After this operation, 453 kB of additional disk space will be used.
The Correct Way To Resize In Place
qemu-img resize kvmuserwindows2008dcetest.img +1G
Below is a common mistake that some users make they are trying to specify a new image name but it can be resized in place (just make sure the VMis NOT running and you've backed up the data in case something goes wrong).
qemu-img resize kvmuser453111.img kvmuser453111-larger.img +5G
I've read a few guides about this but they didn't work for me.
sudo apt-get install bridge-utils
#don't think the above is enough it won't work still even though you have by default an /etc/qemu-ifup that handles it if you have the right tools and setup
sudo qemu-system-x86_64 -net tap -net nic -enable-kvm -cpu host,vmx=on ~/VirtualBox VMs/vsphere-vcenter/vsphere-vcenter.vdi
W: /etc/qemu-ifup: no bridge for guest interface foun........
I can't get vmx cpu extensions to show up in Virtualbox guests despite enabling nested paging and
enable vmx in virtualbox guest but this doesn't help that you check VT-X or the AMD Virtualization SVM it enables it for the guest to use BUT does not pass it through. This means if you check cat /proc/cpuinfo in the guest you will see the CPUdoesn't support virtualization. It looks like VirtualBox still hasn't implemented this!
But there is good news I&n........
# yum -y install qemu-kvm
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror.lzu.edu.cn
* elrepo: ftp.utexas.edu
* epel: ftp.jaist.ac.jp
* extras: mirrors.aliyun.com
* openvz-kernel-rhel6: mirror.fdcservers.net
* openvz-utils: mirror.fdcservers.net
* updates: mirrors.nwsuaf.edu.cn
Thsi is very handy when doing your own kernel development.
-m specifies how much ram (in the example it is 768MB)
-kernel specifies the path to the kernel file
-net tap,ifname=tap1,script=no (the ifname=tap1 is what you need to change and setup manually).
*Run "tunctl -b" to create a tap device and use the one it gives you for ifname=
Enable networking to the outside like this:
*Note we assume that your bridge is br0 i........
libguestfs tools howto guide for managing virtual machine images.
libguestfs-tools aka guestfs tools has a lot of tools that make this very easy for you. You can easily mount partitons from an image with some of the commands below.
To mount a partition
#mount the kvmuser102821.img image and the /dev/sda1 partition from it to the local directory "mount"
guestmount -a kvmuser102821.img -m /dev/sda1 mount
./configure: cannot locate gcc 3.x. please install it or specify with --qemu-cc
yum -y install gcc make
./configure: cannot locate gcc 3.x. please install it or specify with --qemu-cc
yum -y install compat-gcc-*
Error: Could not find alsa
Make sure to have the alsa libs and headers installed.
yum -y install alsa-lib-devel
qemu-img create -f qcow2 isotest.qcow2 10G
The above creates a "qcow2" format image called "isotest.qcow2" that is 10GB in size.
If you want to preallocate all of the space for increased performance do this:
qemu-img create -f qcow2 isotest.qcow2 -o preallocation=full 10G
It is controlled with the preallocation=full option, of course by default this is set to off........
This seems to be a verified bug on KVM with no solution. I wasn't able to get through the installer with Ubuntu 12.04, it would crash while "configuring apt". I was able to install it with Ubuntu 12.10 but it crashes randomly at times.
This happens with the latest Centos 6.3 kernel and KVM package, I even compiled the latest version from the KVM website and used that, but the results are still the same.
Here's some links to discussion about the bugs:........
The example below converts youvm.img into a vdi.
The -O vdi specifies the new format will be vdi but you can use any other valid formats/vice versa.
qemu-img convert yourvm.img -O vdi yourvm.vdi
This is very handy for those who need to switch between virtualization technologies.........
Disabling PIE due to missing toolchain support
glib-2.12 required to compile QEMU
Solution install glib2
*Don't confuse glib2 with glibc, they are different and it may catch some off guard.
yum -y install glib2*
After that KVM should compile and install just fine.........
qemu-img create -b centos.5-8.x86.20120308.qcow2 -f qcow2 ../kvmguests/25000-centos5.8x86.qcow2
Formatting '../kvmguests/25000-centos5.8x86.qcow2', fmt=qcow2, backing_file=centos.5-8.x86.20120308.qcow2, size=10485760 kB
-b the source/base image
-f format is qcow2 and the location of the destination image
What is so special about this? It's even quicker than creating a template with OpenVZ but this is an actual OS.
It saves time a........
I am running a 64-bit host and was running a 32-bit XPguest which was crawling no matter what I was doing with it,in fact it frequently used 100% CPU power while having no real work load. I experienced with this other guests and wondered why KVM was slow compared to say Xen or Virtualbox.
This is because you need to use the "-cpu" flag.
For a full list of options run:
/usr/libexec/qemu-kvm -cpu ?
I wanted to Import/Use a .vmdk hard disk image file from VMWare. Generally you can just "point" VirtualBox to it and use it and it will work but I found an exception.
One of my Centos 4.4 x64 images wouldn't boot. I had two copies, an older one and the newer one. The older one booted as normal (once I changed the VirtualBox driver to IDE from SATA). The newer one stopped at the "GRUB loading" message no matter what I tried.
As far as........