- Windows 2003, BSoD. STOP: 0x0000007B. Here is a description. You need apply this before you convert image to kvm.
- Error message that computer does not have a parallel port: "The Parallel port driver service failed to start". Read more here.
- If your Windows host was configured in KVM configuration first choose IDE drive as disk bus, add SCSI controller. When guest starts let it scan for hardware changes, that might take few minutes, when it finds SCSI controller shutdown guest and change disk bus to use SCSI controller, you can remove IDE controller.
- Uninstall virtualbox guest tools, so windows doesn't complain (see system event log).
Thursday, April 14, 2011
Troubleshooting: Windows Guest on KVM
While migrating windows virtual machine from virtualbox to kvm you might experience an issue related to significant virtual hardware changes, in other words you get BSoD (bluescreen).
Here are few findings that can help you:
Labels:
kvm
,
troubleshooting
,
virtualbox
,
windows
How to Convert VirtualBox VDI image to KVM
The idea is very simple. We convert virtualbox vdi image to raw format and than from raw format to kvm specific. I have chosen qcow2 format based on this.
- Convert img.vdi to raw format. Please note, that raw format means if your vdi image is configured for maximum size of 10 Gb than the resulting raw file will be 10 Gb. Make sure you have enough disk space.
VBoxManage clonehd --format RAW img.vdi img.raw
- And now raw image to qcow2 format. Here the resulting file (img.qcow2) will be the same size as the original one (img.vdi).
qemu-img convert -f raw -O qcow2 img.raw img.qcow2
- Delete raw file since you will not need it anymore.
Labels:
kvm
,
virtualbox
Debian KVM
Kernel-based Virtual Machine (KVM) is a virtual machine implementation using the operating system's kernel (read more here). Here are few steps to install kvm in debian:
Server
- Setup SSH. Read more here.
- Setup bridge-utils package...
apt-get install bridge-utils
... and configure network interface (restart computer so network changes take place):auto eth0 iface eth0 inet manual auto br0 iface br0 inet static address 192.168.10.11 netmask 255.255.255.0 network 192.168.10.0 broadcast 192.168.10.255 gateway 192.168.10.1 bridge_ports eth0 bridge_stp off # 1. bridge_fd 0 bridge_maxwait 0 # 2. #bridge_fd 9 #bridge_hello 2 #bridge_maxage 12 - Install qemu-kvm and libvirt-bin packages:
apt-get -y install qemu-kvm libvirt-bin
- Add a user that will be managing kvm to group libvirt (e.g. user1):
adduser user1 libvirt
Client
- Setup Password-less ssh login to kvm server. Read more here.
- Install virt-manager package:
apt-get -y install virt-manager
-
If your client is not going to host kvm virtual machines you can disable the following daemons:
update-rc.d ebtables disable update-rc.d libvirt-bin disable update-rc.d libvirt-guests disable update-rc.d lvm2 disable
- Open Virtual Machine Manager from Applications > System Tools.
- In File menu select Add Connection. In dialog that appears ensure method ssh and user that you added on server to group libvirt).
Performance Tuning
- The KVM host can take benefit of KSM by finding and sharing memory blocks between vitual machines (add the following to /etc/rc.local).
echo 100 > /sys/kernel/mm/ksm/sleep_millisecs echo 1 > /sys/kernel/mm/ksm/run
You can take a look at pages sharing / shared:cat /sys/kernel/mm/ksm/pages_sharing cat /sys/kernel/mm/ksm/pages_shared
Another useful thing is to use vhost-net kernel module to boost virtual machine network performance (ensure guest vm uses virtio network device).echo vhost-net >> /etc/modules
- The KVM linux guest IO performance can be improved by:
- using virtio as disk bus
- setting virtual disk performance options to: cache mode - none, IO mode - native
- using noop IO scheduler for each guest (file /etc/default/grub):
GRUB_CMDLINE_LINUX_DEFAULT="quiet elevator=noop"
Update grub by issuing update-grub command.
Monday, April 4, 2011
How to chroot ntp in Debian
Here are few simple steps to chroot ntp in debian. Add the following to file /usr/local/sbin/chroot-ntp and execute (alternatively you can download script from bitbucket site here):
#!/bin/bash
/etc/init.d/ntp stop
rootfs=/var/chroot/ntp
mkdir -p $rootfs/{etc,var/lib/ntp,var/log}
mv /etc/ntp.conf $rootfs/etc
ln -s $rootfs/etc/ntp.conf /etc/ntp.conf
if [ -e /var/lib/ntp/ntp.drift ]; then
mv /var/lib/ntp/ntp.drift $rootfs/var/lib/ntp
fi
ln -s $rootfs/var/lib/ntp/ntp.drift \
/var/lib/ntp/ntp.drift
chown -R ntp:ntp $rootfs/var/lib/ntp
mv /var/log/ntpstats $rootfs/var/log
ln -s $rootfs/var/log/ntpstats /var/log/ntpstats
chown -R ntp:ntp $rootfs/var/log/ntpstats
sed -e "s,'-g','-4 -i /var/chroot/ntp -g'," \
/etc/default/ntp > /tmp/x && \
mv /tmp/x /etc/default/ntp
sed -e "s,restrict -6,#restrict -6," \
-e "s,restrict ::1,#restrict ::1," \
/etc/ntp.conf > /tmp/x && \
mv /tmp/x /etc/ntp.conf
/etc/init.d/ntp start
Verify that ntp uses the chroot (file /etc/default/ntp):
NTPD_OPTS='-4 -i /var/chroot/ntp -g'
Debian NTP Server
Let start by installing few packages:
apt-get -y install ntp ntpdateThe options passed to ntp daemon are set in /etc/default/ntp file. We are interested to turn off ipv6 for now:
NTPD_OPTS='-4 -g'As well we are going restrict ntp daemon for use ipv4 only (file /etc/ntp.conf):
# By default, exchange time with everybody, but don't # allow configuration. restrict -4 default kod notrap nomodify nopeer noquery #restrict -6 default kod notrap nomodify nopeer noquery # Local users may interrogate the ntp server more # closely. restrict 127.0.0.1 #restrict ::1Restart ntp daemon so the changes take place:
/etc/init.d/ntp restartLook which servers it uses for synchronization:
ntpq -4p
Client
Install ntpdate package:apt-get -y install ntpdateYou can sync the client with you ntp server by issuing the following command (I assume your local htp server resolves to ntp.dev.local):
ntpdate -p 2 ntp.dev.localConsider have a look at the following post (you just need to substitute the ntp server name with yours).
Subscribe to:
Posts
(
Atom
)