Tagged: virtualization

Exploring with Gentoo Linux (Part 4)

Part 4 - Virtualization with VirtualBox

Virtualization is one of my must haves when it comes to setting up my main workstation. This is partly because I'd like to test software in guest OS environment before I put it on my main PC, and partly because I'd like to try out different Linux distributions. But the main reason is because I need Window$ OS to access to my company's network. I wish I could use WireGuard or something available for Linux but no...

In the past, many many years ago when VMWare still offered VMWare workstation for free, I used it but this is no longer available. Then, I started using VirtualBox. VirtualBox is one of well known virtualization products for x86 and AMD64 architectures from Oracle (I think it was owned by Sun Microsystems before). It is a free to use and of charges. It's available for Linux, Mac, Solaris, and Window$.

The information in this site is the result of my researches on the Internet and of my experiences. This information below is solely used for my purpose and may not be suitable for others.


During Gentoo Linux installation, kernel configuration options should have been enabled. For details, take a look at Gentoo Wiki on VirtualBox. # emerge --ask app-emulation/virtualbox

Window$ Guest:

To get the Guest Additions ISO image that contains all necessary Windows guest drivers, install app-emulation/virtualbox-additions. # emerge --ask app-emulation/virtualbox-additions

Gentoo Linux Guest:

As mentioned before,I always try to test software that I need to install on my main PC on the guest OS environment. For that reason, I have Gentoo Linux installed as a guest OS. There may be kernel configuration requied on the Gentoo guest OS. Refer to Gentoo Wiki on Gentoo guests for more details.

Now, guest additions need to be installed on the Gentoo guest OS.# emerge --ask app-emulation/virtualbox-guest-addition

To make it persistently start across reboots, set it as default, as well as the D-bus service.# rc-update add virtualbox-guest-additions default # rc-update add dbus default

User and Group:

A user who runs VirtualBox needs to be a member of vboxusers# gpasswd -a USER_NAME vboxusers

That's all!

Slackware64: Qemu, KVM and Spice

On the other day, I wrote a bit about qemu-kvm and virt-manager. After the installation and configuration, I fired up virt-manager and Windows XP guest. Hmm... mouse movement is sluggish, moving a window leaves afterimage, and frequent freeze-up. Also, the sound doesn't seem to be working. A big disappointment.

With more digging, I found Spice. Spice (Simple Protocol for Independent Computing Environments) offers high-quality remote access to QEMU virtual machines. It's much like vnc, and is said to handle the sound better. Hmm... it sounds interesting and what's there to lose?

The information below is the result of my researches in the Internet and of my experiences. It is solely used for my purpose and may not be suitable for others.


First of all, download the spice package and its dependencies from SlackBuils.org and install them.

Creating a VM and installing Windows XP:

Prepare a virtual disk $ qemu-img create -f raw winxpvm.img 15G

Install VM enabling Spice $ virt-install \ --connect=qemu:///system \ (Use Qemu) --name=winxpvm \ (Domain name) --ram=1024 \ (Allocate 1024MB for memory) --vcpus=1 \ (Number of virtual CPUs) --os-type=windows \ (Type of OS is Windows) --os-variant=winxp \ (OS Variant is Windows XP) --hvm \ (Use full virtualization) --virt-type=kvm \ (Hypervisor to install) --cdrom=/[path_to_windows_installation_iso] \ (Virtual CD-ROM device) --disk path=/[path_to_winxpvm.img] \ (Path to storage media) --graphics spice,port=9500,listen= \ (Use Spice protocol, port number and address to listen to) --video=qxl \ (Video device. Use 'qxl' for Spice) --channel spicevmc \ (Use spicevmc channel) --soundhw ac97 \ (Attach a virtual audio device. Use 'ac97' for Spice) --accelerate (Use KVM or KQEMU in this order)

Now open another console and type the following command $ spicec -h -p 5900 -t winxpvm

By executing above command, it opens up another window with XP Installation.

Spice Guest Tools for Windows:

On Windows guest system, go to Spice Download page and download Spice Guest Tools for Windows guest for better performance and integration with Spice.

Additional binaries can be downloaded from http://www.spice-space.org/download/binaries/

PolicyKit Setup:

PolicyKit allows for more flexible, fine grained access control to the libvirt virtualization layer. Since I wanted a regular user, me!, to be able to execute the virsh command, I configured PolicyKit.

That's all!

slackware64: Installing qemu-kvm and virt-manager

I've been using VirtualBox for a while on my slackware box. It's been working ok but I recently read a couple of blogs/articles recommending KVM. They said that KVM is rapidly becoming the de facto standard for open source visualization. Interesting. So, I gave a shot with qemu-kvm with libvirt (for GUI).

The information below is the result of my researches in the Internet and of my experiences. It is solely used for my purpose and may not be suitable for others.


libvirt allows management of different virtualization solutions such as KVM and Xen through a common (programming and user) interface.
A graphical virtual machine manager
KVM (Kernel Virtual Machine)
KVM provides full virtualisation and can run unmodified Linux or Windows images, but it requires CPU virtualisation extensions (Intel VT or AMD-V).
Qemu functioning as a userspace, software-only emulation package. It can be used standalone (that is, it does not require a special kernel module, or CPU virtualisation extensions, or a hypervisor layer) and is capable of running unmodified operating system images.


The CPU needs to support virtualization in order to take advantage of qemu-kvm. To check, execute below command: $ egrep -c '(vmx|svm)' /proc/cpuinfo

If the CPU supports virtualization, you should get a non-zero value.

Or, as Daniel Berrange suggested, virt-host-validate to validate host virtualization setup: # virt-host-validate qemu QEMU: Checking for hardware virtualization: PASS QEMU: Checking for device /dev/kvm : PASS QEMU: Checking for device /dev/whost-net : PASS QEMU: Checking for device /dev/net/tun : PASS

Installation and Post-Configurations:

Install qemu-kvm, libvirt, virt-manager and their dependencies from SlackBuilds.org.

There are a few notes for post-configuration:

  • Configure libvirt for user group and permission:
    Create a group called libvirt and assign a regular user to it. Then, uncomment unix_sock_group and unix_sock_rw_perms from /etc/libvirt/libvirtd.conf # groupadd libvirt # gpasswd -a USER libvirt # vim /etc/libvirt/libvirt.conf ----------------------------------------- unix_sock_group = "libvirt" unix_sock_ro_perms = "0770" unix_sock_rw_perms = "0770"
  • Default user group for kvm:
    The qemu-kvm SlackBuild patches the installed udev rules so that you no longer are required to use the system group kvm as the default. The users group is set as the default
  • Start the libvirt daemon at boot:
    To start the ibvirt daemon at boot, add a following piece of code to /etc/rc.d/rc.local # vim /etc/rc.d/rc.local ---------------------------------------- # Start libvirt: if [ -x /etc/rc.d/rc.libvirt ]; then /etc/rc.d/rc.libvirt start fi

Now Virtual Machine Manager (VMM) can be executed via: $ virt-manager

That's all!