The virtual machines provided by VirtualBox can be used to run a number of guest Operating Systems such as GNU/Linux, Windows, and others.
VirtualBox is available for Funtoo Linux on the arch profiles x86-32bit, x86-64bit and pure-64.
VirtualBox Homepage: https://www.virtualbox.org
Glossary of Terms
|Host OS||An install of Funtoo Linux on physical hardware. VirtualBox will be installed to and run from here.|
|Guest OS||The Operating System that is run within a Virtual Machine provided by VirtualBox. The Guest OS could be Funtoo Linux, another GNU/Linux distribution, Windows, etc.|
|Guest Additions||Guest Additions is a collection of applications, libraries and kernel modules/drivers that are installed in your Guest OS. These provide support for graphics, networking, and other features such as file transfer and Guest access to real physical devices such as a USB flash drive.|
Host OS Installation
VirtualBox can be installed onto your Host OS - Funtoo Linux - using one of two packages:
app-emulation/virtualbox-bin. The latter "-bin" package is a binary (precompiled) copy of VirtualBox. Installing this may be preferable on machines with low computing power.
For a typical install, run
root # emerge --ask app-emulation/virtualbox
Assign VirtualBox Users
Normal non-root users will not be able to use VirtualBox immediately after it has been installed. The Users that are to use VirtualBox must first become a member of the group
vboxusers. For example, a user alice is added to
root # gpasswd -a alice vboxusers
If currently logged in the User added to
vboxusers must first log out before the changes will have an effect.
Load VirtualBox Kernel Modules
VirtualBox requires one or more Linux kernel modules to be loaded on the Host OS (Funtoo Linux) in order to function. As of VirtualBox version 5 these are provided by the package
app-emulation/virtualbox-drivers which is installed automatically (as a dependency) when you install app-emulation/virtualbox.
As root load these modules in a terminal
root # modprobe vboxdrv root # modprobe vboxnetadp root # modprobe vboxnetflt
Each time the Host machine (Funtoo Linux) is rebooted the modules will be unloaded. The modules can be loaded automatically during system startup via OpenRC (sys-app/openrc). To achieve this, edit the file
/etc/conf.d/modules to contain the following line
modules="vboxdrv vboxnetadp vboxnetflt"
VirtualBox can be started from a terminal.
user $ virtualbox
In a Desktop Environment, VirtualBox may also be run from a menu entry. Look for the names "VirtualBox" or "Oracle xVM VirtualBox" under menu categories "System" and/or "Emulator".
Funtoo Linux (Host OS) kernel updates
The VirtualBox kernel modules are compiled for the kernel present on the Host, Funtoo Linux. Each time that the Host kernel is updated or changed, the VirtualBox kernel modules must also be rebuilt.
As is typical for most kernel changes or updates, please run
root # emerge --ask @module-rebuild
before running VirtualBox under the new kernel.
If you wish to check that the VirtualBox kernel drivers will be rebuilt in this way, please examine the file
/var/lib/module-rebuild/moduledb. For example, using the command
user $ grep virtualbox /var/lib/module-rebuild/moduledb a:1:app-emulation/virtualbox-modules-5.0.20
Guest OS Installation
Install Guest Additions
VirtualBox Guest Additions is a collection of applications, libraries and kernel modules/drivers that are installed in your Guest OS. These provide support for graphics, networking, and other features such as file transfer and Guest access to real physical devices such as a USB flash drive.
Funtoo or Gentoo Linux Guests
Following the successful installation of you Funtoo Linux Guest OS (that is within a Virtual Machine), install the package
root # emerge --ask app-emulation/virtualbox-guest-additions
Next, add your Guest OS Users to the group
vboxguest. For example, a user bob is added to
root # gpasswd -a bob vboxguest
Now add virtual-box-guest additions to the default runlevel of OpenRC.
root # rc-update add virtualbox-guest-additions default
Without having to reboot you can now start virtualbox-guest-additions within the Funtoo Guest OS with the command
root # rc
Other GNU/Linux Guests
For other GNU/Linux, please refer to VirtualBox documentation.
Microsoft Windows Guests
VirtualBox Guest Additions are installed in a Windows Guest by mounting a virtual CD-ROM image (.iso) within the guest virtual machine.
In your Host OS Funtoo Linux, confirm the version of VirtualBox installed:
user $ emerge --pretend --quiet app-emulation/virtualbox [ebuild R ] app-emulation/virtualbox-5.0.20
For VirtualBox versions 4.x (less than 5.0)
Under the earlier chapter Host OS Installation , install
app-emulation/virtualbox-bin) with the USE flag
additions enabled. This will provide the ISO necessary for installing Guest Additions within a Microsoft Windows guest.
For VirtualBox versions 5.0 and above
From version 5.0 the USE flag
additions has been removed from the package app-emulation/virtualbox. The Guest Additions ISO required for a Windows-based Guest OS is now provided in a separate package,
app-emulation/virtualbox-additions. Install this manually
root # emerge --ask app-emulation/virtualbox-additions
The package app-emulation/virtualbox-additions installs the Guest Additions ISO on your Host OS (Funtoo Linux). This is what you mount in a VM with Windows as a Guest OS. The package app-emulation/virtualbox-guest-additions is different. This is the Guest Additions that you install inside of a VM that happens to be a Guest OS of Funtoo Linux or Gentoo Linux.
The two packages perform different tasks so be sure to install the correct package!
Mount the Guest Additions ISO
/usr/share/virtualbox/VBoxGuestAdditions.iso inside of your Microsoft Windows guest. Within Windows, browse to and install VirtualBox Guest Additions.
To be able to use VRDP you have to install app-emulation/virtualbox-extpack-oracle. To verify if extpack installed and usable:
root # VBoxManage list extpacks Extension Packs: 1 Pack no. 0: Oracle VM VirtualBox Extension Pack Version: 5.2.6 Revision: 120293 Edition: Description: USB 2.0 and USB 3.0 Host Controller, Host Webcam, VirtualBox RDP, PXE ROM, Disk Encryption, NVMe. VRDE Module: VBoxVRDP Usable: true Why unusable:
Tips and Tricks
Configure Video within Funtoo Linux Guests
This section is being developed.
For Funtoo, Gentoo and other GNU/Linux Guest OS the X Window System can be optimized for running within a VirtualBox virtual machine.
In a Funtoo Linux Guest OS, modify the file
/etc/portage/make.conf to include the following line
Providing USB2, USB3, VRDP and/or PXE Boot ROM to Guest OS
This section is being developed.
Accept PUEL licence
latest releases of virtualbox have a volatile NVRAM and this makes an EFI guest boot troublesome. To workaround this following steps required:
- remove any CD images (like systemrescuecd) from the VM settings
- start the VM
- wait for the countdown or press Esc immediately to reach the EFI shell
edit startup.nshto open the full-screen editor
"fs0:\EFI\Funtoo Linux [GRUB]\grubx64.efi"(including the double quotes, since the path contains spaces)
CTRL-s(maybe twice) to save and confirm saving by pressing Enter
- quit editor by pressing
resetto reboot the machine (or kill the VM and boot it using the GUI)
- wait for the countdown or press Enter to immediately run the startup.nsh script
An alternative workaround is to rename the grub EFI binary to take advantage of the EFI default boot behavior. During installation, when installing a boot-loader, do these additional steps:
- Create a folder under
/boot/EFI/Funtoo Linux [GRUB]/grubx64.efito