Arch Linux Installation and Configuration on UEFI Machines

Arch Linux is one of the most versatile GNU Linux distribution due to its simplicity and cutting edge software packages due to its Rolling Release model, Arch Linux is not addressed for beginners in Linux world. It also provides a complicated command-line installer, with no Graphical Interface support. The command-line installation model makes the job of installing the system very flexible but also very difficult for Linux beginners.

On top of all, Arch Linux provides its own software packages repositories via Pacman Package Manager. Arch Linux also provides a Multiarch environment for different CPU Architectures, such as 32bit, 64bit, and ARM.

The software packages, dependencies, and security patches are mostly updated on a regular basis, making Arch Linux a cutting-edge distribution with a few solid tested packages for a production environment.

Arch Linux also maintains the AUR – Arch User Repository, which is a huge community-driven software repositories mirror. AUR repo mirrors allow users to compile software from sources and install it via Pacman and Yaourt (Yet Another User Repository Tool) package managers.

This tutorial presents a step by step basic Arch Linux installation process through a CD/USB bootable image on UEFI based machines. For other customizations or details visit the Official Arch Linux Wiki page at https://wiki.archlinux.org.

Requirements

  1. Download Arch Linux ISO Image

Step 1: Create a Disk Partitions Layout

1. First of all, go do the Arch Linux download page and grab the latest CD image (i.e. current stable version: 2020.05.01), create a bootable CD/USB then plug it into your system CD/USB drive.

2. IMPORTANT STEP! Also, make sure your system has an Ethernet plugged in cable with internet connectivity and also an active DHCP server enabled.

3. After the CD/USB boots up you will be presented with first Arch Linux Installer options. Here, select Arch Linux archiso x86_64 UEFI CD and press Enter key to continue.

Arch Linux Boot Menu
Arch Linux Boot Menu
Booting Arch Linux
Booting Arch Linux

4. After the installer decompresses and loads the Linux Kernel you will be automatically thrown to an Arch Linux Bash terminal (TTY) with root privileges.

A good step now is to list your machine NICs and verify internet network connection by issuing the following commands.

# ifconfig
# ping -c2 google.com
Check Arch Linux Network
Check Arch Linux Network

In case you don’t have a DHCP server configured at your premises to dynamically allocate IP addresses to clients, issue the below commands to manually configure an IP address for Arch Live media.

Replace the network interface and IP addresses accordingly.

# ifconfig eno16777736 192.168.1.52 netmask 255.255.255.0 
# route add default gw 192.168.1.1
# echo “nameserver 8.8.8.8” >> /etc/resolv.conf
Configure IP Address on Arch Linux
Configure IP Address on Arch Linux

On this step, you can also list your machine hard disk by issuing the following commands.

# cat /proc/partitions
# ls /dev/[s|x|v]d*
# lsblk
# fdisk –l 
Check Arch Linux Disk
Check Arch Linux Disk

In case your machine is a virtual based machine, the hard disks can have other names than sdx, such as xvda, vda, etc. Issue the below command to list virtual disk if you’re unaware of the disk naming scheme.

# ls /dev | grep ‘^[s|v|x][v|d]’$* 
Check Virtual Disks
Check Virtual Disks

Important to note is that the name convention for Raspberry PI drive storage usually is /dev/mmcblk0 and for some types of hardware RAID cards can be /dev/cciss.

5. On the next step, we’ll start to configure the Hard Disk partitions. For this stage you can run cfdisk, cgdisk, parted or gdisk utilities to perform a disk partition layout for a GPT disk. I strongly recommend using cfdisk for its wizard-driven and simplicity in use.

For a basic partition, the layout table uses the following structure.

  • EFI System partition (/dev/sda1) with 300M size, FAT32 formatted.
  • Swap partition (/dev/sda2) with 2xRAM recommended size, Swap On.
  • Root partition (/dev/sda3) with at least 20G size or rest of HDD space, ext4 formatted.

Now let’s actually start creating disk layout partition table by running cfdisk command against machine hard drive, select GPT label type, then select Free Space then hit on New from the bottom menu, as illustrated in the below screenshots.

# cfdisk /dev/sda
Select Arch Linux Label Type
Select Arch Linux Label Type
Select Arch Linux Installation Disk
Select Arch Linux Installation Disk

6. Type the partition size in MB (300M) and press enter key, select Type from the bottom menu and choose EFI System partition type, as shown in the following screenshots.

EFI System Size
EFI System Size
EFI System Type
EFI System Type
Select EFI System
Select EFI System

You’ve finished configuring the EFI System partition.

7. Next, let’s create the Swap partition using the same procedure. Use down arrow key and select again the remaining Free Space and repeat the steps above: New -> partition size 2xRAM size recommended (you can safely use 1G) -> Type Linux swap.

Use the below screenshots as a guide to creating the swap partition.

Create Swap Partition
Create Swap Partition
Set Swap Partition Size
Set Swap Partition Size
Select Partition Type
Select Partition Type
Select Swap Partition
Select Swap Partition

8. Finally, for /(root) partition use the following configuration: New -> Size: rest of free space -> Type Linux filesystem.

After you review Partition Table select Write, answer with yes in order to apply disk changes and then, type quit to exit cfdisk utility, as shown in the below images.

Create Root Partition
Create Root Partition
Set Root Partition Size
Set Root Partition Size
Select Type for Root Partition
Select Type for Root Partition
Select Linux Filesystem
Select Linux Filesystem
Partition Table Summary
Partition Table Summary
Confirm Partition Changes
Confirm Partition Changes
Quit Disk Management Console
Quit Disk Management Console

9. For now, your partition table has been written to HDD GPT but no file system was yet created on top of it. You can also review the partition table summary by running fdisk command.

# fdisk -l

10. Now, it’s time to format the partitions with the required file systems. Issue the following commands to create a FAT32 file system for EFI System partition (/dev/sda), to create the EXT4 file system for the root partition (/dev/sda3) and create the swap partition for /dev/sda2.

# mkfs.fat -F32 /dev/sda1
# mkfs.ext4 /dev/sda3
# mkswap /dev/sda2
Create Arch Linux Filesystem
Create Arch Linux Filesystem

Step 2: Install Arch Linux

11. In order to install Arch Linux, the /(root) partition must be mounted to /mnt directory mount point in order to be accessible. Also, the swap partition needs to be initialized. Issue the below commands to configure this step.

# mount /dev/sda3 /mnt
# ls /mnt 
# swapon /dev/sda2
Mount Root Partition
Mount Root Partition

12. After the partitions had been made accessible, is time to perform Arch Linux system installation. To increase installation packages download speed you can edit /etc/pacman.d/mirrorlist file and select the closest mirror website (usually choose your country server location) on top of the mirror file list.

# nano /etc/pacman.d/mirrorlist

You can also enable Arch Multilib support for the live system by uncommenting the following lines from /etc/pacman.conf file.

[multilib]
Include = /etc/pacman.d/mirrorlist
Enable Arch Multilib
Enable Arch Multilib

13. Next, start installing Arch Linux by issuing the following command.

# pacstrap /mnt base base-devel linux linux-firmware nano vim
Install Arch Linux
Install Arch Linux
Arch Linux Installer in Progress
Arch Linux Installer in Progress

Depending on your system resources and internet speed the installer can take from 5 to 20 min to complete.

14. After the installation completes, generate fstab file for your new Arch Linux system by issuing the following command.

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

Subsequently, inspect fstab file content by running the below command.

# cat /mnt/etc/fstab
Generate fstab File
Generate fstab File

Step 3: Arch Linux System Configuration

15. In order to further configure Arch Linux, you must chroot into /mnt the system path and add a hostname for your system by issuing the below commands.

# arch-chroot /mnt
# echo "archbox-tecmint" > /etc/hostname
Set Hostname for Arch Linux
Set Hostname for Arch Linux

16. Next, configure your system Language. Choose and uncomment your preferred encoding languages from /etc/locale.gen file then set your locale by running the following commands.

# pacman -S nano
# nano /etc/locale.gen

the locale.gen file excerpt:

en_US.UTF-8 UTF-8
en_US ISO-8859-1
Set Arch Linux Language
Set Arch Linux Language

Generate your system language layout.

# locale-gen
# echo LANG=en_US.UTF-8 > /etc/locale.conf
# export LANG=en_US.UTF-8
Set Arch Linux Language
Set Arch Linux Language

17. The next step is to configure your system time zone by creating a symlink for your sub time zone (/usr/share/zoneinfo/Continent/Main_city) to /etc/localtime file path.

# ls /usr/share/zoneinfo/
# ln -s /usr/share/zoneinfo/Aisa/Kolkata /etc/localtime
Set Arch Linux Timezone
Set Arch Linux Timezone

You should also configure the hardware clock to use UTC (the hardware clock is usually set to the local time).

# hwclock --systohc --utc

18. Like many famous Linux distributions, Arch Linux uses repo mirrors for different world locations and multiple system architectures. The standard repositories are enabled by default, but if you want to activate Multilib repositories you must uncomment [multilib] directives from /etc/pacman.conf file, as shown in the below excerpt.

# nano /etc/pacman.conf
Enable Arch Multilib
Enable Arch Multilib

19. If you want to enable Yaourt Package Tool support (used for downloading and building AUR packages) go to the bottom of the /etc/pacman.conf file and add the following directives.

[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch
Activate Yaourt Package Tool
Activate Yaourt Package Tool

20. After the repository file has been edited, synchronize and update database mirrors and packages by running the below command.

# pacman -Syu
Synchronize and Update Database
Synchronize and Update Database

21. Next, set up a password for the root account and create a new user with Sudo privileges in the Arch box by issuing the commands below. Also, expire the user password in order to force the new user to change the password at first login.

# passwd
# useradd -mg users -G wheel,storage,power -s /bin/bash your_new_user
# passwd your_new_user
# chage -d 0 your_new_user
Create Arch Linux User
Create Arch Linux User

22. After the new user has been added you need to install the sudo package and update the wheel group line from /etc/sudoers file in order to grant root privileges to the newly added user.

# pacman -S sudo
# pacman -S vim
# visudo 

Add this line to /etc/sudoers file:

%wheel ALL=(ALL) ALL
Enable Sudo Privileges
Enable Sudo Privileges

24. On the last step, install the Boot Loader in order for Arch to boot up after restart. The default boot loader for Linux distributions and Arch Linux also is represented by the GRUB package.

To install the GRUB boot loader in UEFI machines on the first hard-disk and also detect Arch Linux and configure the GRUB boot loader file, run the following commands as illustrated in the following screenshots.

# pacman -S grub efibootmgr dosfstools os-prober mtools
# mkdir /boot/EFI
# mount /dev/sda1 /boot/EFI  #Mount FAT32 EFI partition 
# grub-install --target=x86_64-efi  --bootloader-id=grub_uefi --recheck
Install Grub Boot Loader in Arch Linux
Install Grub Boot Loader in Arch Linux
Configure Grub Boot Loader in Arch Linux
Configure Grub Boot Loader in Arch Linux

25. Finally, create the GRUB configuration file by issuing the following command.

# grub-mkconfig -o /boot/grub/grub.cfg
Create Grub Configuration file
Create Grub Configuration file

Congratulations! Arch Linux is now installed and configured for your box. The last steps needed now are to exit the chroot environment, unmount the partitions and reboot system by issuing the below commands.

# exit
# umount -a
# telinit 6

26. After reboot, remove the installation media image and the system will boot directly into the GRUB menu as shown below.

Arch Linux Grub Menu
Arch Linux Grub Menu

27. When the system boots-up into Arch Linux, log in with the credentials configured for your user during the installation process and change the user account password as shown below.

Arch Linux Login
Arch Linux Login

28. You will lose the internet network connection because no DHCP client is running by default in the system. In order to overcome this problem, issue the following command with root privileges in order to start and enable the DHCP client.

Also, check if the network interface is up and has an IP address allocated by the DHCP server and if the internet connection works as expected. Ping a random domain to test the internet connection.

$ sudo systemctl start dhcpcd
$ sudo systemctl enable dhcpcd
# ip a
# ping -c2 google.com

For now, the Arch Linux system contains only the basic software packages needed to manage the system from Command-Line, with no Graphical User Interface.

Due to its high-portability, rolling release cycles, source packages compilation, granular control over installed software and processing speed, Arch Linux resembles in many ways with Gentoo Linux, but cannot rise to Gentoo complex architectural design.

However, the process of managing an Arch Linux system is not recommended for Linux beginners. Linux beginners that want to operate an Arch-like Linux system should first learn Arch Linux principles by installing the Manjaro Linux distribution.

If you read this far, tweet to the author to show them you care. Tweet a thanks
Matei Cezar
I'am a computer addicted guy, a fan of open source and linux based system software, have about 4 years experience with Linux distributions desktop, servers and bash scripting.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

58 thoughts on “Arch Linux Installation and Configuration on UEFI Machines”

  1. Does /boot/EFI need to be added to /etc/fstab? I am getting dropped into `grub> ` prompt and /boot/EFI is empty. I am kind of guessing, it has been 10 years since I configured grub.

    Reply
  2. You need to update the guide with the warning if dhcpcd is not installed before the exit you will not have an internet connection.

    Reply
  3. Well explained indeed.

    What if you want to dual-boot Ubuntu? Then the EFI partition would be already installed and so does GRUB, right?

    I’m struggling with this. I have both installed, but can’t boot into Arch, the grub menu entry is never shown.

    Reply
  4. Nice tutorial!

    One thing I’d point out: when installing grub, I had to tell it where the EFI directory is by adding the “efi-directory=/boot/EFI” flag to the command.

    # grub-install --target=x86_64-efi  --bootloader-id=grub_uefi --recheck
    

    Otherwise, great information and a good explanation.

    Reply
  5. So finally a found a solution for the problem:

    $ sudo systemctl start dhcpcd
    

    Then I get an error message: Failed to start dhcpcd.service: Unit dhcpcd.service does not exist

    It is not possible to start dhcpcd because it is not installed (maybe not included now in the package, time ago was included), one solution is to install it with Pacman after arch-chroot for example in 16:

    # pacman -S dhcpcd 
    # systemctl enable dhcpcd.service
    

    thanks,
    Martin

    Reply
    • @Martin,

      Yes, you are right, you need to install the DHCP package to get this work. Also, we have updated the article and included the latest instructions for installing Arch Linux 2019.

      Reply
  6. Hello,

    Thank you for the nice tutorial, for the UEFI installation with GRUB was for me really helpful!

    Two things, unfortunately, do not work:

    After the “base” installation you can’t start in “16” the command: # nano /etc/locale.gen.
    because “nano” isn’t installed, so you need in the base installation following:

    # pacstrap /mnt base base-devel linux linux-firmware nano (“linux linux-firmware nano” is in your tutorial missing)

    So my problem:
    After the installation and reboot, I cannot start the network, if I make:

    $ sudo systemctl start dhcpcd
    

    Then I get an error message: Failed to start dhcpcd.service: Unit dhcpcd.service does not exist

    Can you help me, please?

    Thanks. Martin

    Reply
  7. Same as Keith Barrow. Saved my life. 20+hours trying to figure out how to stop booting to grub command line. Thank you!!!!

    Reply
  8. You’ve absolutely saved my life- spent 10hrs plus trying to get various combinations of reFINed, systemd and GRUB to get OSX off the macbook I bought from work – a lot of the instructions elsewhere are unclear – at one point I must have mounted the boot partition over the /boot directory and mnixed the kernels.

    Your instructions to mount to /boot/EFI and set up grub was the charm – can’t thank you enough.

    Reply

Got something to say? Join the discussion.

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.