Install Arch Linux on virtualbox – the nuts and bolts (pt1)

Installing Arch is incredibly satisfying (maybe thats code for frustrating) as it really does introduce you to the flexibility offered by the modular nature of Linux. And with virtualisation software like virtualbox, we don’t have to worry about turning our computer into a fancy doorstop while we madly google a solution to that frozen black screen.

With the excellent Arch beginners guide installation wiki things really are not that difficult, however, there certainly are some got-yas (hair pulling), especially when installing inside a VM. Hopefully this step by step guide will help someone out.

Step 1. Download the latest Arch ISO, remember to use a torrent to save the arch servers bandwidth (and its a good FU to the MPAA).

Step 2. While you’re waiting, lets setup the VM. Open up virtualbox and click on ‘new’.


Typing Arch into the name box should populate the other options.


Set the memory to something sensible (1gb), remember you need to save some for the host, so stay away from the red section of the sliding bar.


We want to create a virtual hard drive now (the 8gb default is probably a little too frugal).


Select the top option on the next screen (VDI) then allow it to be dynamically allocated. Even though the drive will dynamically allocate space, we need to set the maximum size, at 8gb (the default on my machine) we will probably run out of space pretty quickly in real world desktop use. So lets make it something sensible. An alternative would be to do a minimum base install and then hook-up a shared folder to the host and keep data there (more on that latter).


Press “Create” and now we can setup the options on our new virtual machine. On the [general][advanced] tab setup bi-directional clipboard and file sharing.















Also tick the “show top of screen” or you’ll get driven crazy by the dropup menu destroying your life! On the system setting change the processors to suite your system. Display setting, might as well enable 3D. Now for the storage settings we can virtually stick our downloaded ISO into a imaginary CD-drive.


Click the ‘add CD’ button and point the file option to your freshly downloaded Arch ISO. The will allow the VM to boot from the ISO rather than; well nothing! Finally, lets setup a shared folder with the host. Select the folder path and click the auto-mount check box.


Now we are ready. Click “start” and we should get a boot screen, press enter (boot into Arch) and after a few seconds we should have a flashing cursor.

vm7 vm8 vm9

Bingo! Now I’m pretty much following along with the beginners guide.

Step 3 – Terminal action!

Firstly, I’m assuming you are using a standard keyboard layout (if not follow the guide). Secondly, lets check that the internet is working. A great thing about using a VM is that we don’t have to fiddle with wireless (it can be a pain) as the host just provides the link as if it was wired (remember for this to work the host must be connected to the internet). Lets check by pinging google, the “-c 3” flag just says to do it three times, if you forget it just [ctl][c] to kill ping.

ping -c 3

If you get a path not found error, check the host connection (then check the beginners guide if that doesn’t work)! Otherwise you’ll exchange some packets with google to verify everything is working dandy.

Now we use the “lsblk” command to check the name of the disk we are going to partition, in my case its “sda” (this is important), note I can tell that because its 20Gb big (remember we set that before).


So assuming your drive is sda we’ll use fdisk to make our new partitions.

 fdisk /dev/sda 

fdisk will present us with some options. **NOTE** if at any time you want to back out just hit “q”!

vm11Here I’m setting “n” for new partition table, “p” for primary, “1” for 1st partition, then accept the default for the start sector, finally “+10G” (this is all one word, it just slipped over the screen on the screenshot) to specify that we want this first partition to take up half our drive, we could probably make this less ( “+6G”?) if you wanted more space for the home. Now the home partition. Same as before really, but this time we specify “2” for the second partition and accept the defaults for start and end sectors to take up the remainder of the drive.


Now we can preview our new partitions with “p” and if we are happy write the table “w”, note that the partitions are called “/dev/sda1” and “/dev/sda2”, make note of this for latter. I’ve got plenty of RAM so I’m not going to worry about a swap partition (-:.


Next we format our new partitions as ext4 and then create a mount point for root and then mount a home directory on the other partition (remember to change sdx depending on your information above).

#format the drives
mkfs.ext4 /dev/sda1
mkfs.ext4 /dev/sda2
mount /dev/sda1 /mnt
mkdir /mnt/home
mount /dev/sda2 /mnt/home

Finally lets install the base system.

pacstrap -i /mnt base base-devel

vm14Accepted the defaults and “y” to install. Take note of some of the things that are being installed here, it really is the base system (ie base programs like “which” etc, all those little bash utilities you just take for granted).

Now we organise the boot partition.

genfstab -U -p /mnt >> /mnt/etc/fstab
#now check the table
nano /mnt/etc/fstab

This is what my boot table looks like (the $ signs at the end mean that there is more text outside the screen view, if you scroll to the right you should see the numbers 1 for the “/” partition and 2 for the “/home” partition.


Now its time to setup the base system ie set locale and make the internet persistent. For this we will be entering change root, which is a special environment (read about it here). Then we will change to files that contain information on our location and character set, the guide suggest we stick to UTF-8. In my case I’m in New Zealand, so I’ll uncomment that line in the file (note you can search in nano by using [ctl][w]) set that (note we only have one time zone in NZ). You can enable multiple languages here by uncommenting them, this would be handy if you are working on a system with multiple users, or you like to curse in foreign languages!

arch-chroot /mnt /bin/bash
nano /etc/locale.gen
##in the nano editor##
#en_NG ISO-8859-1
en_NV.UTF-8 UTF-8
#en_NV ISO-8859-1

Save this file with [ctl][o] and [ctl][x], then run the following to generate the locale, it should report your chosen setting.


Now that we have enabled the language we need to set the system wide settings in a new file called /etc/locale.conf that contains our chosen default system setting. In my case the command would be below, but if you were in the USA you probably use “echo LANG=en_US.UTF-8 > /etc/locale.conf”. All we are doing is echo’ing some text to a new file. Then we just export that setting (substitute your lacale).

echo LANG=en_NZ.UTF-8 > /etc/locale.conf
export LANG=en_NZ.UTF-8

The timezone and subzone files are in a folder called “/usr/share/zoneinfo/Zone/SubZone”, with “Zone” and “SubZone” being replaced by your region. For example, if you lived in Rochester NY (eastern US time), the folder you would point to would be called “/usr/share/zoneinfo/US/Eastern”. You can see below how I use “ls” to list the directories, then I create a simlink that to “/etc/localtime” (remember you probably have regions so your directory path will be one longer (as shown for the Rochester NY example).


ln -s /usr/share/zoneinfo/NZ /etc/localtime

Now we set the clock to UTC (Coordinated Universal time).

hwclock --systohc --utc

Then set our hostname (that will be seen on a network) to whatever we like (oneword). First we create a file called “/etc/hostname” containing the name, then we use nano to edit as second file (as shown), note the “DavesArch is a [tab] from the “hostname” string on that line (the one starting with

echo DavesArch > /etc/hostname
nano /etc/hosts
##in the nano editor!##
# /etc/hosts: static lookup table for host names

# localhost.localdomain localhost DavesArch
::1 localhost.localdomain localhost
# End of file

We are nearly there! Lets setup the network, before configuring grub and setting a root password. For the network we will use netctl. We can copy an example file from “/etc/netctl/examples” to a new filename “/etc/netctl/my_network”; the one to use is pretty obvious since we have a virtual wired connection via our host.

cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/my_network

Next we edit this file, replacing the “Interface=eth0” line shown by the “ip a” command (see below).


Now just use nano to edit the file we just created and replace “eth0” with our interface (in my case “enp0s3”) from the ip a output.


netctl enable my_network

We will quickly set a root password, make it hard to guess and easy to remember (ha ha).


Now to setup the grub bootloader.

pacman -S grub
grub-install --target=i386-pc --recheck /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg


umount /mnt/home
umount /mnt/

We use shutdown here so that we can eject the virtual ISO before we reboot, otherwise we will be back to where we started.


This time select the ISO and click the small minus sign icon at the bottom of this window to delete the ISO drive (otherwise we will boot back into the live CD)

Once our ISO is removed we can hit the start button again on Virtualbox, and fingers crossed we’ll boot into arch!

vm20What now? Unless you are a terminal jedi we’re going to have to install some GUI tools. For me this was the most challenging part of the install especially with the added complication of working with a VM. Since we are already up to 1600 words I think I might take a break, but to get your desktop GUI up and running click here!



17 thoughts on “Install Arch Linux on virtualbox – the nuts and bolts (pt1)

  1. Pingback: Install Arch Linux on virtualbox – the nuts and bolts (pt2) | Welcome to the Dave Wheeler lab page and blog

  2. Pingback: Setting up a Lubuntu virtual machine with virtual box | Welcome to the Dave Wheeler lab page and blog

  3. FINALLY! Of the 6 or so tutorials I’ve youtube’d or read, this is the only one that worked for me in Virtualbox. I nearly gave up.


  4. As others have said above, thanks for this walk-through on installing Arch…I tried a bunch of them and this is the only one that worked all the way through 🙂

    I had to install SSH to log into my VM via PuTTY (my favourite way)…Arch really is minimalistic and didn’t install it by default 🙂

  5. typing:
    cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/my_network
    cp: invalid option — ‘h’
    Try ‘cp –help’ for more information.

    ? very new to Linux, there is an ‘H’ option but no ‘h’ option in the help listing, no ‘c’ option either. What exactly are we trying to do here? If we are just trying to copy the file, can we safely dispose of the options and just copy it?

  6. typing:
    cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/my_network
    cp: invalid option — ‘h’
    Try ‘cp –help’ for more information.

    ? very new to Linux, there is an ‘H’ option but no ‘h’ option in the help listing, no ‘c’ option either. What exactly are we trying to do here? If we are just trying to copy the file, can we safely dispose of the options and just copy it?

    • Hi There, cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/my_network shouldn’t give that warning because there is no -h parameter in the command (ie I would understand if the command was cp -h /etc/netctl/examples/ethernet-dhcp /etc/netctl/my_network (but it isn’t).

      Are you sure you haven’t got some spaces in the command ie ethernet-dhcp" becomes /ethernet -dhcp" (note the space after the ethernet which would give the error that you mentioned?

      This guide might be out of date (I haven’t tested in ages) and I’m not sure Arch is the best place to start if you are a linux newbie (props to you for trying). Ubuntu offers a much easier install and once you have had a go with that you could move onto arch and perhaps use a new guide.

      • cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/my_network

        ^^^cut and paste from the guide.

        I’ll try again. Can’t be worse than Windows 10.

        I was going to wipe Windows 10 and install BlackArch straight, but a friend talked me into doing it as a virtual machine. Learning both operating systems as I go. And VirtualBox as well.

      • When casting magical incantations, even the breathes between words are important.

        It was the lack of space before the “-dhcp” that caused the problem.


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