Differences between revisions 111 and 112
Revision 111 as of 2015-02-10 13:41:33
Size: 12054
Editor: GeoffSimmons
Comment: The wheezy-backports procedure doesn't install a new kernel image, only kernel headers. virtualbox 4.3.18-dfsg-1 migrated to wheezy-backports.
Revision 112 as of 2015-04-26 07:43:26
Size: 9859
Editor: GeoffSimmons
Comment: Reorder for Jessie procedure to appear first, drop Squeeze.
Deletions are marked like this. Additions are marked like this.
Line 13: Line 13:
<<Anchor(jessie)>>
=== Debian 8 "Jessie" ===
## nb. APT installs recommended packages by default; virtualbox-dkms and virtualbox-qt are included as a result.

VirtualBox 4.3.18 is packaged for [[DebianJessie|Debian 8 "Jessie"]].

The virtualbox-* packages were moved to [[http://www.debian.org/doc/debian-policy/ch-archive#s-contrib|contrib]] at VirtualBox 4.2, as a non-free compiler (Open Watcom) is required to build the BIOS.

 1. Add the "contrib" component to {{{/etc/apt/sources.list}}}, for example: {{{
# Debian 8 "Jessie"
deb http://http.debian.net/debian/ jessie main contrib
}}}
 1. Update the list of available packages: {{{
# apt-get update
}}}
 1. Install the relevant linux-headers package and [[DebianPkg:jessie/virtualbox|virtualbox]] package, for example: {{{
# apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') virtualbox
}}}
 This will also install [[DebianPkg:jessie/virtualbox-dkms|virtualbox-dkms]] and other recommended packages. DKMS will build the VirtualBox modules for your system.

VirtualBox can now be [[#Starting|started]]. To not load the VirtualBox modules at system startup, edit {{{/etc/default/virtualbox}}} and set LOAD_VBOXDRV_MODULE to 0.
Line 46: Line 68:

VirtualBox can now be [[#Starting|started]]. To not load the VirtualBox modules at system startup, edit {{{/etc/default/virtualbox}}} and set LOAD_VBOXDRV_MODULE to 0.

<<Anchor(squeeze)>>
=== Debian 6.0 "Squeeze" ===
## nb. APT installs recommended packages by default since Lenny; virtualbox-ose-dkms and virtualbox-ose-qt are included as a result.
## There are no pre-built VirtualBox OSE module packages since Squeeze.

VirtualBox OSE 3.2.10 is packaged for [[DebianSqueeze|Debian 6.0 "Squeeze"]].

 1. Install the relevant linux-headers and [[DebianPkg:squeeze/virtualbox-ose|virtualbox-ose]] packages: {{{
# apt-get install linux-headers-2.6-$(uname -r|sed 's,[^-]*-[^-]*-,,') virtualbox-ose
}}}
 This will also install [[DebianPkg:squeeze/virtualbox-ose-dkms|virtualbox-ose-dkms]] and other recommended packages. DKMS will build the VirtualBox OSE modules for your system.

VirtualBox OSE can now be [[#Starting|started]]. To not load the VirtualBox modules at system startup, edit {{{/etc/default/virtualbox}}} and set LOAD_VBOXDRV_MODULE to 0.

<<Anchor(squeeze-backports)>>
<<Anchor(Squeeze Backports)>>
=== Debian 6.0 "Squeeze" Backports ===
## nb. APT installs recommended packages by default; virtualbox-dkms and virtualbox-qt are included as a result.

VirtualBox 4.0.10 is packaged for [[DebianSqueeze|Debian 6.0 "Squeeze"]] via [[http://backports.debian.org/|squeeze-backports]].

 1. Add [[http://backports.debian.org/|Debian Backports]] sources to {{{/etc/apt/sources.list}}}. For example: {{{
# Backported packages for Debian 6.0 "Squeeze"
deb http://http.debian.net/debian-backports/ squeeze-backports main
}}}
 1. Update the list of available packages: {{{
# apt-get update
}}}
 1. Install the relevant linux-headers package for your system, for example: {{{
# apt-get install linux-headers-2.6-$(uname -r|sed 's,[^-]*-[^-]*-,,')
}}}
 1. Install the DebianPkg:squeeze-backports/virtualbox package: {{{
# apt-get -t squeeze-backports install virtualbox
}}}
 This will also install DebianPkg:squeeze-backports/virtualbox-dkms and other recommended packages. DKMS will build the VirtualBox modules for your system.

VirtualBox can now be [[#Starting|started]]. To not load the VirtualBox modules at system startup, edit {{{/etc/default/virtualbox}}} and set LOAD_VBOXDRV_MODULE to 0.

<<Anchor(jessie)>>
=== Debian "Jessie" (testing) ===
## nb. APT installs recommended packages by default; virtualbox-dkms and virtualbox-qt are included as a result.

VirtualBox 4.3.18 is packaged for [[DebianJessie|Debian "Jessie"]].

The virtualbox-* packages were moved to [[http://www.debian.org/doc/debian-policy/ch-archive#s-contrib|contrib]] at VirtualBox 4.2, as a non-free compiler (Open Watcom) is required to build the BIOS.

 1. Add the "contrib" component to {{{/etc/apt/sources.list}}}, for example: {{{
# Debian "Jessie" (testing)
deb http://http.debian.net/debian/ jessie main contrib
}}}
 1. Update the list of available packages: {{{
# apt-get update
}}}
 1. Install the relevant linux-headers package and [[DebianPkg:jessie/virtualbox|virtualbox]] package, for example: {{{
# apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') virtualbox
}}}
 This will also install [[DebianPkg:jessie/virtualbox-dkms|virtualbox-dkms]] and other recommended packages. DKMS will build the VirtualBox modules for your system.

Translation(s): English - Русский


VirtualBox is an open source x86 emulator developed by innotek (bought by Sun, now Oracle) comparable to VMware. A proprietary extra package enhances the base experience, adding things like RDP access to the Guest. This page contains some how-to, tips and tricks when setting up and using VirtualBox.

Since version 4.0 the name suffix OSE became obsolete. All non-GPL parts are now packed in an additonal extension pack available from Oracle.

Installation

Debian 8 "Jessie"

VirtualBox 4.3.18 is packaged for Debian 8 "Jessie".

The virtualbox-* packages were moved to contrib at VirtualBox 4.2, as a non-free compiler (Open Watcom) is required to build the BIOS.

  1. Add the "contrib" component to /etc/apt/sources.list, for example:

    # Debian 8 "Jessie"
    deb http://http.debian.net/debian/ jessie main contrib
  2. Update the list of available packages:

    # apt-get update
  3. Install the relevant linux-headers package and virtualbox package, for example:

    # apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') virtualbox

    This will also install virtualbox-dkms and other recommended packages. DKMS will build the VirtualBox modules for your system.

VirtualBox can now be started. To not load the VirtualBox modules at system startup, edit /etc/default/virtualbox and set LOAD_VBOXDRV_MODULE to 0.

Debian 7 "Wheezy"

VirtualBox 4.1.18 is packaged for Debian 7 "Wheezy".

  1. Install the relevant linux-headers and virtualbox packages:

    # apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,') virtualbox

VirtualBox can now be started. To not load the VirtualBox modules at system startup, edit /etc/default/virtualbox and set LOAD_VBOXDRV_MODULE to 0.

Debian 7 "Wheezy" Backports

VirtualBox 4.3.18 is packaged for Debian 7 "Wheezy" via wheezy-backports.

The virtualbox-* packages were moved to contrib at VirtualBox 4.2, as a non-free compiler (Open Watcom) is required to build the BIOS.

  1. Add Debian Backports sources to /etc/apt/sources.list, also including the "contrib" component. For example:

    # Backported packages for Debian 7 "Wheezy"
    deb http://http.debian.net/debian/ wheezy-backports main contrib
  2. Update the list of available packages:

    # apt-get update
  3. Install the relevant linux-headers package for your system, for example:

    # apt-get install linux-headers-$(uname -r|sed 's,[^-]*-[^-]*-,,')
  4. Install the wheezy-backports/virtualbox package:

    # apt-get -t wheezy-backports install virtualbox

    This will also install wheezy-backports/virtualbox-dkms and other recommended packages. DKMS will build the VirtualBox modules for your system.

VirtualBox can now be started. To not load the VirtualBox modules at system startup, edit /etc/default/virtualbox and set LOAD_VBOXDRV_MODULE to 0.

Starting

Desktop

  • In KDE, go to: KDE menu > System > VirtualBox OSE

  • In GNOME, go to: GNOME menu > Applications > System tools > VirtualBox OSE

  • From an X terminal:

    $ virtualbox
    
    Or
    
    $ VirtualBox

Server

You can start VirtualBox in Headless mode using VBoxHeadless like this:

$ VBoxHeadless -startvm "VMName"

You should run this inside a screen instance and detach the screen after starting the VM with Ctrl+a d. At least in version 4.0.x you won't need to use screen. Just start the vm with:

$ VBoxManage startvm "VMName" --type headless

and a VBoxSVC process appears in the background. You can loggoff without problems.

Troubleshooting

The character device /dev/vboxdrv does not exist

When starting VirtualBox, the following message is shown:

  • WARNING: The character device /dev/vboxdrv does not exist.
             Please install the virtualbox-ose-modules package for your kernel and
             load the module named vboxdrv into your system.
    
             You will not be able to start VMs until this problem is fixed.

Load the VirtualBox kernel module (also load vboxnetflt in Debian Squeeze):

  • $ su
    # modprobe vboxdrv

If the module is not found, refer to Installation to provide a virtualbox-dkms* package to your system.

You are not a member of the "vboxusers" group

As stated by VirtualBox:

  • WARNING: You are not a member of the "vboxusers" group.  Please add yourself
             to this group before starting VirtualBox.
    
             You will not be able to start VMs until this problem is fixed.

Add your user account to the vboxusers group via adduser(8), as described in Installation:

  • $ su
    # adduser yourusername vboxusers

Log out and log back in to your system to apply the group membership change.

Kernel driver not installed (rc=-1908)

You receive the following message

  • The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing
    
    '/etc/init.d/vboxdrv setup'
    
    as root. Users of Ubuntu, Fedora or Mandriva should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary.

After running

  • $sudo /etc/init.d/vboxdrv setup

VirtualBox works fine until you reboot the system. This is because "vboxdrv" is not loaded during system boot.
Solution.
Make sure that you actually have these packages in your system
1) dkms;
2) build-essential;
3) linux-headers-$(uname -r)

Then, append the following line to /etc/modules

  • vboxdrv


-1909 VERR VM DRIVER NOT ACCESSIBLE

error-1909-VERR_VM_DRIVER_NOT_ACCESSIBLE.png

See You are not a member of the "vboxusers" group above.


RDP not working out of the box?

To get RDP working you need to install the VirtualBox Extensions Pack from the vendors website VirtualBox Downloads.

Simply download the extensions pack, click "File" => "Preferences" => "Extensions" => "Down arrow". Select the file you downloaded above. Click "OK". Restart VirtualBox.

Tips & Tricks

Switching consoles

The normal way to switch consoles in Linux is to use the ctrl-alt-Fx key combination. This does not work for a VirtualBox virtual machine (VM); it will switch consoles for the host system instead.

You should use <Host Key>-Fx instead, where <Host Key> is the key defined in File->Preferences->Input.

This also works for ctrl-alt-del and ctrl-alt-backspace

This is documented in the VirtualBox user manual in the section "Keyboard and mouse support in virtual machines", subsection "Typing special characters".

(An alternative method to switch between text consoles is to use alt-left and alt-right, but that does not work for graphical consoles like XOrg or DirectFB.)

How to remotely start virtual machines using VNC

Remote:

  • log onto your remote box
  • install tightvncserver

  • launch it (you don't need a display), pick a password
  • determine which port it is using, a way to do so:
    • netstat -tap | grep vnc

    • Let's say it's 5901
  • unlog from there since the server forked in the background

Local:

  • install xtightvncviewer

  • create a ssh tunnel to your box:
    • ssh -L 5901:localhost:5901 you@remote

  • use it: (note there are two colons)
    • xtightvncviewer localhost::5901

  • then VBoxManage startvm $yourvm &

  • and start as many virtual machines as wanted.

See Also

  • Alternative SystemVirtualization tools.

  • It is possible to use Veewee to automate the creation of Debian guests images for VirtualBox


ToDo:

  • Describe shared folders feature (user needs to be in vboxsf group)


CategoryPermalink