Archlinux Install UEFI (virtualbox)

Virtualbox can be used to simulate a UEFI environment, when setting up your virtualbox make sure you check ‘Enable UEFI (special OSes only)’ in settings under system - motherboard.

Boot up your Virtual Machine with the archiso, at first it may seem like its not working, be patient while it initializes.

You should see something like this:

Once the archiso has booted, you should see this:

If this is a clean virtual machine, your good to go, If its not we want to wipe the drive of any file system and partition tables.

WIPE THE DRIVE

gdisk /dev/sda
x
z
y
y

CREATE & PARTITION THE DRIVE

cfdisk /dev/sda select gpt

Select [ New ]

Make a new partition 512M

Change the type to EFI System

Arrow down to the Free Space and select New

Hit Enter to use the rest of the drive Type should be Linux filesystem, then select [ Write ] and type ‘yes’ enter, then quit out of cfdisk.

you should have 2 partitions

/dev/sda1 512M EFI System
dev/sda2 14.9G Linux filesystem (14.9G in my case)

FORMAT THE FILESYSTEM

mkfs.fat -F32 /dev/sda1

mkfs.ext4 /dev/sda2

MOUNT THE FILESYSTEM

mount /dev/sda2 /mnt

mkdir /mnt/boot

mount /dev/sda1 /mnt/boot

INSTALL ARCHLINUX BASE PACKAGES

pacstrap -i /mnt base base-devel

CONFIGURE FSTAB AND CHROOT /MNT

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

cat /mnt/etc/fstab (check fstab)

arch-chroot /mnt

CONFIGURE LANGUAGE AND LOCATION

nano /etc/locale.gen

uncomment your locale:
en_GB.UTF-8 UTF8

locale-gen

SET YOUR TIME ZONE

ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime

hwclock --systohc --utc

ENABLE THE MULTILIB REPOSITORY

nano /etc/pacman.conf

Uncomment the lines:
[multilib] and
include = /etc/pacman.d/mirrorlist

pacman -Sy (check multilib is enabled)

SET HOSTNAME & NETWORK

echo yourhostname > /etc/hostname

nano /etc/hosts

127.0.0.1 localhost
::1 localhost
127.0.1.1 myhostname.localdomain myhostname

SET ROOT PASSWORD AND CREATE NEW USER

passwd

useradd -m -g users -G wheel -s /bin/bash yourname

passwd yourname

ALLOW THE USERS IN WHEEL GROUP TO BE ABLE TO PREFORMANCE ADMINISTRATIVE TASKS WITH SUDO

EDITOR=nano visudo

Uncomment the line:
%wheel ALL=(ALL) ALL

INSTALL AND CONFIGURE BOOTLOADER

mkinitcpio -p linux

pacman -S grub efibootmgr dosfstools mtools

grub-install --target=x86_64-efi --efi-directory=/boot

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

There is a bug in virtualbox using UEFI, if you reboot it will work, if you shutdown then reboot it will fail.

VIRTUALBOX FIX
mkdir /boot/EFI/boot
cp /boot/EFI/arch/grubx64.efi /boot/EFI/boot/bootx64.efi

UNMOUNT THE PARTITIONS AND REBOOT

exit

umount -a

reboot

CREATE A SWAPFILE recommended

as super user
su

fallocate -l 4G /swapfile

chmod 600 /swapfile

mkswap /swapfile

echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab

INSTALLING A DESKTOP ENVIRONMENT

2 Likes

Good tip. I have started using UEFI in VirtualBox to see how well the distro handles it prior to installing it on real hardware. For example, I was having some issues with Solus because of the way they handle UEFI and was able to figure it out using VB.

1 Like

thanks @EricAdams

…not finished yet, Its going to be a full arch UEFI install, I got interrupted while writing it, I will probably finish it tomorrow, kinda lost focus now…

Yeah the whole point of these tutorials is to get people comfortable with installing arch before trying it on metal, which by the way, I will be doing arch on metal, bios & UEFI tutorials after the virtualbox ones.

Then I will do the main Desktop Environments, how to install gnome, xfce, mate, cinnamon, budgie, kde plasma etc, may take a while, but I will do them :hot_face:

Then if enough interest, I may do making your own ISO using archiso :wink: