Differences between revisions 154 and 155
Revision 154 as of 2021-09-02 23:25:58
Size: 12063
Comment: Remove Lucas' obsoleted repository, use Debian Fast Track for Buster and Bullseye, remove redundancy by moving the Oracle repository to its own section, refer users to Oracle's own instructions.
Revision 155 as of 2021-09-17 09:37:58
Size: 12622
Editor: ?DylanAissi
Comment: Add instructions to solve "modprobe vboxdrv failed"
Deletions are marked like this. Additions are marked like this.
Line 237: Line 237:
<<BR>>

=== Loading VirtualBox kernel modules...modprobe vboxdrv failed ===

When installing VirtualBox, the following message is shown:
 . {{{
Loading VirtualBox kernel modules...modprobe vboxdrv failed.
}}}
and ''dmesg'' give:
 . {{{
Lockdown: modprobe: unsigned module loading is restricted
}}}

It is because Secure Boot is enable, you have to sign yourself the kernel modules to be able to load them.

See instructions to sign kernel modules with a '''Machine Owner Key''' at: https://wiki.debian.org/SecureBoot#MOK_-_Machine_Owner_Key

Translation(s): English - 한국어 - Русский - Українська


Virtualbox logo

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 additional extension pack available from Oracle.

Installing VirtualBox

Debian Sid/Unstable

For Sid, VirtualBox is available in the "contrib" section of Debian, only for the amd64 architecture. It can be installed as such:

  1. Add the "contrib" and the "non-free" components to /etc/apt/sources.list, for example:

    # Debian Unstable "Sid"
    deb http://deb.debian.org/debian/ sid main contrib non-free
  2. Update the list of available packages:

     sudo apt update
  3. Install the virtualbox package, for instance:

     sudo apt install virtualbox
  4. Optionally install the extension pack with:

     sudo apt install virtualbox-ext-pack

Debian 10 "Buster" and Debian 11 "Bullseye"

Packages for VirtualBox are not officially available in stable releases of Debian, due to lack of cooperation from upstream on security support for older releases. See 794466

However, new versions of VirtualBox are made available to stable users on a "rolling" basis by Debian Fast Track, a Debian project. This is currently available for Debian 10 and 11.

  1. Add the Fast Track repository by following the instructions at https://fasttrack.debian.net/

  2. Install the VirtualBox package with:

     sudo apt install virtualbox
  3. Optionally install the extension pack with:

     sudo apt install virtualbox-ext-pack

Debian 9 "Stretch"

Packages for VirtualBox are not available in Debian 9. To install VirtualBox you must use the stretch-backports repository or the upstream third-party repository.

The version of VirtualBox in stretch-backports (5.2.24) is old and unsupported, but still available. To use it, see the instructions on https://backports.debian.org/Instructions/ (add an entry for the contrib section, not just the main section) and install with

  •  sudo apt install virtualbox

Oracle Virtualbox third-party repository

Oracle packages VirtualBox for a number of Linux distributions themselves, including Debian. These are completely unsupported by Debian, but you may find them interesting if you need a new version faster than Fast Track provides, or wish to stick close to upstream.

See Oracle's instructions on the VirtualBox Wiki.


Installing the Guest Additions on a Debian VM

This section documents installing the Guest Additions on a VirtualBox virtual machine with Debian, not a host system running VirtualBox.

If you want the Guest Additions ISO for your host, see the virtualbox-guest-additions-iso package, which is available in the "contrib" archive area on all Debian versions.

Debian Sid/Unstable

For Sid, the Guest Additions are available in the "contrib" section of Debian, only for the amd64 architecture. They can be installed as such:

  1. Add the "contrib" and the "non-free" components to /etc/apt/sources.list, for example:

    # Debian Unstable "Sid"
    deb http://deb.debian.org/debian/ sid main contrib non-free
  2. Update the list of available packages:

     sudo apt update
  3. Install the relevant packages, for instance:

     sudo apt install virtualbox-guest-x11 virtualbox-guest-dkms

Debian 10 "Buster" and Debian 11 "Bullseye"

Packages for VirtualBox's Guest Additions are not officially available in stable releases of Debian, due to lack of cooperation from upstream on security support for older releases. See 794466

However, new versions of the Guest Additions (along with the rest of VirtualBox) are made available to stable users on a "rolling" basis by Debian Fast Track, a Debian project. This is currently available for Debian 10 and 11.

  1. Add the Fast Track repository by following the instructions at https://fasttrack.debian.net/

  2. Install the VirtualBox package with:

     sudo apt install virtualbox
  3. Optionally install the extension pack with:

     sudo apt install virtualbox-guest-x11 virtualbox-guest-dkms

Debian 9 "Stretch"

There are no packages for the Guest Additions for Debian Stretch in the repositories. In order to install the prerequisites to build the Guest Additions from the VirtualBox Guest Additions ISO, follow these instructions:

1. The appropriate kernel headers and build tools:

 sudo apt install build-essential dkms linux-headers-$(uname -r)

2. Mount the Guest Additions ISO and copy VBoxLinuxAdditions.run from the ISO's location to your home folder.

3. Open a terminal and execute the following commands to install the guest additions:

 sudo chmod +x ./VBoxLinuxAdditions.run
 sudo ./VBoxLinuxAdditions.run

4. Reboot the system and the VirtualBox Guest Additions should be installed!


Starting

Desktop

  • In KDE, go to: KDE menu > System > Oracle VM VirtualBox

  • In GNOME, go to: Activities > List Applications > all (super + A) > Oracle VM Virtualbox

  • In Mate, go to: Mate menu > Applications > System tools > Oracle VM VirtualBox

  • In Xfce, go to: Application > System tools > Oracle VM VirtualBox

  • 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

Reboot 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.


Loading VirtualBox kernel modules...modprobe vboxdrv failed

When installing VirtualBox, the following message is shown:

  • Loading VirtualBox kernel modules...modprobe vboxdrv failed.

and dmesg give:

  • Lockdown: modprobe: unsigned module loading is restricted

It is because Secure Boot is enable, you have to sign yourself the kernel modules to be able to load them.

See instructions to sign kernel modules with a Machine Owner Key at: https://wiki.debian.org/SecureBoot#MOK_-_Machine_Owner_Key


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 | CategoryVirtualization | CategorySoftware