DEV Community

Cover image for Install and use VirtualBox on Arch Linux & Snigdha OS
Eshan Roy (eshanized) for Snigdha OS

Posted on

Install and use VirtualBox on Arch Linux & Snigdha OS

To install and use VirtualBox on Arch Linux, you can follow these steps. VirtualBox is available in the Arch User Repository (AUR), and you can install it using pacman or an AUR helper like yay.

1. Install VirtualBox

Using pacman (Official Arch repository):

If you're using the VirtualBox version from the official Arch repository, follow these steps:

  1. Update your system:
   sudo pacman -Syu
Enter fullscreen mode Exit fullscreen mode
  1. Install VirtualBox: Install VirtualBox and the required dependencies:
   sudo pacman -S virtualbox
Enter fullscreen mode Exit fullscreen mode

This will install VirtualBox and related tools. However, you will also need to install the kernel headers for your specific kernel version.

Install Kernel Headers:

  • If you are using the default linux kernel:

     sudo pacman -S linux-headers
    
  • If you are using another kernel, like linux-lts, install the corresponding headers:

     sudo pacman -S linux-lts-headers
    
  1. Load the VirtualBox kernel module: After installing VirtualBox, load the necessary kernel modules by running:
   sudo modprobe vboxdrv
Enter fullscreen mode Exit fullscreen mode

If you encounter errors, try to ensure that the correct kernel headers are installed and that your system is using the correct kernel.

  1. Start VirtualBox: Now, you can start VirtualBox from the terminal by typing:
   virtualbox
Enter fullscreen mode Exit fullscreen mode

Using the AUR (if you prefer the AUR version):

The AUR version is often up-to-date with the latest VirtualBox releases. You can install it using an AUR helper such as yay.

  1. Install yay (if you haven't already): If you don’t have yay installed, you can install it using the following command:
   sudo pacman -S yay
Enter fullscreen mode Exit fullscreen mode
  1. Install VirtualBox from AUR: Run the following command to install VirtualBox from the AUR:
   yay -S virtualbox
Enter fullscreen mode Exit fullscreen mode

This will also handle dependencies and kernel headers.

2. Add Your User to the vboxusers Group

To allow your user to use VirtualBox without needing to run it as root, add your user to the vboxusers group:

sudo gpasswd -a $USER vboxusers
Enter fullscreen mode Exit fullscreen mode

You will need to log out and log back in for the changes to take effect.

3. Create a Virtual Machine (VM)

Once VirtualBox is installed and the necessary modules are loaded, you can start creating and managing virtual machines using the VirtualBox GUI or the command line:

  • Start VirtualBox GUI:
    You can launch VirtualBox from the applications menu or by running virtualbox in the terminal.

  • Create a VM:
    In the VirtualBox GUI, click on "New" to create a new virtual machine. You will need to specify:

    • Name and type of OS.
    • Memory size.
    • Virtual hard disk (you can create a new one or use an existing one).
  • Install an OS on your VM:

    Once the VM is created, you can start it and install an operating system on the virtual hard disk.

4. (Optional) Install Extension Pack

To unlock additional features such as USB 2.0/3.0 support, better video support, and remote desktop capabilities, you may want to install the VirtualBox Extension Pack.

  1. Download the Extension Pack from the VirtualBox website: VirtualBox Extension Pack.

  2. Install the Extension Pack:

    • After downloading, you can add it to VirtualBox from the GUI by going to File > Preferences > Extensions and clicking the Add button to browse and select the downloaded extension pack file.

Troubleshooting:

  • Kernel module issues: If you run into issues with loading the vboxdrv module, ensure that you have the correct kernel headers installed and that your kernel matches the one you're using.
  • Check VirtualBox version compatibility: Ensure that you're running the appropriate version of VirtualBox for your kernel and system setup.

Once everything is set up, you can start using VirtualBox to create and manage virtual machines on your Arch Linux system!

Top comments (0)