Arch Linux Installation Notes

Boot Live ISO

Make a bootable media. There are many ways to do that. My personal favorite is using gnome-disks utility and select restore image to write the arch linux ISO onto a USB drive. Insert the drive and boot up your motherboard BIOS by pressing DEL or whatever shortcut key.

I assume you are having a UEFI motherboard which is what is common today. Check from your motherboard bios screen that UEFI mode is selected. Now boot from the USB drive into the live linux environment.

Partitions

#efivar -l //tocheck if booted in EFI mode. No output means no EFI.

The first thing needing your attention is your partitions. This post assumes that you will be making installation on the second disk sdb. Use cfdisk for this purpose. Remember to write partitions at the end:-

#cfdisk /dev/sdb

At the end of this exercise use fdisk to check completed partition setup. If you need some graphical aid in resizing partitions then you may like to use gparted but thats not available now. You will need to boot a live distro which has gparted.

This is my sample partition setup. sdb1 is the key UEFI partition here. This is where your boot loader is going to be installed. sdb2 is the root where linux is going to be installed. sdb3 is not used here.

#fdisk -l /dev/sdb

Device       Start    End Sectors Size Type
/dev/sdb1    2048 1050623 1048576 512M EFI System
/dev/sdb2    1050624 209717247 208666624 99.5G Linux filesystem
/dev/sdb3    209717248 1921525759 1711808512 816.3G Linux filesystem
/dev/sdb4    1921525760 1953523711 31997952 15.3G Linux swap

Prepare partitions

 #mkfs.fat -F32 /dev/sdb1
 #mkfs.ext4 /dev/sdb2
 #mount /dev/sdb2 /mnt
 #mkswap /dev/sdb4 //not req if already formatted as a swap area.
 #swapon /dev/sdb4

Network
Bring up network. Network is mandatory for Arch installation. To avoid complexity at this stage I use my phone which is already connected on WiFi on a USB tether.

#ip link //check the output for something like enp...
#dhcpcd enp0s20u3u1 //In my case. You should be connected after this.

Install
Install base Linux as per standard arch install instructions at https://wiki.archlinux.org/index.php/installation_guide

#pacstrap /mnt base base-devel
#arch-chroot /mnt        //entering chroot
#passwd                  // set your root passwd
#nano /etc/locale.gen    // Uncomment your locale ex:- en_US.UTF-8
#locale-gen
#ln -sf /usr/share/zoneinfo/Asia/Calcutta /etc/localtime //My timezone
#localectl set-locale LANG="en_US.UTF-8" //need this for gnome terminal
//else it does not launch later
#hwclock --systohc --utc
#echo archBox > /etc/hostname

Setup Package Manager

#nano /etc/pacman.conf

//uncomment following 2 lines
[multilib]
Include = /etc/pacman.d/mirrorlist

//add these 3 lines
[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch

#pacman -Syu //sync database

Setup Bootloader

We are going to go totally systemd and use systemd boot which is a light and pure UEFI boot manager and not grub

#mkinitcpio -p linux
#pacman -S efibootmgr
#cd /boot
#mkdir efi
#mount /dev/sdb1 /boot/efi
#mkdir /boot/efi/archmain
#cp /boot/vmlinuz-linux /boot/initramfs-linux.img /boot/efi/archmain
#bootctl --path=/boot/efi install
#nano /boot/efi/loader/loader.conf
      //insert these 2 lines
      default archmain
      timeout 3
#nano /boot/efi/loader/entries/archmain.conf
       //insert these 4 lines
      title Arch Linux
      linux /archmain/vmlinuz-linux
      initrd /archmain/initramfs-linux.img
      options root=/dev/sda2 rw  //You can later change this into PARTUUID

Complete base setup

#exit //leaving chroot
#genfstab /mnt >> /mnt/etc/fstab
#cd /
#umount /mnt
#reboot //login as root
#useradd -m -g users -G wheel -s /bin/bash lakshman //your username here
//in /etc/sudoers uncomment wheel and sudo entries
//add user below sudo in same format
#passwd lakshman
#exit

Bring up Graphical Environment [X , xfce4 and gdm]
Also check out http://www.tecmint.com/install-cinnamon-desktop-in-arch-linux/ for setting up the video drivers

//login as lakshman
//Bring up network like described before
$sudo pacman -Syu
$sudo pacman -S xorg-server xorg-utils xorg-xinit xorg-server-utils xorg-twm xterm xorg-xclock xorg-apps
mesa dialog wpa_supplicant leafpad git dkms linux-headers bash-completion
$lspci | grep VGA // to identify your video manufacturer
$sudo pacman –Ss | grep xf86-video //to identify corresponding driver
$sudo pacman -S xf86-video-intel //xf86-video-intel identified
$sudo pacman -S xfce4 xfce4-goodies cinnamon nemo-fileroller gdm
$sudo systemctl enable gdm
$sudo systemctl start gdm 
//You should be in xfce now
//open gnome-terminal
$sudo pacman –S net-tools iw networkmanager network-manager-applet
$sudo systemctl enable NetworkManager
//reboot now and login
$ifconfig //to check if your networking device is there
//Ex:- en01:ethernet wired, wlp0s20u10:wifi
//Now use network applet to setup your network
$sudo pacman -S yaourt //AUR repository
$yaourt -S pamac-aur //package manager applet in system tray

Install some Apps with Package Manager GUI

Sample:-
pulseaudio pulseaudio-alsa pavucontrol alsa-utils gnome-terminal firefox flashplugin vlc unzip unrar zip p7zip
 firefox flashplugin gksu leafpad xdg-user-dirs gparted, brasero, dosfstools, transmission,
 gnome-disks, xfburn, libreoffice, geany, cups-pdf, screenfetch, mpg123, seahorse, arc-gtk-theme,
 gnome-disk-utility, google-chrome, pix, ttf-roboto, ttf-droid, jdk

Last Steps

Setup mkinitcpio hooks for moving kernel and initramfs from /boot into /boot/efi/archmain. Also check mkinitcpio hook2 at https://wiki.archlinux.org/index.php/EFISTUB#Using_systemd

# sudo nano /etc/mkinitcpio.d/linux.preset
# /etc/mkinitcpio.d/linux.preset 
# mkinitcpio preset file for the 'linux' package

# Directory to copy the kernel, the initramfs...
ESP_DIR="/boot/efi/archmain"

ALL_config="/etc/mkinitcpio.conf"
ALL_kver="/boot/vmlinuz-linux"

PRESETS=('default' 'fallback')

#default_config="/etc/mkinitcpio.conf"
default_image="${ESP_DIR}/initramfs-linux.img"
default_options="-A esp-update-linux"

#fallback_config="/etc/mkinitcpio.conf"
fallback_image="${ESP_DIR}/initramfs-linux-fallback.img"
fallback_options="-S autodetect"
$sudo nano /usr/lib/initcpio/install/esp-update-linux
$sudo chmod +x /usr/lib/initcpio/install/esp-update-linux
# /usr/lib/initcpio/install/esp-update-linux
# Directory to copy the kernel, the initramfs...
ESP_DIR="/boot/efi/archmain"

build() {
 cp /boot/vmlinuz-linux "${ESP_DIR}/vmlinuz-linux"
 # If ucode is used uncomment this line
 cp /boot/intel-ucode.img "${ESP_DIR}/"
}

help() {
 cat <<HELPEOF
This hook copies the kernel to the ESP partition
HELPEOF
}

Test the hooks

sudo mkinitcpio -p linux

Also check that kernel and initramfs are going to the correct place in /boot/efi/archmain by updating linux kernel when you get the chance. With this setup you should be having a kernel copy in /boot on the sdb2 partition which is copied into /boot/efi/archmain. The initramfs-linux.img is directly installed in /boot/efi/archmain.

LTS Kernel

If you need to use a LTS kernel for stability concerns install linux-lts and linux-lts-headers. This includes installation of vmlinuz-linux-lts, initramfs-linux-lts.img, initramfs-linux-lts-fallback.img and linux-lts.preset. If you have followed the steps for setting up the kernel paths for linux kernel setup the approach for linux-lts kernel is similar. Note the “-lts” filename difference.

$sudo mkdir /boot/efi/archmain-lts
$sudo nano /boot/efi/loader/entries/archmain-lts.conf
$sudo nano /etc/mkinitcpio.d/linux-lts.preset
$sudo nano /usr/lib/initcpio/install/esp-update-linux-lts
//finally put the kernel and initramfs in place
$sudo mkinitcpio -p linux-lts

Now the LTS kernel will be available as a second boot option in the Linux Boot Manager.

Author: admin

Indie Android dev

Leave a Reply

Your email address will not be published. Required fields are marked *