Debian guest in VirtualBox

Installing a debian guest in VirtualBox is mostly trivial: you just download an iso from a Debian mirror and install as usual. This article lists a few additional packages and tips to get full functionality from your installation.

Any Version

This is valid for any version I have tested; currently lenny and squeeze.

Machine Setup

Default settings using Linux -> Debian as OS Type work out of the box. Just remember to add the installer iso to your storages on first boot and remove it afterwards.

To use mouse integration, you may want to deselect Enable absolute pointing device in the System section of the settings.

Smaller Package Selection

Since lenny, apt-get automatically installs Recommended packages beside strict dependencies; on a virtual machine you may want to save space by overriding this either with the --no-install-recommends option to apt-get or by adding the following lines to /etc/apt/apt.conf:

APT::Install-Recommends "0";
APT::Install-Suggests "0";


Not strictly VirtualBox related, but useful for single-use machines: adding the following line to /etc/inittab instead of the getty one you can autologin with user $USERNAME on tty2:

2:23:respawn:/bin/login -f $USERNAME tty2 < /dev/tty2 > /dev/tty2 2> /dev/tty2

Adding this at the end of ~$USERNAME/.profile will then start X every time the user logs on tty2:

if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty2 ]
    while true
        startx --
        sleep 10


Guest modules

# apt-get install virtualbox-ose-guest-utils

this recommends also virtualbox-ose-guest-x11, and thus various X libraries you may not want on a cli system.


If you didn't install the recommended packages above, install the x11 guest utilities:

# apt-get install virtualbox-ose-guest-x11
# apt-get install xorg xserver-xorg-input-kbd xserver-xorg-input-mouse

otherwise, you just have to add the X server:

# apt-get install xorg xserver-xorg-input-kbd xserver-xorg-input-mouse

followed by a WM/DE of your choice.


Guest modules

# apt-get install virtualbox-ose-guest-modules-2.6-686
# apt-get install virtualbox-ose-guest-utils

warning: virtualbox-ose-guest-utils depends on various X libraries.


The VBoxVideo module for xorg is already installed from the packages above, so it is enough to install the following packages:

# apt-get install xorg xserver-xorg-input-kbd xserver-xorg-input-mouse

Followed by a window manager or a desktop environment of choice.

Send a comment: unless requested otherwise I may add it, or some extract, to this page.

Return to Top