General Notes

ALERT! C(S)Os -- please look at the Managed DICE Guest section for best results.
ALERT! C(S)Os -- please also consider making your desktop a SimpleKVMHost for your own use.

ALERT! For performance reasons if you are going to make heavy use of a virtual machine on your desktop you should ask support to make sure that CPU Virtualisation Extensions (VT-X) are enabled in your machine's BIOS, if available (all 745s and newer). These are crucial for best performance of host and guest; their absence is implicated in some problems experienced on 745s. What's worse, they're off by default on all our standard desktop machines.

Guest OS Configuration

Login to your DICE machine as normal and start up a terminal and run the VirtualBox command. Follow the GUI Wizard to create a new virtual host and virtual disk image on the physical disk (ideally in /disk/scratch rather than your home directory for obvious performance reasons). You can then install any Guest OS from an ISO image or physical CD (eg. Fedora10 or WindowsXP). Note that you have to first mount the image file or CD to make it available to your virtual machine - use the CD menu within the VirtualBox GUI to do this.

Alternatively you can use one of the pre-built base images (such as Fedora10) and a local differencing disk, see disk images comments, below.

Network Configuration

The default virtual machine configuration uses NAT which should be fine for almost anything except if you want to run services on the Guest OS and have them accessable from other machines on the Informatics or University networks or from the internet in general. In this case you need to use Port Forwarding or Bridged Adapter. Both are described below.

For DICE guests see bridged adapter comments, below.

Port Forwarding

You can set up a service on the Guest OS and then set up the host to proxy incoming connections to that service using the command line tool VBoxManage. You will need to know which ports on the Guest OS the service uses and decide which ports to use on the physical host (often but not always you will want to use the same ports on the Guest OS and on the host). You can use any ports on the host greater than 1024 which are not already in use by a service. For example, to set up an incoming NAT connection to an http server on the Guest OS would require the following:

 $ VBoxManage modifyvm "myfc10host" --natpf1 "guesthttp,tcp,,8080,,80"

Here "myfc10host" is the name of the virtual machine as displayed in the VirtualBox interface. The number one in the argument --natfp1 refers to the first (and default) network card. The name guesthttp is an arbitrary tag chosen to identify this particular port forwarding configuration and can be anything you like. The Protocol can be either tcp or udp (these are case insensitive). With the configuration in place, all TCP connections to port 8080 on the physical host will now be forwarded to port 80 on the Guest OS. You might also have to check that your Guest OS does not apply any network filtering by default that would prevent services being run in this way. To remove a port forwarding configuration, use the following:

 $ VBoxManage modifyvm "myfc10host" --natpf1 delete "guesthttp"

and to check the current configuration use the VBoxManage showvminfo command.

Note that it is not possible to configure port forwarding while the Guest OS is running, completely shut down the Guest OS and exit the VirtualBox application first.

For more information on port forwarding please see the VirtualBox Manual page on the topic.

If you require access to these ports from outside of inf.ed.ac.uk then our first recommendation is to use the OpenVPN service.

However if you require the service to be visible to a wider audience, including many non-Informatics users, then the physical host will need filter rules added exactly as if the service was running natively on that host but based on the host port not the guest port (so 8080 for the example above). For the example above this would mean adding the following lines to the physical host machines LCFG profile (you will need to contact support to do this).

    #include <dice/options/ipfilter.h>
    !ipfilter.export mADD(8080)

ALERT! For complex port-forwarding arrangements you may be better asking support to create a self-managed profile: see below.

Bridged Adapter

Port forwarding should work in most cases, however to install a DICE Guest OS with PXE/DHCP and to use ports below 1024 you need to enable the Bridged networking option. This can be done in the VirtualBox GUI by selecting the "Network" configuration option for the virtual machine and choosing "Bridged Adapter" in place of "NAT".

ALERT! It appears that for VirtualBox 4.0 the Intel emulated network cards do not support PXE (without the PUEL-licensed "Oracle Extension Pack"), so to PXE boot you'll need to pick a non-Intel card - the AMD PCnet-PCI II and =III both seem to work. Presumably you could switch back to an Intel once installed, if desired for performance reasons.

Snapshots

Snapshots are unlikely to work (or give desirable performance or reliability) if stored in your home directory. To make sure they are created on local disk only, you can alter their default location: In each Virtual Machine's "settings" dialog, you are offered a choice of location

  • Right-click on the guest you wish to configure and choose "settings"
  • In the "general" section click on the "advanced" tab.
  • Snapshot location can be changed to /disk/scratch/ (for example).

Useful Commands

Start a 'headless' VM:

 VBoxHeadless -s <machinename> -p <port>

(you may then connect to the VM console using RDP:

 rdesktop localhost:<port>

ALERT! Though note that as of VirtualBox 4.0 the VRDP server only appears to work where the PUEL-Licensed Oracle Extension Pack has been installed.

Safely shut down a VM (equivalent to touching the soft power button on the PC):

 VBoxManage controlvm <machinename> acpipowerbutton

Specific Platform configuration

Managed DICE Guest OS

ALERT! This information is primarily for support, end-users are not able to run a virtual DICE desktop.

Creating your DICE VM profile

To create a virtual managed DICE machine you will need to create a normal LCFG profile for it. First create a virtual machine via VirtualBox with a suitably sized disk and using the "Bridged Adapter" network option as described above. Then create the LCFG profile, it should look something like below.

   /* topcatvbsl5 is topcat via virtualbox */

   #define FIRST_INSTALL  /* you'll want this if you've just created a new empty virtual disk */
   #define DICE_HW_VIRTUALBOX_SATA
   #define LCFG_HW_VIRTUALBOX_ADDITIONS
   #include <dice/os/sl5.h>
   #include <dice/hw/virtualbox.h>
   #include <dice/options/office-forum.h>
   #include <live/wire_forum.h>

   dhclient.mac 08:00:27:B4:FF:19

   /* End of file */

Points to note:

  • don't forget to add the hostname to dns before installing
  • the profile was named after the physical host name purely for convenience, it could be anything
  • make sure to use dice/hw/virtualbox.h to get the correct disk and video configuration.
  • any other specific hardware options headers are unlikely to work!
  • the MAC must match the MAC as generated (or specified) for the Guest OS accessable the VirtualBox interface (or you can use the command VBoxManage showvminfo "myfc10host" for example)
  • if you do not wish to use a SATA disk, remove the DICE_HW_VIRTUALBOX_SATA macro above -- but it's no longer recommended to do so.
  • Note the LCFG_HW_VIRTUALBOX_ADDITIONS macro, which allows the guest to install guest additions. This is recommended for hosts where console access is required, but makes less difference to hosts accessed mainly via network.

You should now be able to start the Guest OS and press F12 to select boot device and do a DICE installation from CD, ISO image or LAN via PXE and install DICE (in this case SL5) entirely as normal.

DICE Disk configuration

On SL5 guests, PATA disks were preferred due to the developing nature of the SATA support in earlier version of VirtualBox. However for all modern guests and hosts, a Guest SATA disk is preferred. This can be configured from the Storage section of the guest settings, and involves simply adding a new SATA (AHCI) Controller and placing the primary volume on this controller.

In the guest DICE configuration, specify that SATA is to be used with the DICE_HW_VIRTUALBOX_SATA macro. This macro is applied by default on SL6 guests, but must be specified on all others.

Metavirtualisation

VirtualBox (and VMWare) guests are prohibited by default from installing VirtualBox, as nested Virtualisation is not recommended (to say the least). However, where this is required, it can be re-enabled by definition of the DICE_OPTIONS_METAVIRTUALISE macro.

Serial Console

It is possible to create a virtual serial device on the guest which allows serial console (including installation) without access to the VirtualBox front-end or use of the VRDP server.

You'll need to add the serial console headers to your guest, as you would any other serial consoled machine:

  #define LCFG_OPTS_SERIALCONSOLE_BAUD 115200
  #include <dice/options/serialconsole.h>

You can configure the virtual machine either by GUI or by the CLI VBoxManage tool:

GUICLI

In the VM configuration, enable the first Serial device as COM1 with default values, then set its type to "Host Pipe" (unchecking the "create file" option).

Beneath this, provide a socket path to be used by socat (as below), for example /tmp/<guestname>.socket, where <guestname> is the name of the virtual machine.

Alter an existing machine with these lines (or add them to a creation script):

  $ VBoxManage modifyvm <guest> --uart1 0x3f8 4
  $ VBoxManage modifyvm <guest> --uartmode1 client /tmp/<guest>.socket

To make use of the serial console, before launching your guest you'll need to run a socket listener:

  $ socat unix-listen:/tmp/<guest>.socket pty,link=/tmp/<guest>.pty &

To use this serial link, you can connect 'screen' to the generated pty now or at any later point:

  $ screen /tmp/<guest>.pty

See man screen for details of its use, but for those who find themselves stuck within the terminal, issue Ctrl+A, Ctrl+D to get back out safely.

''Notes'':

  • Once configured, the .socket file must exist to launch your Guest, and if you want to use the serial device you must also have socat listening from before the VM launches. There are alternative configurations without this requirement, but VirtualBox does not tolerate them so well (including sending itself spurious input on the serial line, which could be harmful).
  • BIOS-level stuff isn't forwarded but, given that there's no real configuration to be had, you're not really missing anything...

Windows Managed Desktop (MDP) Guest OS

ALERT! This information is primarily for support; end-users are not able to setup a virtual MDP desktop.

_Not sure whether these things are known as MDP or MDT these days. Feel free to search & replace with the correct abbreviation, mentally or literally, when reading through._

Host Networking Configuration

Firstly, do not forget to tag your machine's port with your local MDP VLAN if necessary. If you are in a portion of the network where DICE and MDP share a VLAN then you may skip this section.

Once your port begins supplying the correct flavour of packets, you may configure your Host's VLAN adaptor: this will be the "physical" device to which your MDP guest binds.

An example of the machine resources required for this (for a machine on the IF DICE wire) follow:

network.hwaddr_eth0             <%dhclient.mac%>  /* probably unnecessary! */
!network.interfaces             mADD(vlan224)
network.physdev_vlan224         eth0
network.vlan_vlan224            yes
network.hostname_vlan224        <%profile.node%>-mdt

You might not need to restart at this point, but you may as well.

Guest Configuration

Create your guest profile as you would any other MDP machine. Ensure that the machine is entered into the EdLAN database just as a physical machine.

The guest profile will be similar to a regular machine. In the Forum, this would be something along the lines of:

/* nodenamevb1 - VirtualBox guest */

#include <dice/os/managed-desktop.h>
#include <dice/hw/virtualbox.h>

dhclient.mac             08:00:27:xx:xx:xx /* VirtualBox-assigned MAC */
dhclient.cluster         dhcp/all
dhclient.hostname        nodenamevb1.inf.ed.ac.uk

/* End of file */

Note the hw/virtualbox.h header which at present does very little for an MDP guest, but may do more in the future. Note also the MAC address, which is VirtualBox's generated (or assigned) MAC just as it would be for a DICE guest.

VirtualBox Settings

The following settings will work and are probably appropriate (but not mandatory) for an MDP host:

  • Base Memory: at least 512Mb, more if comfortable.
  • Video Memory: at least 8Mb
  • 3D Acceleration: Untested.
  • Boot Order: HD, Network
  • Extended Features: ACPI, VT-x, PAE/NX
    • Nested paging is not supported yet; IO ACIC causes slowness and clock skew.
  • IDE Controller: PIIX4.
  • HD Controller: PATA works. SATA preferred but installation with SATA untested (reports welcome)
  • Audio: As yet untested: ICH met with no success yet.
  • Network: Intel (Desktop) card in Bridged mode (though see the VirtualBox#Bridged_Adapter notes above)
    • Remember also to attach this to the appropriate network adaptor: in the Forum this will be your VLAN adaptor.

ALERT! Running SL6 DICE on VBox 4, sound seems to work with Host Audio: PulseAudio and Controller: ICH AC97 - neilb

Installation Notes

This resembles a normal "PIE" installation, and can be performed using PXE. Only a few snags:

  • PIE boot reports that an LCFG profile cannot be found for your MDP guest. This can be ignored.
  • At one point the Windows installer may crash or hang, but if it does not reset automatically, no more than a reset is required to allow the installer to complete.

Disk Images

There are some pre-built disk images that can be used as a starting point for a Guest rather than installing from scratch. Using a pre-built disk image is also useful if you don't have sufficient space to store the entire base image which can be many gigabytes in size. Although the pre-built disk images are immutable, the local differencing disk image can be made writeable (changes are written to a local differencing disk file which is a fraction the size in general of the base disk image). Currently the following pre-built disk images are available:

  • Fedora12 (username = f12user, password = f12userpw, root password = f12rootpw), filename = Fedora12Base.vdi
  • Fedora10 (username = f10user, password = f10userpw, root password = f10rootpw), filename = Fedora10Base.vdi
  • Ubuntu 9.04 (username = vboxuser, password = TestUser, root password = n/a), filename = UbuntuJaunty.vdi
  • Debian 5.0.1 (username = vboxguest, password = vboxLenny, root password = vboxLennyRoot), filename = DebianLenny.vdi

In order to use one of the images above in a virtual machine first update your local configuration to set the base disk as immutable (it won't be writeable anyway but VirtualBox needs to be told this explicitly). Do this using

VBoxManage modifyhd /afs/inf.ed.ac.uk/group/rat-unit/images/Fedora10Base.vdi --type immutable

where the .vdi file is the one corresponding to the base disk image you want to use. Then start VirtualBox and create a new machine following the Wizard as normal but don't create a new virtual disk, instead browse to select the base image file (name as above) from the directory /afs/inf.ed.ac.uk/group/rat-unit/images. Then configure and start up your virtual machine as normal. Once the Guest has booted up, choose the Machine menu option on the Guest window and then choose ACPI Shutdown to cleanly shutdown the Guest. A new differencing disk image should have been created in ~/.Virtualbox/Machines/*GUESTNAME*/Snapshots/{*ID*}.vdi. Now using VBoxManage configure that image to preserve changes by doing

VBoxManage ~/.VirtualBox/Machines/Fedora10/Snapshots/\{c1fba93f-f2c4-4176-a096-e8169d16207f\}.vdi --autoreset off.

Now you should be able to use your virtual machine as normal, any changes to the disk image will be preserved in this local file.

-- TimColles - 31 Jan 2008 -- GrahamDutton - Apr 2012

Topic revision: r37 - 25 Apr 2012 - 16:09:06 - GrahamDutton
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
This Wiki uses Cookies