Howdy folks!
Lately, I have been diving more and more into Arch Linux and using suckless minimal software. I just finished publishing a video to YouTube called Installing Arch Linux on a UEFI System in 2021. In this video I walk you through from beginning to end on how to install Arch Linux when your machine is configured to use UEFI.
The other week I found an older HP laptop I had lying around that is around 5 years old. I couldn’t remember the BIOS password and it was configured for UEFI. Instead of doing a password reset I decided to install Arch Linux on the laptop leaving UEFI in place. Once I successfully did that, I decided to make a video on it for others to follow.
Below are the steps on how I did the installation. I have also included the instructions on GitHub here.
Note: This article assumes you are using a US keyboard layout and we will also be setting up swap as a file instead of a partition. You should also read the official Arch installation guide https://wiki.archlinux.org/index.php/installation_guide.
-
Verify boot mode:
- This is an important set when working with a UEFI system. Run the command below and if the directory does not exist, the system may not be booted in UEFI mode.
ls /sys/firmware/efi/efivars
(If the directory exist your computer supports EFI)
-
Ping some site on the Internet to verify connection:
- Use
ip link
to verify your network devices - If necessary, use
iwctl
to setup your wireless - Run
ping
to check to see if you already have an internet connection ping archlinux.org -c 5
- Use
-
Update system clock:
- View the current status of your clock by running
timedatectl status
- Run the following command to ensure your system clock is correct
timedatectl set-ntp true
- This will set your date and time to update remotely using network time protocol
- View the current status of your clock by running
-
Go to https://archlinux.org/mirrorlist and find the closest mirror that supports HTTPS:
- Add the mirrors on top of the
/etc/pacman.d/mirrorlist
file. Server = https://mirror.arizona.edu/archlinux/$repo/os/$arch
(United States)
- Add the mirrors on top of the
-
cfdisk
-
Create EFI partition:
- New
- 300M
- Type
- EFI System
- Write
-
Create
/root
partition:- Select free space
- New
- 30G
- Linux filesystem
- Write
-
Create
/home
partition:- Select free space
- New
- Use rest of the space
- Linux filesystem
- Write
-
Create the filesystems:
fdisk -l
to view the partitions for the next stepmkfs.fat -F32 /dev/sda1
mkfs.ext4 /dev/sda2
mkfs.ext4 /dev/sda3
-
Create the
/root
and/home
directories:mount /dev/sda2 /mnt
mkdir /mnt/home
mount /dev/sda3 /mnt/home
-
Install Arch linux base packages:
- Use the following if you want to include VIM:
pacstrap -i /mnt base linux linux-firmware sudo vim
- Use the following if you want to also include Nano:
pacstrap -i /mnt base linux linux-firmware sudo nano vim
-
Generate the
/etc/fstab
file:genfstab -U -p /mnt >> /mnt/etc/fstab
-
Chroot into installed system:
arch-chroot /mnt
-
Find available time zones:
timedatectl list-timezones
-
Set the timezone:
ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
- or
timedatectl set-timezone America/Chicago
-
Update the Hardware clock:
hwclock --systohc
-
Set your hostname and configure hosts
echo myhostname > /etc/hostname
- Update
/etc/hosts
with the following:
127.0.0.1 localhost
::1 localhost
127.0.1.1 myhostname.localdomain myhostname
-
Set the root password
passwd
-
Let’s enable the network
- If you don’t do this before your reboot you won’t have internet connection
pacman -S networkmanager
systemctl enable NetworkManager
-
Install boot manager and other needed packages:
pacman -S grub efibootmgr dosfstools openssh os-prober mtools linux-headers linux-lts linux-lts-headers
-
Set locale:
sed -i 's/#en_US.UTF-8/en_US.UTF-8/g' /etc/locale.gen
(uncomment en_US.UTF-8)locale-gen
-
Enable root login via SSH:
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
systemctl enable sshd.service
passwd
(for changing the root password)
-
Create EFI boot directory:
mkdir /boot/EFI
mount /dev/sda1 /boot/EFI
-
Install GRUB on EFI mode:
grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck
-
Setup locale for GRUB:
cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
-
Write GRUB config:
grub-mkconfig -o /boot/grub/grub.cfg
-
Create swap file:
fallocate -l 2G /swapfile
chmod 600 /swapfile
mkswap /swapfile
echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab
-
Exit, unmount and reboot:
exit
umount -a
reboot
Thanks for visiting!