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.

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. Please change your article to show that dhcpd *must* be installed BEFORE the reboot, i.e.,

    # pacman -S dhcpcd
    # systemctl enable dhcpcd
    

    Otherwise, the booted ArchLinux will have no network to install *anything*.

    The rest of your instructions were invaluable to me,

    Thank-you!

    Reply
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. Same as Keith Barrow. Saved my life. 20+hours trying to figure out how to stop booting to grub command line. Thank you!!!!

    Reply
  9. 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
  10. Os-prober is broken AT THIS MOMENT (so you might not even get this error in the future) just don’t install os-prober and the installation will go fine I’ve used this many times before (also with os-prober before it was broken)

    Reply
  11. You need to change "ln -s /usr/share/zoneinfo/Europe/Bucharest /etc/localtime" to "ln -fs /usr/share/zoneinfo/Europe/Bucharest /etc/localtime" as the localtime link is already there.

    The "-f" will force a new symlink.

    Reply
  12. Thank you so much for this. Installing grub on my old UEFI mobo it’s been a real pain! But now arch is up and running thanks to you and the Arch Wiki!

    Reply
  13. /etc/localtime already existed on my system. rm /etc/localtime before the ln command (or possibly use a flag on the ln command)

    Reply
  14. The command visudo gives the following error.

    "specified editor (vim) does not exist"
    

    I entered “EDITOR=nano” and was then able to use visudo. Might help anyone else getting stuck at that point.

    Reply
  15. Hi Ravi,

    Wanted to add that the UEFI option must be enabled in the BIOS before the grub EFI can be installed. I learned the hard-way. Great instructions thank you.. Just rooted on a Intel NUC, and being used a firewall.

    Reply
  16. Just wonder about the step where you wrote eno16777736. Where do I find this and do I write this if I don’t use Virtual Machine?

    Reply
  17. Hi I am wondering if this is possible without the Ethernet connection? How would I go about this via wifi? I am trying to install arch on a acer chrome-book 14. So far I have to rewrite/update the firmware with (UEFI) Full ROM. Then I can work on installing arch Linux from there.

    Thoughts?
    Thanks in advance.

    Reply
  18. Had to add EFI dir to grub install to work in virtualbox:

    grub-install –target=x86_64-efi –bootloader-id=grub_uefi –recheck –efi-directory=/boot/EFI

    Reply
  19. This post should honestly be in the official Arch documentation. This works 100% Congrats on the Author and thank you for your post.

    Reply
  20. Hi,

    Great and very informative tutorial. Thank you for the post. Can you please also make such tutorial for Arch Linux dual boot with Windows 10? Again, thanks.

    Reply
    • Manthan he does not need to make another tutorial. Windows should be installed first then install Arch Linux second. This will locate Windows and add it to the grub menu.

      Login into your Arch desktop.
      Open a terminal and type the following.

      Install and configure bootloader:

      # mkinitcpio -p linux
      # pacman -S grub os-prober
      # grub-install /dev/sda
      # grub-mkconfig -o /boot/grub/grub.cfg
      # shutdown -f -r -t 0

      Reply
  21. @archuser: fdisk is not outdated ,all major linux distributions still use it , its just not compatible with GPT disks.
    Due to its rolling release model, Arch is a distribution that change very rapidly and addopts new features all the time( see movig all binaries into one single location), still this doesnt mean that old good stuff arent good anymore or outdated. As long as all major linux distributions still use old years tested software components, is not fair to say that is deprecated. What would you say about centos that still use old gnome2? it’s outdated?

    Reply
  22. The /etc/sudoers should only be edited with the visudo command.

    Using any other means (this includes using nano and vi to edit the file) is known to corrupt the /etc/sudoers file from time to time, leaving the system with a broken sudo authentication framework.

    Reply
  23. 12. Use CTRL+K for copy the entire row and CTRL+U for paste.
    13. Why the fuck do you put that -i? Totally unnecessary.
    15. Outdated. # systemctl set-locale LANG=”pt_BR.UTF-8″
    tip. for change keymap #systemctl set-keymap br abnt2
    tip. # ls /usr/share/kbd/keymaps/i386/qwerty/
    17. This method is outdated. Use # localectl set-locale Europe/Bucharest
    17. UTC clock is the default. Unnecessary.
    18. Just enable multilib if needed.
    19. NO. NOT USE YAOURT WITHOUT KNOWING WHAT. First learn more about arch linux and make a pkg manually.
    20. Useless. base instalation is already updated.
    21. Outdated. This groups is used just in rc era. With systemd just useradd -m -g users -s /bin/bash YOUR_NEW_USER
    24. Use # grub-install –target=i386-pc /dev/sda or you may have problems with UEFI systens
    27. You can make a # pacman -S lxde firefox and a # systemctl enable lxdm for a basic and lightweight DE.
    tip. #systemctl set-x11-keymap us
    28. Great tutorial.

    Reply
    • On 17.
      #timedatectl set-timezone America/Sao_Paulo
      On 24.
      #grub-install –target=i386-pc /dev/sda
      tip. CTRL + W for search things on nano,

      Reply
      • For notebookers:
        -To connect wifi on live session
        # wifi-menu
        -To “wifi-menu” work after install
        # pacstrap base base-devel wpa_supplicant dialog

        Reply
  24. You may want to do a tutor on how to brand or stylise Archlinux like getting colour in the command line (bash, etc), to loading screens, etc.

    Reply
  25. Many thanks for a great tutorial. I already have Arch on main system and love it.

    Once you’re on the train-line you don’t need to get the engine off it.

    The only issue I have with Archlinux is that it doesn’t support MySQL from the base repositories, which hinders it’s uptake on servers.

    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.