Instructions for installing VirtualBox on Arch Linux and selecting the appropriate host modules:
Install the virtualbox
package and choose the appropriate package to provide host modules based on your kernel:
- For the Linux kernel, install
virtualbox-host-modules-arch
. - For any other kernel (including linux-lts), install
virtualbox-host-dkms
.
sudo pacman -S virtualbox
Identify the kernel version:
Use the uname -r
command to identify the current kernel version on your system. This will give you the major and minor version numbers needed to select the correct host module package.
The numbers correspond to different versions of the Linux kernel. For example, if your kernel version is 6.6.19-1-MANJARO
, you would want to select option '8' for linux66-virtualbox-host-modules
. This option corresponds to the version of the VirtualBox host modules that match your installed kernel version (linux66
). Once you select the appropriate option and proceed with the installation, VirtualBox should work smoothly with your current kernel version:
sudo pacman -S virtualbox
resolving dependencies...
:: There are 12 providers available for VIRTUALBOX-HOST-MODULES:
:: Repository extra
1) linux419-virtualbox-host-modules 2) linux510-virtualbox-host-modules 3) linux515-virtualbox-host-modules 4) linux54-virtualbox-host-modules 5) linux61-rt-virtualbox-host-modules
6) linux61-virtualbox-host-modules 7) linux66-rt-virtualbox-host-modules 8) linux66-virtualbox-host-modules 9) linux67-rt-virtualbox-host-modules 10) linux67-virtualbox-host-modules
11) linux68-virtualbox-host-modules 12) virtualbox-host-dkms
Enter a number (default=1): 8
looking for conflicting packages...
Packages (5) liblzf-3.6-4 libtpms-0.9.6-1 linux66-virtualbox-host-modules-7.0.14-9 sdl12-compat-1.2.68-1 virtualbox-7.0.14-2
Total Download Size: 57.47 MiB
Total Installed Size: 219.31 MiB
uname -r
When prompted to choose a package for host modules during installation, select the option that matches your kernel version. The options will typically be numbered based on different kernel versions available in the Arch Linux repositories.
After installation, you should be able to launch VirtualBox either from the application menu or by running the virtualbox command in the terminal.
After installing VirtualBox and its associated packages on your Arch-based system, you may want to perform the following steps to ensure everything is set up correctly and to enhance your virtualization experience:
Load Kernel Modules: VirtualBox requires certain kernel modules to be loaded. You can ensure they are loaded by executing the following command:
sudo modprobe vboxdrv
If you encounter any errors, it may indicate that the VirtualBox kernel modules are not properly installed or configured.
To allow your user account to access VirtualBox devices, add it to the vboxusers group:
sudo usermod -aG vboxusers $USER
Replace $USER
with your username (Use echo $USER
to make sure it's set).
You can enable the vboxweb.service
to manage VirtualBox remotely through a web interface. This service allows you to access VirtualBox functionality from a web browser on another device.
Example command:
sudo systemctl enable --now vboxweb.service
If you plan to run guest operating systems in your virtual machines, consider installing VirtualBox Guest Additions. These additions provide better integration between the host and guest systems, enabling features such as shared folders, clipboard sharing, and seamless mouse integration.
You can typically install Guest Additions from within the guest operating system by selecting the "Insert Guest Additions CD Image" option from the VirtualBox menu.