arch linux

lab :: install guide

this is my arch linux install guide. it's not meant to replace the beginners guide or the install guide, but act as a quick overview of exactly what the install process entails. hopefully this will encourage those intimidated by the terminal only install process.

this setup is for my HP Envy 6t-1000 laptop. it has a 32gb ssd drive with two partitions for boot and / and the other 500gb hdd is my home. my laptop has plenty of ram so i do not use a swap. my laptop also has UEFI bios and will be using gummiboot as my boot manager.

start by downloading the arch linux install medium and burning it to a usb stick or cd. boot to the install medium (check your bios boot order) and you will be greeted by the prompt:

root@archiso ~ #

quick note about sudo

in an attempt to keep this post cleaner, i will only mention the commands needed. if permissions errors arise, preface commands with sudo as necessary.

internet

the first test is getting your internet working. out of the box there is a good chance your wifi will not work. so i start the install process via ethernet. start dhcp and try pinging a site to test your connection

  • dhcpd
  • ping www.google.com -c 3

if ethernet is not an option you can try android/iphone tethering.

view drives

next you'll need to take a look at your drives and decide on a partitioning scheme.

  • lsblk
  • lsblk -f

partitioning SSD

  • gdisk /dev/sdb
  • o (delete all)
  • n (new)

    efi boot

    • choose 1 to select 1st partition.
    • Leave start sector at default by pressing Enter
    • change end sector to +512M (it is important to keep it at this size).
    • For the type enter the code ef00 (EFI).

    root

    • use all the defaults!
    • choose 2
    • leave start
    • leave end
    • type 8300
  • p (check tables)

    Number    Start         End         Size    Code   Name
    1          2048     1050623    512.0 MiB    EF00   EFI System
    2       1050624    62533262     29.3 GiB    8300   Linux Filesystem
  • w (write the changes)

partitioning HDD

  • gdisk /dev/sda
  • o (delete all)
  • n (new)
  • home

  • use all the defaults!
  • choose 2
  • leave start
  • leave end
  • type 8300
  • w (write the changes)

check your work

  • lsblk

create file systems

  • mkfs.fat -F32 /dev/sdb1
  • mkfs.ext4 /dev/sdb2
  • mkfs.ext4 /dev/sda1
    • if you made a swap:
    • mkswap /dev/sdaX
    • swapon /dev/sdaX

check your work

  • lsblk -f

mount the file systems

  • mount /dev/sdb2 /mnt
  • mkdir /mnt/boot
  • mkdir /mnt/home
  • mount /dev/sdb1 /mnt/boot
  • mount /dev/sda1 /mnt/home

install the base system

  • pacstrap /mnt base base-devel

setup fstab

  • genfstab -U -p /mnt >> /mnt/etc/fstab

configuring the system

  • arch-chroot /mnt

you will be greeted with the prompt:

sh-4.3#

create locale file

  • remove the "#" in front of the locale(s) you need, en_US.UTF-8 in my case
  • vim /etc/locale.gen

save the file and generate the locales

  • locale-gen

locale.conf

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

setup the hostname, envy in my case

  • echo envy > /etc/hostname

install the bootloader

the mount command will most likely result in an error/warning due to it being loaded already.

  • mount -t efivarfs efivarfs /sys/firmware/efi/efivars
  • pacman -S gummiboot
  • gummiboot install

create a configuration file to add an entry for Arch Linux to the gummiboot manager

  • vim /boot/loader/entries/arch.conf

the contents of arch.conf file should be:

title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options root=/dev/sdb2 rw

^ note the value of root should be your root partition (not boot).

make sure we have a network connection after we reboot

  • systemctl enable dhcpcd.service

set root password

  • passwd

create a user, xero in my case

  • useradd -m -g users -G wheel -s /bin/bash xero

create a password for user

  • passwd xero

add user to the sudoers group

  • echo 'xero ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

exit out of the chroot, unmount and reboot

  • exit
  • umount -R /mnt
  • remove the install medium
  • reboot

if the system boots:

  • victory dance!

post install

enable the multilib repository

  • vim /etc/pacman.conf

find the following lines and remove the "#" in front of them and save.

  • [multilib]
  • Include = /etc/pacman.d/mirrorlist

using pacman

pacman is the arch linux package manager. since arch is a rolling release distribution you will be using it a lot to install, remove, and update binary packages on your machine. here's a quick rundown of the most common commands:

  • search for a package

    pacman -Ss name
  • install a package

    pacman -S name
  • remove a package

    pacman -R name
  • update a package

    pacman -U name
  • update all packages

    pacman -Syu
  • count installed packages

    pacman -Qu | wc -l

sync the package databases

  • pacman -Sy

install xorg

  • pacman -S xorg-server xorg-server-utils xorg-xinit mesa

video card drivers

it's intel in my case, but might be different for you! check out the arch wiki for more information.

  • pacman -S xf86-video-intel

trackpad drivers

  • pacman -S xf86-input-synaptics

what to do when things break

when updating with pacman -Syu sometimes things will break. if you update often, less new packages are introduced to your system at a time. this makes debugging and/or reverting offending packages easier. but here's the steps for recovery from say, a kernel panic.

  • boot the arch install iso (some suggest to install it as a recovery partition)
  • mount your partitions (run lsblk and df -h to view current drive labels, because the arch iso sometimes gets mount name precedence and will change their normal labels.)
    • mount /dev/sdb2 /mnt
    • mount /dev/sdb1 /mnt/boot
    • mount /dev/sda1 /mnt/home
  • chroot

    • arch-chroot /mnt /bin/zsh or arch-chroot /mnt /bin/bash depending on your shell preferences
    • downgrade packages. make sure you chose the old package name. remember you're not uninstalling, you're "updating" to an older version.
    • cd /var/cache/pacman/pkg
    • pacman -U old_package_name.pkg.tar.xz
      • in the case of a kernel issue revert both the linux kernel package as well as linux-headers.
  • exit chroot
  • systemclt reboot reboot

time

  • timedatectl status
  • timedatectl list-timezones
  • timedatectl set-timezone America/New_York
  • timedatectl set-time "2014-05-31 04:20:09"
  • ^ obviously use the correct localtime!

internet setup

check the configuration of your /etc/hosts file, a valid configuration looks something like this:

#<ip-address>  <hostname.domain.org>    <hostname>
127.0.0.1      localhost.localdomain    yourHostname
::1            localhost.localdomain    yourHostname

install the network tools

this will install both the necessary system packages as well as the gui network manager applet, because i'm lazy and it doesn't load all the gnome dependencies.

  • pacman -S wpa_supplicant wireless_tools networkmanager network-manager-applet gnome-keyring

make the networkmanager start on boot:

  • systemctl enable NetworkManager.service

disable dhcpcd

since networkmanager wants to be the one who handles the dhcpcd related stuff, you have to disable and stop dhcpcd:

  • systemctl disable dhcpcd.service
  • systemctl disable dhcpcd@.service
  • systemctl stop dhcpcd.service
  • systemctl stop dhcpcd@.service

enable wifi

enable the wpa_supplicant to use your wireless connection:

  • systemctl enable wpa_supplicant.service
  • permissions

    add your user to the network group:

    • gpasswd -a xero network

    turn off network interface controllers

    use your own device names from the result of the ip link command if not eth0 and wlan0

    • ip link set down eth0
    • ip link set down wlan0

    start the networking services

    • systemctl start wpa_supplicant.service
    • systemctl start NetworkManager.service

    reboot and your networking should be ready.

    if the hardware switch is still disabled:

    • systemctl enable rfkill-unblock@all.service
    • and if that *still* doesn't work, perhaps try booting into another os, enable your wifi then hard power off the device.

    at this point you should have a working system ready to build. from this point you can install your dotfiles and the desktop environment or window manager of your choice and start crafting (ricing) your personal system. i will be talking about this more in a upcoming post.