Installing Arch Linux as a VirtualBox Guest

Arch Linux is probably the first Linux distro I’ve come across that does not have a graphical installer. It boots from the iso and drops you straight into a shell.

Ok. Once you’ve realized this then the install instructions make more sense.

To install in VirtualBox I created an 8GB disk. Once booted from the iso, at the shell I used fdisk to partition 2 partitions, one 6GB for / and one 2 GB for /home, following the steps from this post.

In summary, the steps were:

  • p – create primary
  • 1 – 1st partition
  • enter for start position default
  • +6G for end point 6GB from start
  • p next primary
  • 2 – 2nd partition
  • enter for default start
  • enter for end at end of available space

p shows the created partitions, which ended up looking like this:

w to write the partitions and exit.

Next format the two partitions:

mkfs.ext4 /dev/sda1

mkfs.ext4 /dev/sda2

Mount and start the install!

At this point, pick up from the remainder of the instructions in the install guide and beginners guide.

When attempting to install grub, I got these errors:

Per this post (and here), looks like my repo databases needed to be created/updated? I ran

pacman -Syu

and this looks like it fixed my pacman database issue, but now at this point it looked like I’d ran out of space on /, but going back through the install docs, I didn’t do the

arch-chroot /mnt /bin/bash

step so looks like I was installing to the / on my iso live boot? Anyway, did arch-chroot,
and now re-running the command to install grub now worked.
Next steps:

grub-install --recheck /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

Remaining steps:

  • Set root’s password: passwd
  • Exit chroot
  • Unount drives:
    umount -R /mnt
  • reboot

Remove the iso in VirtualBox, and restart – whoah, Arch is installed! Now time to install X and a window manager! Next steps depending on what you intend to use Arch for are covered in the general recommendations guide.

Create a user:

useradd -m -G wheel -s /bin/bash username

Use password username to set password.

Network config

Network setup guide is awesome!

Add name servers to /etc/resolv.conf (e.g. for Google nameservers)

nameserver 8.8.8.8
nameserver 8.8.4.4

Start and enable dhcp services to start at boot:

systemctl start systemd-networkd.service
systemctl enable systemd-networkd.service
systemctl start systemd-resolved.service
systemctl enable systemd-resolved.service

Check adapters: ip link – get name of VirtualBox adapter, will be something like enp0s3

Edit /etc/systemd/network/wired.conf, add:

[Match]
Name=enp0s3
[Network]
DHCP=ipv4

Start and enable dhcpcd.service:

systemctl start dhcpcd@enp0s3.service
systemctl enable dhcpcd@enp0s3.service

… where enp0s3 is your VirtualBox network interface.

At this point you should have network connectivity – check by pinging www.google.com

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.