Archive for the ‘Virtualbox’ Category

Java doesn’t like 3D support in Virtual Box

August 15th, 2010

A few days ago, I had issues installing ElasticPath on my Windows VMs : the installer’s window never showed up. At first, I suspected that the installer was simply not compatible withVirtualBox.

But things started to become really strange when I tried to debug the Java process launched by the installer (which was eating all CPU time) with Visual VM or JConsole. Both tools were unable to start.

After a quick search on Virtualbox bug tracker, here is the answer :

Any Java Swing/AWT application will crash if 3d support was selected in Virtualbox guest additions. (Virtualbox 3.2.X and Only on JVM > 1.6u6)

See this bug report for details : http://www.virtualbox.org/ticket/6873

Virtualbox : Bridged or NAT networking ?

September 24th, 2009

NAT is slightly faster than bridged networking and this gives better response time for network services.

On my server I had a 1.75 sec response time with bridged mode and only 0.85 sec with NAT.

See this previous post for NAT configuration with virtualbox.

Changing disk controller in virtualbox with linux guest

June 4th, 2009

With virtual box, you can easily change the disk controller from IDE to SATA. This is nice because SATA is supposed to be faster than IDE even in virtualization.

But after that change, your linux VM will no longer boot because grub (in my case) still refers to IDE (/dev/hda1). In order to boot , press e on grub screen and replace /dev/hda1 by /dev/sda1. This will let you boot.

If you want to make this change persistent, edit /boot/grub/menu.lst, then :

Update current config :
At the very end of the file, there are your boot configurations.

title Debian GNU/Linux, kernel 2.6.26-2-486
root (hd0,0)
kernel /boot/vmlinuz-2.6.26-2-486 root=/dev/hda1 ro quiet
initrd /boot/initrd.img-2.6.26-2-486

Make the change here. This will make the change persistent until the next kernel upgrade. THIS IS NOT ENOUGH : be sure to do the last step.

Update default config
Locate the comment line (starting with #) containing the default boot options (including the device : /dev/hda1). For my box, this is :

# kopt=root=/dev/hda1 ro

Make the change here too. This line is used to regenerate menu.lst each time apt-get dist-upgrade updates the linux kernel.

Virtualbox tips

May 4th, 2009

How to set up NAT rules :

If you need to connect to a running virtual machine from the outside, you have two solutions :

– Use the bridged network mode, where the VM gets its own IP address. But you cannot run more than one VM in this mode at the same time (at least with Virtualbox 2.2)

– Use the NAT network mode, and set-up NAT rules to redirect host ports to VM ones. There rules can be set using VBoxManage.

Type the following commands in a terminal (don’t forget to replace place holders : <MachineName> by the VM name and <customname> by anything you want).

VBoxManage setextradata <MachineName> "VBoxInternal/Devices/pcnet/0/LUN#0/Config/<customname>/HostPort" 2222
VBoxManage setextradata <MachineName> "VBoxInternal/Devices/pcnet/0/LUN#0/Config/<customname>/GuestPort" 22
VBoxManage setextradata <MachineName> "VBoxInternal/Devices/pcnet/0/LUN#0/Config/<customname>/Protocol" TCP

Taken from http://mydebian.blogdns.org/?p=111

How to reset interfaces names on Linux :

After moving a Linux virtual machine from one host to another, the ethernet interface name may change from eth0 to eth1 (or something else). This is because the MAC address of this interface changed : Linux keeps reference of all previous MAC to detect new network cards. To restore eth0, simply open this file :

/etc/udev/rules.d/70-persistent-net.rules

.. remove the line with eth0 as NAME and reboot. eth0 will be restored.

Does Virtualbox require CPU with virtualization capabilities ?

NO. Virtualbox can even run on VIA C3 processors (on 486 linux kernel for instance).

How to use virtual box on a real drive (not vdi)

April 28th, 2009

Ok, be really careful with this since you can easily lose your data :
You can boot or use a real drive (not a vdi file) with virtualbox using a VMWare disk image (vmdk).

The VMware disk image format usually stores data within a file (similar to the vdi file format) but can also use a raw device like a real drive which is what we want here.

To create a vmdk image using a raw device, you can use VBoxManage :

VBoxManage internalcommands createrawvmdk -filename /Users/myusername/Library/VirtualBox/VDI/raw-disk.vmdk -rawdisk /dev/disk0s3

A few things to know :

  • This is dangerous for your data since you can easily boot your current system drive : this will probably kill your OS install
  • You'll get access to the existing data of the disk (no format needed)
  • MBR is stored in the vmdk file, you cannot create a bootable drive this way
  • MBR is read from the vmdk file, you'll have to fix it once in virtualbox in order to boot an existing system from the disk
  • On MacOSX, you can only use a drive with no OSX readable partitions on it (ext3 is ok). If one partition is mounted, you'll not be able to create or use the vmdk image

(You'll find all details in the VirtualBox user manual)