Arch Linux Installation
Arch Linux is wonderful. According to its official website, it is a "simple, lightweight distribution". It is really simple and lightweight, but it is even more powerful and flexible. However, its power and flexibility have a price: the installation process is not so straight-forward. While other distributions like Ubuntu and Fedora offer a very simple, intuitive and graphical environment for the installation, Arch Linux relies on the user's command line skills throughout the process. The very good part of getting into installing and setting up this extremely powerful and flexible distribution is that the user normally starts having an incredibly better understanding of how Linux works. This series of tutorials is intended to make the installation easy and fruitful.
Downloading the ISO image and preparing the bootable USB Stick
The ISO image can be obtained from After downloading and naming the ISO file as arch.iso, it is time to copy it to the USB medium. For this, a terminal is opened and the following command is typed:
to list the available block devices
The output of the above command may be as follows, where sda and sdb are USB sticks and mmcblk0 is an embedded storage contaning the Arch Linux system being used for the writing of this tutorial:
sda            8:0    1 14.6G  0 disk 
├─sda1         8:1    1  747M  0 part 
└─sda2         8:2    1   84M  0 part 
sdb            8:16   1  7.3G  0 disk 
└─sdb1         8:17   1  7.3G  0 part 
mmcblk0      179:0    0 29.1G  0 disk 
├─mmcblk0p1  179:1    0  512M  0 part /boot/efi
├─mmcblk0p2  179:2    0    2G  0 part [SWAP]
└─mmcblk0p3  179:3    0 26.6G  0 part /
mmcblk0boot0 179:8    0    4M  1 disk 
mmcblk0boot1 179:16   0    4M  1 disk
The next step may be very dangerous. The user must be certain about the correct device on which the ISO image will be stored; otherwise, important data may be lost if a wrong device is selected. In this tutorial, it is assumed that the ISO is to be stored on sda and the final Arch Linux system is to be installed on sdb. Assuming sda as the correct block device, its partition table must be wiped out:
wipefs --all /dev/sda
to clear the partitioning scheme of the block device
There are at least three ways of effectivelly copying the ISO file to the disk, namely: using dd, cat and cp. The latter is preferable here for the sake of simplicity and safety:
cp arch.iso /dev/sda
to finally copy the file to the medium
Everything should be all right so far. The computer should now be restarted and the motherboard setup be prompted, generally using the F2 key.
Booting from the Arch Linux installation medium
In order to boot from the USB medium, it is necessary to configure the BIOS to recognize the USB as being the first option in the boot order. Besides, an important choice might be made in relation to the booting process. The options may be: MBR (Master Boot Record) or UEFI (Unified Extensible Firmware Interface). These two options are generally present on most setups, but more recent computers are following the trend to abandon the use of MBR. This text is going to show how to install Arch Linux according to the UEFI standard. The MBR installation can be found in this link.
Setting up the keyboard layout
After making the choice and effectivelly booting into the Arch Linux installation system, a terminal must appear. The user should do some tests over the keyboard. If some keys turn out to be strange, is necessary to change the keyboard layout.
To see the available layouts:
ls -R /usr/share/kbd/keymaps
-R ⇒ recursive ⇒ to show all files in all directories and subdirectories
To refine the search for the brazilian layout, as an example:
ls -R /usr/share/kbd/keymaps | grep "br"
to obtain files and directories having the word "br"
Now, it is time to load the appropiate keys:
loadkeys br-abnt2
to set the layout for brazilians
Verifying the boot standard currently in use
So as to confirm whether MBR or UEFI is being used, an attempt to list the EFI variables is made:
ls /sys/firmware/efi/efivars
to try to list files and directories, is any
If the output is not empty, the UEFI scheme is being used, and the installation process can continue.
Preparing the internet connection
First of all, the internet devices can be listed in the following manner:
ip link
to list the available internet devices
Generally, the output shows the devices:
1: lo => this is the loopback device, usually the localhost
2: eth0 => this is the ethernet device (sometimes called enp2s0)
3: wlan0 => this is the wifi device (cometimes called wlp1s0)
The Arch Linux installation system is already prepared to use the internet out of the box, as long as the computer is plugged into an ethernet cable, in which case the device called eth0, for example, is readily setup. If it is the case, an attempt to ping some web server is made, in order to see if the connection is working appropriately:
to test if there is any connection to the internet
Instead, if the user wants a WIFI connection, it is possible to use the iwctl program for the setup:
the internet wireless control
The iwctl program is very intuitive. In its command prompt, the user should type help followed by an enter. The following common sequence of instructions is enough for most WIFI connections, assuming that the internet device is wlan0:
1) device list
2) station wlan0 scan
3) station wlan0 get-networks
4) station wlan0 connect SSID
5) station wlan0 show
6) quit
Once more, requests are sent to some server:
to check whether the connection is working
The connection should be fine.
Adjusting the clock
Undoubtedly, keeping the system and the hardware clock set up appropriately is crucial. The following commands are enough to adjust the clock, but they will have to be executed once again near the end of the installation processs:
timedatectl status
to see the current status
timedatectl set-ntp true
to syncronize the clock through the network
timedatectl list-timezones
to list the available time zones
timedatectl set-timezone America/Fortaleza
to choose the desired time zone
timedatectl status
to check whether everything is all right
Partitioning the disks
When it comes to partitioning disks, care is of utmost importance. For the UEFI installation, three partitions are to be created, and the fdisk program is going to be used for this task. Firstly, fdisk is used to list the devices able to be partitioned:
fdisk -l
to list the available block devices
The output of the above command is:
Disk /dev/mmcblk0: 29.12 GiB, 31268536320 bytes, 61071360 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 2E295736-8C6D-0443-B8F5-7F10194510B2

Device           Start      End  Sectors  Size Type
/dev/mmcblk0p1    2048  1050623  1048576  512M EFI System
/dev/mmcblk0p2 1050624  5244927  4194304    2G Linux swap
/dev/mmcblk0p3 5244928 61071326 55826399 26.6G Linux filesystem

Disk /dev/sda: 14.59 GiB, 15664676864 bytes, 30595072 sectors
Disk model: Cruzer Blade    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x46a6eddb

Device     Boot   Start     End Sectors  Size Id Type
/dev/sda1  *         64 1529855 1529792  747M  0 Empty
/dev/sda2       1529856 1701887  172032   84M ef EFI (FAT-12/16/32)

Disk /dev/sdb: 7.26 GiB, 7798784000 bytes, 15232000 sectors
Disk model: Cruzer Blade    
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe73fab8e

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdb1        2048 15230975 15228928  7.3G  7 HPFS/NTFS/exFAT
Of course, for this tutorial, the device to be partitioned is not sda, because it is where the Arch Linux installation system is stored and running right now. Instead, the system will be installed on sdb, and this device should appear in the following command:
fdisk /dev/sdb
to select the USB device to be partitioned
The user should be carefull not to use the command w (WRITE) until the command p (PRINT) shows a very clear and correct partition table. These instructions solve most of the problems:
1)      m => for help
2)      g => for creating a new GPT partition
3)      n => for creating a new partition
3.1)        number => default (1)
3.2)        first sector => default
3.3)        last sector => +512M
4)      t => for choosing the type of the partition
4.1)        number => 1
4.2)        type => uefi
5)      n => for creating a new partition
5.1)        number => default (2)
5.2)        first sector => default
5.3)        last sector => +2G (for most cases)
6)      t => for choosing the type of the partition
6.1)        number => 2
6.2)        type => swap
7)      n => for creating a new partition
7.1)        number => default (3)
7.2)        first sector => default
7.3)        last sector => ENTER => to use all the remaining space
8)      t => for choosing the type of the partition
8.1)        number => 3
8.2)        type => ext4
9)      p => to print the newly designed partition table
Those commands create three partitions: sda1, sda2, sda3. The first partition will contain some files related to the bootloader, which is the program responsible for the initialization of the Linux kernel. The second partition will be used as a swap space, which is used to release the RAM when it is being heavily used. Finally, the third partition is where the system resides.
Formatting the disks
In order for the partitions to be used, they need to be formatted, i. e., they need to receive a file system structure. The first partition, from now on called EFI partition, will be formatted as FAT32, a very popular file system in the Windows Operating System world. The second partition will be formatted appropriately and will be named SWAP, and the third partition will be formatted as EXT4, which is a very popular file system in the Linux universe. Here are the commands:
mkfs.fat -F 32 -n EFI /dev/sdb1
to format sdb1 as FAT32 and name it as EFI
mkswap -L SWAP /dev/sdb2
to format sdb2 as swap and name it as SWAP
mkfs.ext4 -L ROOT /dev/sdb3
to format sdb3 as EXT4 and name it as ROOT
Mounting the disks
It is strongly advisable that the partitions be mounted in the following order:
mount /dev/sdb3 /mnt
to mount sdb3, the ROOT partition
swapon /dev/sdb2
to mount sdb2, the SWAP partition
mount /dev/sdb1 /mnt/boot/efi
to mount sdb3, the ROOT partition
Now it is important to see if the partitions are correctly mounted:
lsblk | grep "sdb"
to list the block devices containing the word "sdb"
Installing the basic packages
The packages chosen to be installed in this text are far beyond the bare minimum needed to run Arch Linux. In fact, they represent a combination which fits the needs of most desktop users. A brief description of them is:
  1. linux => The Linux kernel and modules
  2. linux-firmware => Firmware files for Linux
  3. intel-ucode => Microcode update image for Intel CPUs
  4. amd-ucode => Microcode update image for AMD CPUs
  5. base => Minimal package set to define a basic Arch Linux installation
  6. grub => GNU GRand Unified Bootloader (2)
  7. efibootmgr => Linux user-space application to modify the EFI Boot Manager
  8. nano => Pico editor clone with enhancements
  9. sudo => Give certain users the ability to run some commands as root
  10. xorg => The most popular display server among Linux users
  11. lxdm => Lightweight X11 Display Manager
  12. lxqt => A desktop built on Qt which partly uses Razor-qt and LXDE components
  13. oxygen-icons => The Oxygen Icon Theme
  14. networkmanager => Network connection manager and user applications
  15. nm-connection-editor => NetworkManager GUI connection editor and widgets
  16. network-manager-applet => Applet for managing network connections
So, the command to install the packages is:
pacstrap /mnt linux linux-firmware intel-ucode base grub efibootmgr nano sudo xorg lxdm lxqt oxygen-icons networkmanager nm-connection-editor network-manager-applet
to install a bunch of packages needed to have a fully functional system
Defining the partitions to be mounted automatically by the system
When Linux starts, some partitions can be started automatically, and these partitions have to be declared in a file called fstab, located at /etc/mnt. In addition, in the case of the partitions created during this installation, it is required that they be mounted automatically at every system startup. Here is the command that generates an appropriate fstab:
genfstab -U /mnt > /mnt/etc/fstab
to create fstab, the file where automatically mounted partitions must appear
It is important to see the content of the file and check if sdb1 (EFI), sdb2 (SWAP) and sdb3 (ROOT) are there:
nano /mnt/etc/fstab
to check if EFI, SWAP and ROOT are written in fstab
Getting into the newly installed system
The necessary files of the system are already installed. So it is time to leave the installation environment, using the chroot command, which allows the user to enter the new system as root and use the system applications, although the kernel in use is still that of the installation system. Here is the command:
arch-chroot /mnt
to start using the newly installed system applications
Setting the root password and creating a new user
The root user, who is the highest privilledged powerful user, is already present. However, its password must be set. The following command does the job:
passwd root
to set the root password
The root must be used only in very exceptional and especific tasks, and with maximum care. Therefore, it is mandatory to create a user who can have root privilleges when necessary. To create a new user called myuser, it is executed the useradd command, with the parameter m to also create a home directory for him/her:
useradd -m myuser
to create a new user called myuser and a personal directory for him/her
To set the new user password:
passwd xx_user
to set the new user password
Now, to make the user able to have root privilleges, his/her name must be included in a special file called sudoers. To open the file:
nano /etc/sudoers
to open the file containing eventual superusers
In that file, the word root must be located, and, after the changes, it should appear something like this:
root ALL=(ALL) ALL
myuser ALL=(ALL) ALL
After saving the changes to the sudoers file, the user myuser will be able to have root privilleges, when using the application sudo, which was installed in a previous section.
Giving names to the system
The system must be given a name. Assuming that the name is my-arch-linux, it should be written in the file called hostname
nano /etc/hostname
to give a name to the system
The above file should contain the following name, or other more specific:
Now, the file hosts must be edited and contain the lines shown immediately after the command:
nano /etc/hosts
to create names for the system
The file hosts should look like this:       localhost
::1             localhost       my-arch-linux
In a browser, when the user types localhost, the browser should go to, and when the user types my-arch-linux, the browser should go to The names and addresses in hostname and hosts depends on specific uses of the system. For example, if it is a server hosting a website called, it should be given a name equal to the website's name.
Installing and configuring the bootloader
This is the most delicate part of the installation process. There are, at least, three well known bootloaders apt to be installed here: GRUB, SYSLINUX, REFIND. Nowadays, GRUB is the most common, albeit complicated and sometimes troublesome, bootloader. For the sake of popularity, GRUB is going to be used in this installation. For more information about the differences between bootloaders, and their respective installation, it is recommended to visit this link.
Once more, the block devices (disks) are going to be checked:
lsblk | grep sdb
to list the block devices to be used in this installation
Now, the user should check whether the /boot/efi directory exists. If it appears in the output of lsblk command, everything is all right. If it does not, the directory /boot/efi should be created through mkdir -p /boot/efi and the related partition should be mounted through mount /dev/sdb1 /boot/efi. Once more, the user should try to go to the /boot/efi directory, through cd /boot/efi. The installation can continue only if /dev/sdb1 is mounted on /boot/efi.
The following command installs the bootloader on /boot/efi
grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi
to install the bootloader
The bootloader identification is GRUB or whatsoever, and it will appear on the motherboard setup program (BIOS setup program).
The GRUB bootloader has a utility that creates the configuration file:
grub-mkconfig -o /boot/grub/grub.cfg
to generate the GRUB configuration file
The output of the previous command is relevant. It must show some text confirming that some files (like the kernel) are found. This output cannot be empty.
It is very likely that everything is correctly set up hitherto. Then, it is about time to prepare the computer to be shut down, according to the following steps:
to leave the newly installed system and come back to the Arch Linux installation system
shutdown -h now
to leave the Arch Linux installation system and turn off the computer
With the computer off, the installation medium (in the case of this tutorial, a USB stick) must be removed and then the computer be powered on. Soon after turning on the computer, it is necessary to access the BIOS setup to adjust the correct boot order: the disk where the system is installed must be the first in the boot priority. It should be remebered that this text instructs how to install Arch Linux by means of the UEFI standard. So, when setting up the BIOS, options like "legacy" or "MBR" have to be avoided.
Finally, the system is able to be initiated smoothly. After typing the user (preferably, not the root) and the password, the following commands should make the user able to connect to the internet and to enter the desktop environment.
In the command prompt, some services need to be enabled. The first one is the service which handles the internet:
systemctl enable NetworkManager.service
to make the network manager be started automatically
The second service is the display manager, which is responsible for loading the graphical environment:
systemctl enable lxdm.service
to make the Light X Display Manager be started automatically
to reboot the system in a way that the user is now able to login through a graphical environment
That is all. Further configurations regarding the newly installed Arch Linux is found in the next tutorial. By the way, things are much easier from now on, since the user can benefit from the facilities provided by the desktop environment called LXQT.