Arch Linux install on Virtualbox VM

I’ve installed Arch Linux in a few VM’s (Virtualbox / Windows 7) and each time it is slightly different. These are my notes from a successful install. Virtualbox v4.3.22, Arch Linux 2015/02/01.

Start by downloading the ISO image of the latest Arch Linux distro, use the torrent link to go faster. You can use Deluge, an open source torrent client. Burn it to a CD so it can have it at hand. InfraRecorder works great and it is open source.

Start Virtualbox and create a VM, if you type “Arch” in the new VM name it will automatically change the type to linux and the version to Arch linux 64 bit, nice! I want a small VM so I just configure 1024Mb of RAM and 50Gb of virtual hard drive.

Insert your Arch Linux CD and start the new VM, sometimes you need to go to Devices menu and set your CD reader, sometimes it is already done for you.

Boot your system from the CD /first option) until you get the shell prompt, then using fdisk create new partitions in your new virtual drive. There are lots of info on how to create partitions so I wont get into details. Anyway I was following the Arch Linux documentation, the installation guide is great.

I created 3 primary partitions, the first with 200Mb (boot), the second with 512Mb (swap) and a third with the rest, I let you do the math ;-)

Now lets create the file systems and swap:

# mkfs /dev/sda1
# mkfs.ext4 /dev/sda3
# mkswap /dev/sda2
# swapon /dev/sda2

Mount these to proceed with the install:

# cd /mnt
# mkdir boot
# mount /dev/sda1 /mnt/boot
# mount /dev/sda3 /mnt

Notice that I’m using a separate boot partition.

I’m installing the base packages, the devel packages (I’m a programmer) and grub (I need it in the following steps):

# pacstrap /mnt base base-devel grub

Then you need to generate the fstab file, it also need to be modified because of the boot partition:

# genfstab -p /mnt >> /mnt/etc/fstab

Edit the fstab file:

# vi /etc/fstab

And duplicate the first line, change the file system from /dev/sda3 to /dev/sda1 and the dir from / to /boot, it should end up with 3 lines in your fstab file, the first one with file system /dev/sda1 for /boot, the second one with file system /dev/sda3 for / and the third one with file system /dev/sda2 for swap.

Now you need to change your current system’s root to the mount point:

# arch-chroot /mnt

You can temporarily change your keyboard using loadkeys, I’m using a Portuguese keyboard:

# loadkeys pt-latin1

If you want a persistent change you can do:

# vi /etc/vconsole.conf

And add this line to the vconsole.conf file:


For the time zone, you need to link the corresponding file to /etc/localtime, I’m in France so for me it is:

# ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime

Then before generating the locale configuration files edit the /etc/locale.gen file and uncomment your language locale, I uncommented en_US.UTF-8 because I want to keep everything in English. To generate the locale do:

# locale-gen

To set the system locale preferences you can also do:

# echo LANG=en_US.UTF-8 > /etc/locale.conf

This way it will be in English by default and if a user wants to change it he can add its own $HOME/.config/locale.conf file.

The last step and very important, the grub boot loader. If you are following these steps you know you changed the system’s root, at that point it started a new shell, so if you forgot to install grub with pacstrap you need to do it now using pacman -S grub. So for the boot loader install:

# grub-install –target=i386-pc –recheck –debug /dev/sda
# grub-mkconfig -o /boot/grub/grub.cfg

The grub-install will scroll a bunch of lines and at the end it will say it was successful (hopefully). The grub-mkconfig just generates a new grub config file.

So now you have finished the install, you can do “exit” from the arch-chroot shell and reboot. It is better to do a power down and remove the CD, then power up you new VM. It should boot and prompt you to log in, you just have the root user for now with no password.

If it boots and you manage to log in then you will be very happy with yourself, but this wont last long because you will realize that the network is not working. A fast way to configure it is using systemd, create a new /etc/systemd/network/ file and add some lines inside:

# vi /etc/systemd/network/



Make sure that the name of your network device starts with “en”, otherwise you can replace “en*” with the name of your network device. Use the following commands to check it out:

# dmesg
# ip a
# ip link show
# netctl list
# networkctl

Then do the following:

# systemctl enable systemd-networkd
# systemctl start systemd-networkd

The first command creates a link that starts systemd-networkd automatically on boot, the second one starts it for the current session.

We also need to configure the DNS resolution:

# systemctl enable systemd-resolved
# systemctl start systemd-resolved
# ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf

The first command creates a link that starts systemd-resolved, the second one starts it for the current session, the third one creates a link from the DHCP resolv.conf file to the system’s /etc/resolv.conf file.

And that’s it, now you should have a VM with Arch Linux up and running. Try to reboot it and check everything is still working, network, keyboard, etc.

Ah, one final thing: the Linux Guests Additions! This needs to be installed in the client OS if you want to take advantage of some functionality like shared folders between the host system and the client system.

DON’T FOLLOW the instructions from the Virtualbox web page! It will not work and you end up with some of the files installed that you’ll have to remove by hand. For the details look in this page. There is already a Arch Linux package ready to be installed with pacman.

# pacman -S virtualbox-guest-utils

You can test the new kernel modules with:

# modprobe -a vboxguest vboxsf vboxvideo

The easiest way to load the virtualbox kernel modules at boot time is to enable the vboxservice:

# systemctl enable vboxservice
# systemctl start vboxservice

Now you just need to reboot the VM and you should be able to see a new /media folder and inside a subfolder starting with sf_, in my case I created an auto mount machine shared folder named SharedFolder02 so I have:




Author: pedro_nf

Independent contractor on IT solutions and automation

1 thought on “Arch Linux install on Virtualbox VM”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s