User:Erkexzcx

From ArchWiki

Arch Linux installation

Internet connectivity

Connect to the Internet

Use command ping www.google.com to confirm working internet connection.

Ethernet (cable)

In most cases, it should work out of the box. If it doesn't work, run dhcpcd and wait about 15-30 seconds and internet should be working.

Wireless (WiFi)

See Iwd#iwctl.

Partitioning

Use lsblk and lsblk -f to see the information about your detected hard drives and their partitions.

Destroy all partitions

This completely destroys all data on your /dev/nvme0n1 SSD:

# sgdisk --zap-all /dev/nvme0n1

Create partitions

Create 2 partition on your hard drive - one is for EFI installation, second is for Arch Linux installation. Type command cgdisk /dev/nvme0n1 to enter interactive CLI menu.

First, delete all the partitions (if any).

Then create new partition, first sector is default size suggested (just press enter), but for last sector, write +500M and hit enter. Partition code is ef00 and give any partition title you want (I suggest EFI).

Then create new partition, first and last sector is default size suggested (just press enter). Partition code is also default (should be 8300) and give any partition title you want (I suggest ROOT).

At the end - write and quit. Use lsblk and lsblk -f to confirm your new partitions - first should be the size of approximately 500Mb and the other partition should be the rest of your hard drive size.

Format partitions

The new created partitions cannot be used until you format them.

Format the first EFI partition (the one that has about 500Mb space):

# mkfs.fat -F32 /dev/nvme0n1p1

Then format second partition (the one that has the rest of hard drive space):

# mkfs.btrfs /dev/nvme0n1p2

Mount partitions

Mount your prepared partitions so you can write some data (files) to them:

First, mount the second partition (the one that has the rest of your hard drive size) to /mnt directory :

# mount -o compress=zstd /dev/nvme0n1p2 /mnt

Then mount EFI partition to that boot folder (it will create /mnt/boot dir automatically):

# mount --mkdir /dev/nvme0n1p1 /mnt/boot

Use lsblk and lsblk -f to confirm if you successfully mounted your partitions.

Install base Arch Linux system

Configure mirrors

Automatically update mirrorslist:

# systemctl restart reflector.service

Install system

Perform this command to install base Arch Linux installation to mounted /mnt directory:

# pacstrap /mnt base base-devel linux linux-firmware

Generate fstab

Fstab file contains what and how must be mounted during the boot. The good thing that there is an app to generate fstab file automatically for you:

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

You might also want to check if there is at least 2 lines containing information about partitions and their options:

# cat /mnt/etc/fstab

Enter the chroot mode

If you don't know what is chroot - think about logging into the installed system (AKA directory, where it is installed) with a root user, but without password. Everything you do in chroot mode will be permanent (will not be lost after reboot) and this procedure is usually used to fix existing systems when they no longer boots.

Enter Chroot mode with this command:

# arch-chroot /mnt

Set up locale

Set the US locale to your system.

Uncomment #en_US.UTF-8 UTF-8 to en_US.UTF-8 UTF-8:

# nano /etc/locale.gen

Then apply changes to the system:

# locale-gen

Also write LANG=en_US.UTF-8 to /etc/locale.conf file. This is needed for most of the programs:

# echo LANG=en_US.UTF-8 > /etc/locale.conf

Set up timezone

Create symbolic link as per below command. Ensure you replace Zone and SubZone accordingly:

# ln -sf /usr/share/zoneinfo/Zone/SubZone /etc/localtime

Example: ln -sf /usr/share/zoneinfo/Europe/Vilnius /etc/localtime

Set the hardware clock

Execute this command:

# hwclock --systohc

Set up datetime synchronisation

Enable systemd-timesyncd.service so it starts on boot, synchronizes with NTP (time) servers and sets correct datetime:

# systemctl enable systemd-timesyncd.service

Set the hostname

Just give a name to your computer (without space). Example would be ARCHLINUX:

# echo ARCHLINUX > /etc/hostname

Set the password

Use command passwd root to change root user password.

Install bootloader

We will be using the most popular bootloader GRUB.

Install required packages for grub installation & configuration:

# pacman -S grub efibootmgr

Then install GRUB as a bootloader:

# grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
Note: Check the output - if grub-install says that errors occurred, then your system will not boot.

Then (re)generate GRUB config file:

# grub-mkconfig -o /boot/grub/grub.cfg

Install other required packages

Network Manager

Note: Instead you could just install networkmanager package and forget below packages.

NetworkManager pulls all the required dependencies, so installing just that is enough:

# pacman -S networkmanager
# systemctl enable NetworkManager.service

Microcode updates

You might also want to install Microcode updates to your system:

# pacman -S intel-ucode      # For Intel processors only
# pacman -S amd-ucode        # For AMD processors only

And do not forget to update grub configuration afterwards:

# grub-mkconfig -o /boot/grub/grub.cfg

Regular user

Create user

First create new user with its home directory:

# useradd --create-home name

Then set user password:

# passwd name

Allow user to gain root access

Using visudo with nano editor edit sudoers file:

# EDITOR=nano visudo

And uncomment line # %wheel ALL=(ALL) ALL by changing to %wheel ALL=(ALL) ALL. Save the changes.

Then add your regular user to wheel group:

# gpasswd -a name wheel
Tip: If you do not want to enter password when using sudo command, then uncomment # %wheel ALL=(ALL) NOPASSWD: ALL instead.

Install desktop environment

Below command installs all the required packages for proper Plasma experience, including login manager, bluetooth, audio and xorg packages:

# pacman -S plasma dolphin konsole

Then enable sddm on boot:

# systemctl enable sddm.service

Other important steps

Install browser

You have to options

  1. Install Firefox via Flatpak.
  2. Install Firefox via pacman: pacman -S firefox

Enable Bluetooth support

Execute below command:

# systemctl enable bluetooth.service

Arch Linux on laptop

If you are installing Arch Linux on laptop (mobile) device, install tlp as it optimises power usage on laptops:

# pacman -S tlp
# systemctl enable tlp

Install AUR helper

You can install packages from the official repositories as well as AUR using single package manager called yay. See here.

Reboot

Tip: You do not have to reboot now. You can continue customizing your OS in chroot mode.

Exit the chroot mode:

# exit

Unmount partitions:

# umount /mnt/boot
# umount /mnt

Reboot computer:

# reboot

And GRUB menu should show up when computer starts to boot.

Further reading

I suggest reading these Arch Wiki pages to get familiar with Arch Linux and Arch Wiki:

  • Add Chaotir-AUR repository that has the most popular AUR packages precompiled. See here.
  • Find your hardware specific pages (e.g. ASUS_Zenbook_UX430/UX530 or ASUS_N550JV).
  • Fan_speed_control - if you want to control fan speed. Also works on majority of laptops.
  • Undervolting_CPU - Reduce heat and save power. Especially useful for laptop users.
  • Improving_performance - Title says it all.
  • Btrfs - Modern file system (EXT4 replacement), which has optimisations for SSD and other useful features.
  • List_of_applications - Arch wiki have these kind of pages as well.
  • And many more, depending on your needs...
Tip: In my opinion, the default look of XFCE is ULTRA ugly, so to make it look nice, install packages xfce-theme-manager arc-gtk-theme arc-icon-theme, then open XFCE Theme Manager GUI app and change the theme as well as icons. :) Reboot the system if some elements were not affected by theme.

How to fix completely broken system

This is just a guidance on where to start looking for issues if they cannot be fixed from the same system (e.g. system not booting up).

First, boot up Arch Linux from USB stick (live mode).

Then connect to internet (if you need it) as per instructions in User:Erkexzcx#Internet_connectivity.

Then using lsblk and lsblk -f detect which partition is Arch Linux installation and which is EFI installation. EFI should be the size of about 500Mb. Let's assume dev/sda1 is EFI partition and dev/sda2 is linux installation:

# mount /dev/nvme0n1p2 /mnt          # Mount /dev/nvme0n1p2 on /mnt directory
# mount /dev/nvme0n1p1 /mnt/boot     # Mount /dev/nvme0n1p1 on /mnt/boot directory
# arch-chroot /mnt              # Chroot to /mnt directory (our system is mounted to it)

Example 1

Lightdm is not starting or not allowing to login or access terminal.

Chroot to system, then it is likely a good idea to disable Lightdm (no longer start on boot):

# systemctl disable lightdm.service

Then reboot your system:

# exit
# reboot

Example 2

Forgot user (or root user) password.

Chroot to system, then:

# passwd user

Then reboot your system:

# exit
# reboot