$Revision: 307 $
$Date: 2007-07-28 14:08:10 +0200 (Sa, 28 Jul 2007) $
Revision History | ||
---|---|---|
Revision 21 | 28 Jul 2007 | A.E. |
Chapterized guide, with Table of Contents. | ||
Revision 13 | ? Mar 2007 | A.E. |
Seamless Mode Virtualization | ||
Revision 1 | 12 Feb 2007 | A.E. |
First public release |
Chapter 1 the section called “Introduction to VirtualBox”
Chapter 2 the section called “Scenarios”
Chapter 3 the section called “Understand what are you doing”
Chapter 4 the section called “Terminology”
Chapter 5 the section called “Basic Installation Procedure”
Chapter 6 the section called “Basic Configuration Procedure”
Chapter 7 the section called “Setting up Guest VM Additions”
Chapter 8 the section called “Intermediate Topic: Networking via Host Bridging”
Chapter 9 the section called “Advanced Topic: Seamless Mode Virtualization”
Chapter 10the section called “Advanced Topic: How-To USB + openSUSE 10.2”
Chapter 11 the section called “Backup, Restore and Porting of VMs Between Physical Machines”
Chapter 12 the section called “Troubleshooting and Tips”
Chapter 13 the section called “Licensing”
Chapter 14 the section called “Thanks”
Chapter 15 the section called “For More Information”
From original website: “InnoTek VirtualBox is a general-purpose full virtualizer for x86 hardware. Targeted at server, desktop and embedded use, it is now the only professional-quality virtualization solution that is also Open Source Software.”
VirtualBox is a full virtualization solution, that virtualizes the CPU and emulates the rest of PC hardware.
It is similar to other emulators and virtualizers, such as: Qemu/KVM/VMware Workstation/VirtualPC, but it is the only Open-Source software, that has a nice, user-friendly, Qt3-based GUI. Unfortunately, all other Open-Source solutions (Bochs/Qemu/Xen) lacking a good GUI and are not User-Friendly. So this is a huge advantage for VirtualBox.
So let's summarize some of it's current features: (as of VirtualBox 1.4.0)
User-Friendly touch
GUI (Qt3-based)
x86 on x86 full virtualization (doesn't require Vanderpool Technology, but can use if available)
Linux host has x86-64, 64-bit support.
Supports both Windows and Linux (both Host and Guest)
GuestVM additions (for Windows and Linux)
Has 2 versions: closed-source (full, also available as freeware) and open-source (OSS, GPLed)
Very fast (one of the fastest solutions available)
Stable (compared to other Open-Source solutions)
Support Multi Processing/Multi Core CPUs (on host only)
Networking (NAT+Host networking via Bridging+Internal)
Audio (OSS+ALSA)
The future release features may include:
x86-64 support on all Hosts and Guests
Mac OS X support (Host)
Solaris UNIX support (Guest)
Serial port emulation (both host and guest)
More Stablility
This software requires that both Host and Guest be x86 compatible systems.
I consider this a new era, because until now, Open-Source virtualizers lagged far behind the commercial ones in the ease-of-use and GUI areas. This is revolutionary, because it is the world's first user-frendly Open-Source virtualizer.
This is our community's chance to build a high-quality, user-frendly x86 virtualizer to counter VMware and Microsoft's VirtualPC. I call for community help (see “community” at the More Info section).
You want to run some Operating System in guest mode.
You want to test new software under different OSes for compatibility.
You want to build virtual networks.
Server Consolidation: You want to remove old physical servers, and move their functions on new hardware. It will improve server uptime, reduce power consumption, and will enable easier managing of virtual machines. Most important of all: It will save physical space -- real estate.
It is not useful for gaming, as it does not support 3D Graphics acceleration.
You are going to emulate a full PC box, all standard hardware, including: normal video card (not 3D accelerator), sound card, network card, RAM, hard disk, CD-ROM, motherboard, BIOS, and virtualize CPU.
On top of it, you will want to run a real Operating System, so make sure your host system has enough CPU power, hard disk space and RAM to handle the load. Main problem here is RAM. I do not recommend systems with less than 512 MB of RAM to even try this. 2 Gigs of RAM is more appropriate for serious use.
VirtualBox is optimized for running heavy guest OSes such as Windows 2000/XP and openSUSE. For running older operating systems, such as DOS, Windows 95/98, qemu might be a better solution.
Your real computer, on which the emulator/virtualizer software runs.
Your emulated computer, virtual machine, or VM for short, this is what you are trying to emulate. Your target. It can be the same, or very different from your real system.
For example, your host can be a Pentium III PC, while your guest can be a Sony Playstation. Of course, VirtualBox cannot emulate Playstations, so look at different software. It's just important that you understand those two basic concepts.
This technique allow conversion of commands, or instructions, one by one, by using software.
There are more optimized algorithms exists, that have different names, such as “Dynamic Recompilation”, “Virtualization”, whatever...
Those are software-optimized or hardware-optimized version of the above. As long as everything works as expected, there are no big difference to the end-user.
Note that VirtualBox is considered to be a virtualizer. However most of the system hardware is emulated, just the CPU is being virtualized. The USB and CD-ROM can be virtualized as well.
For more technical explanation, look: http://www.virtualbox.org/wiki/Virtualization.
Download VirtualBox from http://virtualbox.org/wiki/Downloads. Choose “VirtualBox for Linux Hosts” and the “openSUSE RPM” version. This will download a precompiled freeware (proprietary version, free for Personal Usage). I have decided to use this version as it has support from InnoTek, and it is feature-full.
To install from RPM, just double-click it in konqueror, select “Install Package with Yast”, it will ask for root
password, and then it will automatically install the package. This RPM has Xalan-c and Xerces-c dependencies, which are going to be automatically resolved.
Alternatively you can download the OSS version. See at “More info” at bottom of this article.
If this worked fine, please skip the next section.
If installing from RPM doesn't works for some reason, please install from multi-distro installer: Download VirtualBox from http://virtualbox.org/wiki/Downloads. Choose “VirtualBox for Linux Hosts” and the “All distributions” version. This will download a precompiled freeware (proprietary version, free for Personal Usage).
When installing from “multi-distro”, you also need to install kernel-source and gcc from Yast to compile distro-specific host-side drivers. This will be done automatically.
To actually install from “multi-distro” use:
# sh ./VirtualBox_1.4.0_Linux_x86.run install
![]() | Note |
---|---|
In my experience, this multi-distro setup is the most stable version of VirtualBox by far, in fact, it's more stable than distro-specific official and unofficial builds. |
Setup your user(s) to be part of “vboxusers” group. -> -> -> -> -> -> ->
![]() | Warning |
---|---|
This step is critical, one mistake and VirtualBox will not work ! |
Logout and log in again, to get user/group privileges described earlier to function. or reboot your system.
I recommend, that you create a virtual machines directory: (for example ~/vm
in your home directory)
tux@localhost:~> md ~/vm
This is not a strict requirement, but helps organizing once you get several dozens of VMs.
Start VirtualBox (it apeears on your SUSE/KDE menu, you can search for it, or go directly to:
-> -> -> )Configure VirtualBox to respect your ~/vm settings: “File->Global settings”, configure both VDI files and virtual machines to go to ~/vm
Create a new VM named “openSUSE”
Set OS type to “Linux 2.6” (as far as I know it doesn't really affects anything, except default RAM and Disk size)
Set Memory to 256 MB (this is how much RAM our VM will have)
Now you got to the Virtual Hard Disk creation step. Do
-> -> -> ->Great, now we almost completed basic settings for our VM.
To use a real CD-ROM drive do: Select your newly created VM:
-> -> -> -> -> ->Alternatively, you can use an ISO CD-ROM image (virtual CD-ROM) with:
-> -> -> -> ->If you have chose to install from a real DVD-ROM, then insert your openSUSE DVD now.
If you want Audio on your VM, enable it now with:
-> -> -> -> -> ->Simple Networking is enabled by default, so don't touch this setting.
Start The VM ! The install should go smoothly, so Enjoy !
After your VM has been started, you must do: "Devices->Install Guest Additions...".
![]() | Warning |
---|---|
Those are difficult to uninstall, so prior to installing, I recommend you to backup your virtual Hard Disk ! |
If your guest OS is Windows 2000 or XP, then no problems should arise.
If your guest OS is openSUSE, then your X-Server resolution may go huge due to bug in LinuxAdditions, and your system may become unmanageble. Workaround: set your video RAM to 1 MB.
In any case, a virtual CD-ROM will appear in your VM, so you can setup either VBoxGuestAdditions.exe on Windows Guest or on Linux guest do:
# sh ./VBoxLinuxAdditions.run
![]() | Note |
---|---|
That linux-sources and gcc packages are required for successful install on Linux guest. |
In previous section, I said that simple networking is already pre-configured. While true, this so-called simple networking allows for client-side connections only, but disallows me to use complex configurations for servers and virtual networks. VirtualBox has option to use Host networking, via TAP interfaces. Both TAP interfaces and bridging is meant to be provided by the host OS.
The required components, which your Host OS is required to have, are:
TAP kernel module: check for /dev/net/tun. (exists in openSUSE, pre-installed by default)
Userspace app to manage Bridges. bridge-utils. (exists in openSUSE, but must be installed). Please install it via Yast.
Userspace app to manage TAP interfaces privileges. tunctl. (not in openSUSE, must be downloaded).
As we said earlier, tunctl is not included on openSUSE DVD, but officially it is part of the distro, so could be downloaded from distro-specific repository. Also, It is part of User-Mode Linux, or UML for short, and can be downloaded from: http://prdownloads.sourceforge.net/user-mode-linux/uml_utilities_20040406.tar.bz2 The setup procedure is standard: (make sure you have gcc)
# tar xvf uml_utilities_20040406.tar.bz2 # cd tools/ # make # make install
Now you have tunctl, which is a necessary utility to manage TAP interface privileges.
Create TAP interface. Set privileges to user tux
.
# tunctl -t tap0 -u tux # ifconfig tap0 0.0.0.0 up
Create a bridge, and add interfaces to it:
# brctl addbr br0 # brctl addif br0 eth0 tap0
Start a DHCP client on your bridged interface. This will copy the MAC address from your physical eth0 interface, and will probably receive the same IP address from DHCP server. This setting is suitable for most Home Settings.
# dhcpcd br0 # ifconfig br0 up
Alternatively, you can give static IP address to your bridge interface.
Last, but not least, make sure that all interfaces (eth+tap), that are members of bridge have their IPs removed. Only the bridge interface must have an IP address.
# ifconfig eth0 0.0.0.0
Now, go to VBox GUI,
-> -> -> -> ->Congratulations ! You should have ping now, both to external world, your Host machine and your Guest machine.
This new mode allows you to get a FULL integration between openSUSE host and Windows guest via RDP. This new mode is truly *revolutionary*, first pioneered by Parralels Coherence, and a month later followed by the Open-Source response, which first appeared on Ubuntu/Qemu and later on the same month that concept was “ported” by me to openSUSE/VirtualBox !
The Original article about Seamless Mode Virtualization from Ubuntu/Qemu can be found here: https://help.ubuntu.com/community/SeamlessVirtualization
It allows you to work smarter, in a new way, and allows you to concentrate on your work getting done, rather than the OS, or the virtualizer behind it. My first experience with this technology was simply Amazing !
Normal Mode Virtualization Screenshot:
![]() |
Seamless Mode Virtualization Screenshot:
![]() |
Install rdesktop via Yast. (minimal version is 1.5, included with openSUSE. This is the Remote Desktop client for Linux.)
In the VM, that is running Windows XP Professional, log in as Administrator. Then click Start → Control Panel → System Properties. On the Remote tab, tick Allow users to connect remotely to this computer. Click OK.
You will also need to create a new user from Control Panel, with administrator privileges and password to make it work. Passwordless RDP logins won't work.
In the VM, download http://www.cendio.se/files/thinlinc/seamlessrdp/seamlessrdp.zip Extract to C:\seamlessrdp. Then log out of the VM.
Read how-to setup Host-Networking on Linux (earlier). This is required to connect to your Windows guest. Alternatively, port-forwarding can do the trick.
Execute on Linux CLI: (Host)
rdesktop -A -s "c:\seamlessrdp\seamlessrdpshell.exe C:\Windows\explorer.exe" [guest-ip]:3389 -u administrator -p password
Tip for KDE users:
-> -> -> -> ->Then click on button located in right-bottom corner. You must (!) do this in order to get XP start menu from under KDE kicker.
Start *any* Windows application from Windows Start menu, and run them side by side with Linux apps.
Catch: Your Windows must have RDP built-in: basically you need either: Windows XP Professional, Windows 2000 Server or Windows Vista Ultimate. All the cheaper Home-editions won't do, neither will Windows 2000 Pro.
Known Bugs:
Full screen apps might not work well
Fonts are uglier than in real Windows XP (maybe has something to do with ClearType disabled?)
Windows's windows sometimes hide behind Linux's KDE windows.
It works only with 16-bit color, not true color.
Windows screensaver may be a bit aggressive. Anyway, it doesn't work properly, because it's full-screen app.
Sometimes it works as if the Windows desktop takes over, and sometimes openSUSE KDE desktop takes over.
Tip: It is recommended to save all your personal data from Windows into your real Linux Hard Disk to $HOME. You can setup Windows File Sharing (SMB) to do this, or use VirtualBox' shared folders feature.
![]() | Note |
---|---|
It is possible to make it the other way around, that is, run openSUSE on Windows in seamless mode. For this, you must use Nomachine's NX Client for Windows, setup seamless NX connection to Virtual Linux Server, and call KDE kicker. |
![]() | Warning |
---|---|
This is an advanced topic, because openSUSE 10.2 lacks the needed kernel modules, which means that you have to rebuild your kernel to make USB work, which is strongly not recommended for Linux newbies. openSUSE 10.3 and future Novell products will have this kernel module built-in. |
According to Pablo Sanchez:
I was able to get USB working with openSUSE 10.2 - to be precise, someone else figured it out for VMWare and it applies for VirtualBox.
Many thanks to Alexey Eremenko for the hint on the kernel parameter which needed to be compiled.
The basic upshot is there's a security hole by doing the following so only do this on a secured machine - see https://bugzilla.novell.com/show_bug.cgi?id=210899
Slower bootup of VM:
I've noticed the VM (W2K) takes longer to boot up after this addition. On my Dell Insprion 8200 with a P4/1.6GHz chip, about an extra eight seconds. I didn't collect hard numbers and it doesn't concern me as it's only during boot up of the VM.
Preconditions:
VirtualBox must not be installed; uninstall it in order for it to 'see' the changes. You can install it before the kernel re-compilation or after.
# rpm -e VirtualBox
How to re-add USB support:
Install the following kernel packages:
- kernel-source - kernel-syms
Recompile and install the openSUSE 10.2 stock kernel with:
CONFIG_USB_DEVICEFS=y
Comment out the old 'usbfs' entry in /etc/fstab and replace it with:
/dev/bus/usb /proc/bus/usb usbfs defaults,devmode=666 0 0
![]() | Warning |
---|---|
devmode=666 will allow _anyone_ on your machine to access /dev/bus/usb; this is a security hole |
Postconditions:
Re-install VirtualBox.
![]() | Note |
---|---|
You must use the Proprietary version of VirtualBox, as the OSS-version lacks USB support. |
First of all, if you installed all your VMs to ~/vm, according to my recommendation, then the job is easier. If not, then your configuration can be found at ~/.VirtualBox/
Your VMs are combined of 3 things: The software - VirtualBox - no major need to backup this usually, as this can be downloaded from the Internet, your virtual hard disk - this is the most important thing to backup, and your VM configuration - which virtual hardware is used. Also, since the versions of VirtualBox are a bit different between Windows and Linux, I have doubt that configuration files will work anyway. This is especially true due to the fact that different machines might have different Host-Network TAP configurations.
I recommend you to save virtual Hard Disks only. I see no need to save VM configurations. This is due to my preference for a rule: 1 file = 1 VM.
Before you back-up them, you can customize according to your needs, install basic utilities, patches, optionally install Guest Additions.
Make sure you shutdown the VM normally, throught Guest OS commands (start->shutdown, or init 0), without pull-virtual-power-plug (do not just close VirtualBox, as this can damage your filesystem on virtual hard disk) and without saved states.
Search for *.vdi to find all Virtual Hard Disks. Now save all your *.vdi files somewhere, perhaps on DVDs. Optionally compress them first with zip, so the archives will be cross-platform.
When you restore your *.vdi files on some other machine, the Host OS can be different. Windows or Linux, doesn't matter.
Create new VMs, and use existing Virtual Hard Disks, from the just restored DVDs.
Interoperability Tip: This method can work for Dual-Boot systems very well. You must have all your .vdi files on NTFS partition, and access it with NTFS-3G driver. Before you restart to a different Host OS, please shutdown GuestOS properly, as described earlier. FAT32 partitions won't work, because they are limited to 4GiB per .vdi file.
To release your mouse or keyboard (to use on host computer), simply press right control key.
Hi-Resolution Video Card problem: If your guest tries to autodetect and use very high resolution, which is the case of most Linux LiveCDs, the workaround is to set VideoRAM = 1MB, as this will prevent guests going over 800x600.
Generally, I GuestAdditions for Linux are not ultra-stable
BUT if you are brave enough, and really want integration to work smoothly then: a) make sure you backup your virtual HDD, as there is no way to uninstall and going back. b) set Video RAM to 1MB as this will allow you to workaround the problem when guest tries to use hi-reolutions.
For USB support, you must use proprietary version (available as freeware).
According to Dmitriy (coldego at gmail dot com) from VirtualBox users group: in openSuSE 10.2 as host USB support will not work, because CONFIG_USB_DEVICEFS is no longer enabled, not even as a module. Perhaps you will need to upgrade your kernel (by manually compiling it).
After changing user/groups permissions, restart your system.
If you are stuck in Fullscreen mode, press Right “Ctrl+F”. Left control won't work, and this is done by design.
If you encounter bugs, check the latest version. Fortunately, this product improves stability very quickly.
Before you upgrade to any new version, it is recommended to uninstall the old one manually, by doing
# sh ./VirtualBox_1.4.0_Linux_x86.run uninstall
or for RPM version:
# rpm -e VirtualBox
Additionally, unload the driver:
# rmmod vboxdrv
Under some circumstances (usually after experimenting with Host-Networking), your default gateway might be gone from your Host routing table. To restore it manually, do:
# route add -net 0.0.0.0 gw 192.168.0.1 dev br0
If you still have trouble connecting via Host-Networking, make sure you're Firewall settings are not too restrictive. Check both Host and Guest configuration.
When backuping your VMs, small problems may arise:
a) You might have a problem of changed MAC address, so some guest OSes will install a new NIC driver for you.
b) Make sure you don't install software that requires specific CPU instructions, such as SSE. (because this will render the VM as non-portable, as not all CPUs support SSE). Fortunately, 99.9% of software don't have this issue.
c) saved state will be lost, so I recommend you to shutdown the VM properly.
If you receive: (VERR_VM_DRIVER_NOT_ACCESSIBLE), just try to reload the VirtualBox driver:
# rmmod vboxdrv # modprobe vboxdrv
and if this doesn't help, reinstall VirtualBox and restart your system.
This is a bit tricky. This product is dual-licensed under both Open-Source GPL license and a proprietary one. The proprietary version allows for free Personal Use/Educational Use (freeware version) and a commercial version with support for Enterprises.
Basically this means that you can choose which license to use.
The proprietary version has some extra features, notably:
USB Support
RDP Support
USB-over-RDP Support
iSCSI Technology
Shared folders (available only via command-line)
Thanks goes to Thomas Schraitle (thomas.schraitle at suse.de) from Novell for giving me recommendations and tips for improving my writing style and teaching me Docbook XML.
Thanks to Dmitriy (coldego at gmail.com) from VirtualBox user community for explaining the USB problem.
Thanks goes to Pablo Sanchez (pablo from http://www.blueoakdb.com) from VirtualBox user community who contributed USB how-to section to this article on 02.Mar.2007. Thanks him for his agreement to participate in LfL.
VirtualBox Home Page: http://www.virtualbox.org
More complete technical information about emulation, virtualization and paravirtualization: http://www.virtualbox.org/wiki/Virtualization
VirtualBox Community Portal: http://virtualbox.org/wiki/Community
VirtualBox Supported Guest OSes: http://www.virtualbox.org/wiki/Guest_OSes
VirtualBox Online documentation: http://www.virtualbox.org/wiki/Documentation
Toubleshooting User FAQ: http://www.virtualbox.org/wiki/User_FAQ
Another setup guide: http://www.howtoforge.com/virtualbox_fedora_centos_opensuse
Benchmark VirtualBox vs Qemu+KQemu vs VMware: http://www.linux-gamers.net/modules/smartsection/item.php?itemid=56
VirtualBox User Guide:
/opt/VirtualBox-v1.?.?/UserManual.pdf
or simply do:
-> from VirtualBox main application GUI.
VirtualBox OSS: Alternatively, there are new community OSS RPMs available: http://software.opensuse.org/download/virtualization/ or the source code can be downloaded at: http://virtualbox.org/wiki/Downloads. Installing from sources is more headache.
The following link provides the crux of the USB solution: http://www.suseforums.net/index.php?showtopic=27788
VirtualBox direct download: (including GuestAdditions ISO) http://www.virtualbox.org/download/1.4.0/
Other useful links, that discuss UML utilities and tunctl: http://user-mode-linux.sourceforge.net/dl-sf.html and http://user-mode-linux.sourceforge.net/networking.html#daemons
Original article about Seamless Mode Virtualization: (Ubuntu/Qemu) https://help.ubuntu.com/community/SeamlessVirtualization
3D Acceleration Support and why it wont happen anytime soon: http://www.virtualbox.org/discussion/1/615