Setting up an Arch Linux VM in VirtualBox

About Arch Linux

There are many Linux distributions out there. Arch Linux is our choice. Start by reading a little bit about it:

Create a VM

  1. Download and install VirtualBox

  2. Download archlinux-YYYY.MM.DD-dual.iso from Arch Linux Downloads page

  3. Create a new VM in VirtualBox

Install Arch Linux

Once the VM boots successfully into the Arch Live CD image, you are ready to install Arch onto your virtual hard disk. Follow the Arch Linux Beginners’ Guide carefully step-by-step. You can start at Section 2, Installation.

The Guide is very detailed and comprehensive, but sometimes it’s a bit confusing. Here are some additional info and directions on some of the trickier sections of the Beginners’ Guide:

Install VirtualBox Guest Additions

Now you should install VirtualBox Guest Additions inside the VM. The Guest Additions will enable very useful features like dynamically resizing the VM window, copy & paste between guest and host, time sync between guest & host, and accessing the host file system from the guest.

  1. Install packages:

    sudo pacman -S virtualbox-guest-utils
    sudo pacman -S virtualbox-guest-modules
    sudo pacman -S virtualbox-guest-modules-lts
    sudo pacman -S virtualbox-guest-dkms
  2. Create /etc/modules-load.d/virtualbox.conf which contains the following three lines:

  3. In order to synchronize time with the host machine, type the following:

    sudo systemctl enable vboxservice.service
  4. Enable “Bidirectional” Shared Clipboard from VirtualBox Manager’s Settings / General / Advanced menu.

  5. Reboot the VM and type ps ax | grep -i vbox. You should see an output like this:

    139 ?        Ssl    0:00 /usr/bin/VBoxService -f
    402 ?        Sl     0:00 /usr/bin/VBoxClient --clipboard
    414 ?        Sl     0:00 /usr/bin/VBoxClient --display
    420 ?        Sl     0:00 /usr/bin/VBoxClient --seamless
    425 ?        Sl     0:00 /usr/bin/VBoxClient --draganddrop

    Try copy & paste between host and guest.

You can look through Arch’s documentation on VirtualBox for more detailed info.

Switch to Linux LTS kernel

The stock kernel of Arch Linux stays pretty close to the bleeding edge, so it gets updated very frequently. Arch offers a more stable alternative based on a kernel version designated as a Long-Term Support (LTS) version. The linux package in Arch is the stock kernel and the linux-lts package is the LTS kernel. We are going to use the LTS kernel.

  1. Install the LTS kernel package and update the boot menu to include the new kernel:

    sudo pacman -S linux-lts linux-lts-headers 
    sudo grub-mkconfig -o /boot/grub/grub.cfg
  2. Verify that the new kernel works correctly:

    1. Type uname -r to see the current kernel version you’re running
    2. Reboot into the new LTS kernel (probably the 3rd item in the boot menu)
    3. Type uname -r again to see the new LTS kernel version.
  3. Make your VM boot to LTS by default by editing /etc/default/grub. Change GRUB_DEFAULT=0 to GRUB_DEFAULT=2 (assuming that the LTS kernel was the 3rd entry in the boot menu). Update the boot menu and reboot:

    sudo grub-mkconfig -o /boot/grub/grub.cfg
    sudo reboot

Some recommended UI improvements

Congratulations! You have successfully installed and configured an Arch Linux system. Hopefully this is the beginning of a long-term relationship between Linux and you.

Last updated: 2014–01–18