Home > GNU/Linux > How to install Arch Linux on a VM VirtualBox (I)

How to install Arch Linux on a VM VirtualBox (I)

On this entry I’ll describe the steps I followed to successfully install Arch Linux on a VirtualBox virtual machine. The host system is a Windows 8.1.

My main source of documentation has been the excellent Arch Linux Installation Guide wiki. As the rest of the wiki it has a very high quality.

The first thing to do is to download the latest Arch ISO. While the ISO is downloading you can create the virtual machine. The properties of the VM I created are:

  • name: ArchLinuxVM
  • type of operating system: ArchLinux (64bit)
  • RAM memory size: 2GB
  • hard drive type: VDI, dynamically allocated
  • hard drive size: 20GB
  • bidirectional clipboard: yes
  • shared folder: yes (remember that the shared folder must exist on the host system before setting this property)
  • shared folder auto-mount: yes

If you aren’t new to VirtualBox and know how to setup the machine described above you can skip the next section.

Creating and Configuring the Virtual Machine

Open the VirtualBox program, click the New button of the toolbar, write down the machine name, and choose the OS type and version.


Choose the RAM size. In my case the host system has 8GB so 2GB of RAM was a sensible choice for my VM.


The next step is to create a virtual hard drive.


In the next screens we choose the disk type to be VDI and to allocate the space dynamically. Then we choose the hard disk size. The default size is 8 GB which is probably too small so we increase the size until 20GB.


We click the Create button and then we start the setup of the VM by clicking the Settings button of the toolbar.


Now we go to the General -> Advanced tab and setup the bidirectional clipboard.


Afterward we setup a shared folder. It will be useful to share data between the host and guest systems. In the host system it is seen as a regular folder. In the guest system it is a folder with the same name but living in the /media directory. Before setting up the shared folder it must be created on the host system.
We go to the Shared Folders tab, enter the path of the shared folder and tip the auto-mount check box.


If everything went O.K. it should look like this:


Eventually we select the Storage tab. Click the Add CD button (the small CD with a plus sign picture) and virtually insert the previously downloaded ISO in the CD drive of the VM.


The VM is now created and configured so we can proceed with the Arch Linux installation.

Installing Arch Linux

Now we are ready, on the VirtualBox program click Start on the toolbar and a boot screen will appear, showing you several boot options. Press Enter (i.e. choose the Boot Arch Linux x86_64). After a few seconds you will get terminal with the root user automatically logged on.


The first thing to do if you’re not using an English keyboard is to set the keyboard layout. I’m living in Spain and using a keyboard with Spanish layout so I have to run the command:

# loadkeys /usr/share/kbd/keymaps/i386/qwerty/es

Next you have to partition the virtual hard disk. But first you need to know how your disk is named, so you issue the command lsblk.


In my case the name is sda (I know it because its type is disk and it is 20 GB big). The last thing to do before partitioning is to choose the format of the partition table. You have two options: the classic MBR format and the modern GPT format. In general, if your boot loader is not GRUB legacy and you are not running a multi-boot system with Windows using BIOS, then it is recommended to use the GPT format so we will use it (you can read more about both formats here).
Now that we know the disk name and the partition table format we can issue the proper command to partition the disk, in our case:

# gdisk /dev/sda

gdisk is the GPT version of fdisk. A prompt asks we what we want to do (create new partitions, set partition start and end sectors, etc.). The following screenshot shows an example:


After partitioning the disk the partitions table looks like:


The partition 1 is for installing the GRUB bootloader, the partition 2 is for the / filesystem, the partition 3 is for /boot filesystem and the partition 4 is for the /home filesystem. As you can see we aren’t creating a swap partition. This is because we have a large amount of RAM ans a swap partition will probably not be necessary.

Next we format our partitions with the proper flavors of the mkfs command.


Now we have to create the mount points for the partitions and mount them (beware that we don’t mount the boot partition):

# mkdir /mnt/boot
# mkdir /mnt/home
# mount /dev/sda2 /mnt
# mount /dev/sda3 /mnt/boot
# mount /dev/sda4 /mnt/home

Next step is to test our connection to the Internet using the ping command:

# ping -c 3 www..google.com
PING www.l.google.com ( 56(84) bytes of data.
64 bytes from icmp_req=1 ttl=50 time=437 ms
64 bytes from icmp_req=2 ttl=50 time=385 ms
64 bytes from icmp_req=3 ttl=50 time=298 ms

--- www.l.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 298.107/373.642/437.202/57.415 ms

Everything seems O.K. (no packet loss) so we go to the next step, the selection of download mirrors. We edit the /etc/pacman.d/mirrorlist file and select the desired mirrors. Regional mirrors usually work best, but it may be necessary to consider other concerns. In my case I simply selected the first five mirrors in the list (for selecting just uncomment the line containing the server). The less the score is the better the server works.


Now we download from the Internet the base system and install it:

# pacstrap /mnt base

This is the base system so don’t expect a graphical web browser to be installed 🙂

Now we generate the fstab file:

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

At this point we are ready to change root into the system:

# arch-chroot /mnt

The next steps are pretty easy. First we set the hostname and the time zone (in my case Europe, Madrid):

# echo ArchLinuxVM > /etc/hostname
# ln -sf /usr/share/zoneinfo/Europe/Madrid /etc/localtime

Then we have to generate and setup the wanted locales. It is a three steps process:

First we edit the /etc/locale.gen file and uncomment the needed locales (es_ES.UTF-8 in my case)

Second, we generate the required locales:

# locale-gen

And third, we set the locale preferences in the /etc/locale.conf file:

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

Now we set the password for the root user:

# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Now it’s time to install the GRUB bootlader in the boot partition (/dev/sda1 in our case):

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


Note that grub-install installs the bootloader to the desired device and copy GRUB images and modules in /boot/grub/i386-pc. In addition grub-mkconfig generate the GRUB configuration file grub.cfg and saves it under /boot/grub.

Once the bootloader has been installed we can reboot the virtual machine:

  • – leave the change root environment

    # exit

  • – optionally unmount all the partitions

    # umount -R /mnt

  • – remove the installation media (i.e. go to the VM VirtualBox top menu and, in the Devices menu, choose CD/DVD devices and remove disk from the virtual drive)
  • – issue the reboot command

    # reboot

And that’s enough for today. In the next blog entry we’ll complete the virtual machine configuration (with a permanent setup of the Internet connection, user’s creation, installation of X Window System, etc.).

Categories: GNU/Linux Tags: ,
  1. March 6, 2016 at 3:15 am


  2. March 6, 2016 at 3:17 am


  3. Nev
    June 29, 2016 at 10:45 pm

    I’m getting a ‘Not enough clusters for a 32 bit FAT’. Help?

  4. Alex
    August 31, 2016 at 9:03 am

    Same to me: ‘Not enough clusters for a 32 bit FAT’?!

    • Alex
      August 31, 2016 at 12:02 pm

      I expand space on /dev/sda1 to 1G and this solved problem.

  5. Alex
    August 31, 2016 at 12:08 pm

    But second problem I face is:
    # mount /dev/sda2 /mnt
    # mount /dev/sda3 /mnt/boot
    mount: mount point /mnt/boot does not exist 😦

    What I omit?!

    • Pablo
      October 26, 2016 at 3:16 am

      Alex, the next worked for me:
      sudo mkdir /mnt/boot
      sudo mkdir /mnt/home
      mount /dev/sda2 /mnt
      mount /dev/sda1 /mnt/boot
      mount /dev/sda4 /mnt/home


  1. March 21, 2015 at 7:34 pm
  2. March 26, 2015 at 7:44 am

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Connecting to %s

%d bloggers like this: