User:Imnotpathetic/UEFI Installation guide

From ArchWiki

This is a installation guide for installing Arch Linux on a UEFI computer with Grub as the bootloader, and networkmanager

Warning: This is a unofficial guide and it is entirely your responsibility if you have borked your computer in any way. Please also have the official Installation Guide opened in another tab, just in case.

Live environment

Note: Arch Linux does not support secure boot. So it is highly recommended to turn secure boot off

Once booted into the live environment, Arch Linux automatically logs in and you are presented with a shell prompt.

Verify boot mode

This installation Is for a UEFI motherboard computer. Thus, it is important to make sure that your computer has booted into the correct boot mode. To verify that you have booted into UEFI mode, you have to list the efivars directory

# ls /sys/firmware/efi/efivars

If the command shows the directory without an error, you have booted into UEFI installation. If the command does not return anything, please refer to your motherboard manual.

Installation processes

From here on, it is all installation process.

Connect to the internet

If your computer offers a Ethernet port, you have to physically plug a wire to connect to the internet. If you do not have a Ethernet port, or you are too lazy to plug your wire, you will have to connect via the iwtctl command.

Note: Keep in mind that the wifi-menu command does not work anymore (2021)
# iwctl

You will now see a new prompt [iwd]#.

[iwd]# device list

This command is going to list all your wifi adapters in your computer.

[iwd]# station DEVICE scan

The above command is going to scan and find all networks in you area.

Note: Replace DEVICE with your wifi adapter name like wlan0.
[iwd]# station DEVICE get-networks

The above command is going to list all the scanned networks

[iwd]# station DEVICE connect NETWORK_NAME
Note: Replace NETWORK_NAME with your wifi.

Type in your password and now, you will be connected to wifi. To exit type in

[iwd]# exit

Now you will need to test your internet connection. Ping a internet site you know.

# ping www.archlinux.org

If it returns you a command, then you have successfully connect to the internet.

Disk Setup

Every device is assigned a block device label example /dev/sda, /dev/nvme0n1, or /dev/mmcblk0. To recognise these devices use the lsblk command. It is recommended to use GPT partition layout to your computer. Partitioning could be done with cfdisk or fdisk or any of the tool.

Note: UEFI/MBR partition may or may not work depending on your motherboard's capabilities. If your motherboard can boot into legacy mode then it can work or if you continue the installation without verifying it, you may run into issues.

Disk Partitioning

UEFI Layout
Mount point Partition Partition type Suggested size
/mnt/boot or /mnt/efi /dev/efi_system_partition EFI system partition At least 100 MiB
[SWAP] /dev/swap_partition Linux swap More than 512 MiB
/mnt /dev/root_partition Linux x86-64 root (/) Remainder of the device
/mnt/home home_partition Home Partition Atleast 1 GiB
Note: Swap partition is not useful and could be a potential waste of space unless you have a computer which has less than 2Gib of ram.
Note: Home partition is not recommended to be used unless you have or are planning to dual-boot Arch Linux with another Linux Distribution

Formatting the Partitions

Note: Your partition table labeling depends on your block device. An /dev/sda block device when partition are labeled as /dev/sda1, /dev/sda2, etc and a /dev/nvme0n1 will be labeled as /dev/nvme0n1p1, /dev/nvme0n1p2, etc. Please refer this for mounting your partitions with the help oflsblk command

Once the disk has been partitioned, each newly created partitions should be formatted with the appropriate filesystem. For the purpose of this guide, I will be using the tried and tested, Ext4 filesystem for the root and the home partition. To format your root partition and home partition, run the command

Note: Replace dev/*_partition with the appropriate block device path
# mkfs.ext4 /dev/dev_root_partition && mkfs.ext4 /dev/home_partition

Now, you will need to format your boot partition. So run the command

# mkfs.fat -F32 /dev/efi_system_partition
Warning: It is highly recommended to format your EFI system partition in Fat32 filesystem. UEFI motherboards do not recognize filesystems other than Fat32, you would not be able to boot into your computer if you format the partition with other filesystems other than Fat32

Now you will need to format swap partition, so run the command

# mkswap /dev/swap_partition

Mount the Partitions

Mount the root device to /mnt

# mount /dev/root_partition /mnt

Create a new mount point /mnt/boot and mount the EFI partition by running the command

# mkdir /mnt/boot && mount /dev/efi_system_partition /mnt/boot
Note: EFI system partition can also be mounted on /mnt/efi or /mnt/boot/efi but this mount point is the most sane and common one/

Create a new mount point /mnt/home and mount the home partition by running the command

# mkdir /mnt/home && mount /dev/home_partition /mnt/home

Now, verify your partition table by running the command lsblk. If your mount points assigned are

# lsblk
block device label
├─root_partition                 /mnt
├─efi_system_partition           /mnt/boot
└─home_partition                 /mnt/home

Then you have completed probably the most difficult step.

Installing essential packages

Packages must be installed with the help of pacstrap command. You can change the mirror with the help of reflector command. To install packages punch the command

# pacstrap /mnt base linux linux-firmware