Difference between revisions of "Package:VirtualBox"

From Funtoo
Jump to navigation Jump to search
(guide updating)
(guide updating (host os))
Line 20: Line 20:
{{TableEnd}}
{{TableEnd}}


= Host OS =
= Host OS Installation =
== Installation ==
VirtualBox can be installed onto your Host OS - Funtoo Linux - using one of two packages: {{c|app-emulation/virtualbox}} or {{c|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.
VirtualBox can be installed onto your Host OS - Funtoo Linux - using one of two packages: {{c|app-emulation/virtualbox}} or {{c|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.


Line 29: Line 28:
}}
}}


== Choose VirtualBox Users ==
== Assign VirtualBox Users ==


You will not be able to run and use VirtualBox as a regular user if you are not a member of the <code>vboxusers</code> group.
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  {{c|vboxusers}}. For example, a user ''alice'' is added to {{c|vboxusers}}


<console>
{{console|body=
###i## gpasswd -a ''user'' vboxusers
###i## gpasswd -a ''alice'' vboxusers
</console>
}}


You must re-log so changes take effect.
If currently logged in the User added to {{c|vboxusers}} must first log out before the changes will have an effect.


== Load VirtualBox Kernel Modules ==
== Load VirtualBox Kernel Modules ==


Required and optional modules must be loaded before launching VirtualBox. You can do that as root or upon boot.
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 {{c|app-emulation/virtualbox-drivers}} which is installed automatically (as a dependency) when you install app-emulation/virtualbox.


{{fancynote|<code>vboxnetadp</code> and <code>vboxnetflt</code> are optional.}}
As ''root '' load these modules in a terminal
 
{{console|body=
=== As root ===
 
<console>
###i## modprobe vboxdrv
###i## modprobe vboxdrv
###i## modprobe vboxnetadp
###i## modprobe vboxnetadp
###i## modprobe vboxnetflt
###i## modprobe vboxnetflt
</console>
}}
 
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 {{f|/etc/conf.d/modules}} to contain the following line
{{file|name=/etc/conf.d/modules|body=
modules="vboxdrv vboxnetadp vboxnetflt"
}}
 
== Starting VirtualBox ==
VirtualBox can be started from a terminal.
{{console|body=
$##i## 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.


=== Upon boot OpenRC ===
As is typical for most kernel changes or updates, please run
Edit <code>/etc/conf.d/modules</code> :
{{console|body=
###i## emerge --ask @module-rebuild
}}
''before'' running VirtualBox under the new kernel.


<pre>modules="vboxdrv vboxnetadp vboxnetflt"</pre>
If you wish to check that the VirtualBox kernel drivers will be rebuilt in this way, please examine the file {{f|/var/lib/module-rebuild/moduledb}}. For example, using the command {{c|grep}}


== Start VirtualBox ==
{{console|body=
$##i## grep virtualbox /var/lib/module-rebuild/moduledb
a:1:app-emulation/##r##virtualbox##!r##-modules-5.0.20
}}


== Dealing with Funtoo Linux kernel updates ==
Each time a new kernel is installed, <code>vboxdrv</code> kernel module must be recompiled. To ensure Portage knows about that, look at <code>/var/lib/module-rebuild/moduledb</code>. The following record must be present.


<pre>a:1:app-emulation/virtualbox-modules-''version''</pre>


Running <code>emerge @module-rebuild</code> will recompile VirtualBox driver after installation of new kernel.


= Guest OS =
= Guest OS Installation =
{{warning|This section is currently under redevelopment.}}
{{warning|This section is currently under redevelopment.}}
== Guest Additions ==
== Guest Additions ==
Line 95: Line 109:


If you want to run Funtoo GNU/Linux as a guest O/S, emerge <code>app-emulation/virtualbox-guest-additions</code> in the Funtoo GNU/Linux guest O/S. For other GNU/Linux, please refer to [https://www.virtualbox.org/manual/ch04.html#idp11274368 VirtualBox documentation].
If you want to run Funtoo GNU/Linux as a guest O/S, emerge <code>app-emulation/virtualbox-guest-additions</code> in the Funtoo GNU/Linux guest O/S. For other GNU/Linux, please refer to [https://www.virtualbox.org/manual/ch04.html#idp11274368 VirtualBox documentation].
= Tips and Tricks =
== Providing USB2, USB3, VRDP and/or PXE Boot ROM to Guest OS ==
{{SectionNeedsUpdates}}
Accept PUEL licence
emerge app-emulation/virtualbox-extpack-oracle


= Troubleshooting =
= Troubleshooting =
Line 110: Line 131:
EFI  guests now should properly boot.
EFI  guests now should properly boot.
reference reports: https://www.virtualbox.org/ticket/14279 and https://bugs.funtoo.org/browse/FL-2640
reference reports: https://www.virtualbox.org/ticket/14279 and https://bugs.funtoo.org/browse/FL-2640
[[Category:Ebuilds]]
[[Category:Ebuilds]]
[[Category:Virtualization]]
[[Category:Virtualization]]
{{EbuildFooter}}
{{EbuildFooter}}

Revision as of 12:53, May 25, 2016

VirtualBox

   Tip

We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.

VirtualBox is a free and open source virtualization 'hypervisor' for x86-based machines. VirtualBox can be installed and run on GNU/Linux and other Operating Systems.

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

TermExplanation
Host OS An install of Funtoo Linux on physical hardware. VirtualBox will be installed to and run from here.
Guest OSThe 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 AdditionsGuest 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 or 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 vboxusers

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

   /etc/conf.d/modules
modules="vboxdrv vboxnetadp vboxnetflt"

Starting VirtualBox

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 grep

user $ grep virtualbox /var/lib/module-rebuild/moduledb
a:1:app-emulation/virtualbox-modules-5.0.20



Guest OS Installation

   Warning

This section is currently under redevelopment.

Guest Additions

Make sure that user running X session belongs to vboxguest group. Create group when it does not exist. Add user to the group. That will enable :

  • Shared clipboard;
  • Display resizing;
  • Seamless mode;
  • Drag & Drop.
root # groupadd vboxguest
root # gpasswd -a ''user'' vboxguest

Windows Guests

   Important

This is new information.

VirtualBox versions less than 5.0

You must enable additions USE flag when you intend to install Windows as a guest O/S. That will also install the ISO image containing all necessary Windows guest drivers.

VirtualBox versions 5.0 and above

As of version 5.0 the USE flag additions has been removed from the package app-emulation/virtualbox. The guest additions ISO required for a Windows guest is now provided in a separate package, app-emulation/virtualbox-additions. Install this to access the guest additions ISO: /usr/share/virtualbox/VBoxGuestAdditions.iso.

Linux Guests

If you want to run Funtoo GNU/Linux as a guest O/S, emerge app-emulation/virtualbox-guest-additions in the Funtoo GNU/Linux guest O/S. For other GNU/Linux, please refer to VirtualBox documentation.

Tips and Tricks

Providing USB2, USB3, VRDP and/or PXE Boot ROM to Guest OS

   Important

This section is in need of updates.

Accept PUEL licence

emerge app-emulation/virtualbox-extpack-oracle

Troubleshooting

EFI case

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
  • type edit startup.nsh to open the full-screen editor
  • enter "fs0:\EFI\Funtoo Linux [GRUB]\grubx64.efi" (including the double quotes, since the path contains spaces)
  • press CTRL-s (maybe twice) to save and confirm saving by pressing Enter
  • quit editor by pressing CTRL-q
  • type reset to 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

EFI guests now should properly boot. reference reports: https://www.virtualbox.org/ticket/14279 and https://bugs.funtoo.org/browse/FL-2640