Skip to content

This is a work in progress.

As always you should NEVER follow someone else's guide, refer only to the official installation guide.

Set the system

Bigger font

setfont ter-v32n

Set the keyboard layout if needed

ls /usr/share/kbd/keymaps/**/*.map.gz.
loadkeys de-latin1

Verify the boot mode [UEFI/BIOS]

ls /sys/firmware/efi/efivars

If the directory does not exist, the system is booted in BIOS mode. If the directory exists, the system is booted in UEFI.

Check the connectivity to the Internet

ping archlinux.org

You may need to do systemctl restart dhcpcd if you pluged in a cable after booting

Update the system clock

timedatectl set-ntp true

Partition the disks

Partitions needed. For UEFI - GPT and UEFI - MBR. / /boot

Partitions needed for BIOS and MBR. /

Other partitions (Not included in this guide). /home /var swap

Identify existing partitions.

fdisk -l

\ Partiton table \ GPT

Securely delete the hard drive [NOT TESTED]

cryptsetup open --type plain -d /dev/urandom /dev/sdXY to_be_wiped
dd if=/dev/zero of=/dev/mapper/to_be_wiped status=progress
cryptsetup close container

Create partitions

SSD and HDD

Delete existing partitions fdisk /dev/sda g # To create a new empty GPT partition table w # To write the changes

Create partitions

fdisk /dev/sda
  boot partition
    n # New partition
      1 # Partition number 1
      default: 2048 # Default block to start
      +512M # Size for the boot partition
    t # Change the partition type
      # 1 # Selected partition 1 automaticaly
      1 # EFI system [It works] [I think it should be 4 BIOS boot]
  / partition
    n # New partition
      2 # Partition number 2
      default: xx # Leave it as is
      default: yy # Leave it as is if you want to take the rest of the space for / partition
    t # Change the partition type (It may not be needed)
      2 # Partition number
      20 # Type of partition Linux filesystem
    w  # Write the changes

LVM

Delete if you fucked it up We know you'r gonna fuck it up

vgremove system
vgremove data

Create the physical volume

pvcreate /dev/sda2
pvcreate /dev/sdb1

Create a volume group

vgcreate system /dev/sda2
vgcreate data /dev/sdb1

Create logical volumes

lvcreate -l 100%FREE system -n root
lvcreate -L 30G data -n var
lvcreate -l 100%FREE data -n home

LUKS

Encrypt the partions

DO NOT ENCRYPT /boot [it can be done but in the future]
    IT USES SOME RAM (should use around 3GB)
    cryptsetup -v --cipher aes-xts-plain64 --key-size 512 --hash sha512 --iter-time 5000 --use-urandom -y luksFormat --type luks2 /dev/sdXY

Open the encrypted partitions

cryptsetup open /dev/sdXY cryptroot
    cryptsetup open /dev/sdXY crypthome

Close the encrypted partitions

cryptsetup close /dev/mapper/crypthome

Backup the LUKS Header

sudo cryptsetup luksHeaderBackup /dev/sdXY --header-backup-file luks-backup

Restore the LUKS Header

sudo cryptsetup luksHeaderRestore /dev/sdXY --header-backup-file luks-backup

Format the partitions

fdisk -l
mkfs.vfat /dev/sda1
mkfs.ext4 /dev/mapper/cryptroot
mkfs.ext4 /dev/mapper/crypthome

Mount the partitions

mount /dev/mapper/cryptroot /mnt
  mkdir /mnt/boot
  mkdir /mnt/home
  # mkdir /mnt/var
  mount /dev/sda1 /mnt/boot
  mount /dev/mapper/crypthome /mnt/home
  # mount /dev/mapper/data-var /mnt/var

Update mirrors and rank the mirrors REDO [this method may take over 20 mins]. You may need pacman-contrib

rm /etc/pacman.d/mirrorlist
curl -o /etc/pacman.d/mirrorlist.new https://archlinux.org/mirrorlist/all/
sed -i 's/^#Server/Server/' /etc/pacman.d/mirrorlist.new
rankmirrors -n 6 /etc/pacman.d/mirrorlist.new > /etc/pacman.d/mirrorlist

Install base system

pacstrap /mnt base base-devel linux linux-firmware

Configure the system

Change the root to the new system

  # arch-chroot /mnt
  # pacman -S vim git intel-ucode

Time, date and time zone

# ln -sf /usr/share/zoneinfo/Europe/Madrid /etc/localtime
  \\ hwclock --systohc # Update hardware clock

Locale

# vim /etc/locale.gen
    ***
    en_US.UTF-8 UTF-8
    ***
  # locale-gen \\ Generate locales
  // This is the recommended way and they will not be applied until relogin
  # localectl set-locale LANG=en_US.UTF-8 && locale-gen
  \\ vim /etc/locale.conf
  \\   Does the same as the above command
  \\   ***
  \\   LANG=en_US.UTF-8
  \\   ***

Hostname

# echo whatever > /etc/hostname

Network configuration with NetworkManager

# pacman -S networkmanager dhclient
  \\ pacman -S network-manager-applet
  # systemctl enable NetworkManager
  \\ nmtui # TUI used to configure the network

Network configuration with systemd

# ip l
  # cp /etc/netctl/examples/ethernet-static /etc/netctl/enp3s0
  # vim /etc/netctl/enp3s0
    ***
    Description='LAN'
    Interface=enp3s0
    Connection=ethernet
    IP=static
    Address=('10.0.0.154/24') # change IP
    #Routes=('192.168.0.0/24 via 10.0.0.1')
    Gateway='10.0.0.1'
    DNS=('1.1.1.1')
    ***

Root password

# passwd

Swap file

# fallocate -l 8G /var/swapfile
  # chmod 600 /var/swapfile
  # mkswap /var/swapfile
  # vim /etc/fstab
    ***
    /var/swapfile none swap defaults 0 0
    ***
  # vim /etc/sysctl.d/99-sysctl.conf
    ***
    vm.swappiness=1
    ***

Boot loader [Systemd-boot] [UEFI] [GPT]

# bootctl --path=/boot install
  # vim /boot/loader/loader.conf
    ***
    default arch
    timeout 4
    # editor  0
    ****
  Get the UUID of cryptroot
    # lsblk -no UUID /dev/sdXY
    # blkid
  # vim /boot/loader/entries/arch.conf
    \\ Tip: in vim ":r !blkid" adds the output of "blkid" to the file for the drive /dev/sda2
    \\ Tip: use "v" to enter "Visual" mode to select, and "y" and "p" to copy and paste the UUID
    ***
    title   Archlinux
    linux   /vmlinuz-linux
    initrd  /initramfs-linux.img
    initrd  /intel-ucode.img
    #options rw cryptdevice=UUID=XYXYXYXY:cryptroot root=/dev/mapper/cryptroot
    options root="UUID=cfda7b5a-486d-4c80-a436-c22f519ef745" rw
    ***

Show all the boot loader entries

bootctl list

Reboot into one of them

systemctl reboot --boot-loader-entry=auto-windows

Boot loader [grub] [BIOS]

# pacman -S grub
  # grub-install --target=i386-pc /dev/sdX
  # grub-mkconfig -o /boot/grub/grub.cfg

WIP Boot loader [grub] [UEFI] [It won't work, but have fun :)] [Need change cryptdevice in grub.cfg or somewhere else]

Set the key in GRUB.

GRUB_CMDLINE_LINUX="cryptdevice=UUID=xxx:cryptroot cryptkey=UUID=xxx:ext4:/path/to/key"
# pacman -S grub efibootmgr
  # grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
  # grub-mkconfig -o /boot/grub/grub.cfg
  \\ from here only if encrypted partitions are used

Initramfs

# vim /etc/mkinitcpio.conf
  \\ udev encrypt lvm2
  \\ systemd sd-encrypt sd-lvm2
  \\ between block and filesystems
    ***
    MODULES=(i915) # For screen resolution at boot
    # HOOKS=(base udev ... keyboard block encrypt lvm2 filesystems)
    HOOKS=(base udev autodetect keyboard keymap consolefont modconf block encrypt filesystems fsck)
    # HOOKS=(base systemd ... keyboard block sd-encrypt sd-lvm2 filesystems)
    # HOOKS=(base systemd autodetect keyboard sd-vconsole modconf block sd-encrypt filesystems fsck) # Need changes in previous files, dont know witch ones.
    ***
  Set the keymap for the console
    # localectl set-keymap --no-convert us
    OR
    # vim /etc/vconsole.conf
      ***
      KEYMAP=us
      ***
  You can also change the font
  List the available fonts
    # ls /usr/share/kbd/consolefonts/
    # vim /etc/vconsole.conf
      ***
      FONT=eurlatgr
      ***
  Create the boot image
    # mkinitcpio -p linux

Generate the filesystem mount tables (Fstab) and tmpfs MAKE SURE YOU ARE NOT INSIDE CHROOT

# genfstab -U /mnt >> /mnt/etc/fstab
  # vim /mnt/etc/fstab
    ***
    # Change the following to /
    rw,noatime,data=ordered

    #tmpfs
    tmpfs /tmp tmpfs rw,nodev,nosuid,size=2G 0 0
    ***
  \\ Add discard as options to trim SSDs. It may give problems (destroy the files)
  \\ Check tmpfs
  \\   findmnt --target /tmp
  \\   # Size of tmpfs
  \\   df -kh

Configure swap [if activated inside chroot and when configured fstab NOT needed]

# mkswap /dev/sdXY
  # vim /mnt/etc/fstab
    \\ lsblk -no UUID /dev/sdXY
    ***
    UUID=<UUID> none swap defaults 0 0
    ***

Decrypt volumes at boot (Crypttab)

# vim /etc/crypttab
    \\ Name to open volume | UUID of /dev/sdXY not /dev/mapper/crypthome | none | luks
    ***
    crypthome UUID=fd20ea9c-496b-4db9-a7a2-27fb56d3808d none luks
    ***

Reboot

# umount -R /mnt
  # reboot

Add new user

useradd -m -G wheel,storage,power,audio $USER
  passwd $USER

Add sudo permissions to users in wheel group

visudo
  ***
  %wheel ALL=(ALL) ALL
  ***

Add users to wheel group [NOT NEEDED unless you did not add secundary groups while creating the user]

usermod -a -G wheel $USER

AUR (Arch User Repository) pacaur and/or yaourt Install yay

sudo pacman -S go
    mkdir /tmp/yay && cd /tmp/yay
    curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=yay
    makepkg -i PKGBUILD --noconfirm
    cd ~ && rm -r /tmp/yay

yay statistics

yay -Ps

Video drivers for thinkpad

//vim /etc/pacman.conf
  //  ***
  //  [multilib]
  //  Include = /etc/pacman.d/mirrorlist
  //  ***
  # pacman -Syu
  # pacman -S mesa xf86-video-intel
  // pacman -S lib32-mesa
  // pacman -S libva-intel-driver libva-utils
  // Verify VA-API
  //vainfo
  // xf86-video-vesa is not installed (Install if needed)
  // For more information
  // https://wiki.archlinux.org/index.php/Intel_graphics

Video Drivers for Nvidia

Multilib repository must be enabled for 32bit drivers
  // For GTX 550 TI
  # pacman -S nvidia-390xx nvidia-utils nvidia-390xx-lts lib32-nvidia-390xx-util
  // For GTX 770
  # pacman -S nvidia nvidia-utils nvidia-lts lib32-nvidia-utils

Xorg

pacman -S xorg-server xorg-xbacklight
  # xorg-xinit # If you don't use a Display Manager
  # xorg-apps # Is also available
  # xorg # Ss an alternative package with includes more packages and xf86-video-vesa

Audio drivers

# ALSA is installed by default. If you have any problem it may be muted.
  sudo pacman -S alsa-utils
  alsamixer

Pulseaudio (people do NOT recommend it) (I find it simple, but not user friendly)

pulseaudio package.
Note: Some PulseAudio modules have been split from the main package and must be installed separately if needed.

    For PulseAudio to manage ALSA as well, install the pulseaudio-alsa package, see #ALSA.
    For bluetooth support (Bluez), install the pulseaudio-bluetooth package, see bluetooth headset page.
    For equalizer sink (qpaeq), install the pulseaudio-equalizer package.
    For GConf support (paprefs), install the pulseaudio-gconf package.
    For JACK sink, source and jackdbus detection, install the pulseaudio-jack package.
    For infrared (LIRC) volume control, install the pulseaudio-lirc package.
    For Zeroconf (Avahi/DNS-SD) support, install the pulseaudio-zeroconf package.

Change keyboard layout with keyboard shorcuts

/etc/X11/xorg.conf.d/00-keyboard.conf
-------------------------------------
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "es,us"
        Option "XkbModel" "pc104"
        #Option "XkbVariant" ",dvorak"
        Option "XkbOptions" "grp:alt_shift_toggle"
EndSection

That will be Alt+Shift

Available key names

grep "grp:.*toggle" /usr/share/X11/xkb/rules/base.lst

/etc/fstab

in vim :r !blkid to get the UUID from inside vim

# Encrypted / drive
UUID=XXX  /  ext4  rw,noatime  0 1

# Swap file
/var/swapfile  none  swap  defaults  0 0

# Swap partition
/dev/sdb1  none  swap  defaults  0 0

# TMPFS
tmpfs  /tmp  tmpfs  rw,nodev,nosuid,size=2G  0 0

# External HDD
UUID=XXX  /mnt  ext4  rw,user,noatime,noauto  0 2

# FAT32 From Windows
UUID=XXX  /mnt  vfat  noauto,mask=000,fmask=0111,user  0 2

# Samba
//server/share  /mnt  cifs  credentials=/home/username/.smbcredentials,uid=shareuser,gid=sharegroup 0 0
//server/share  /mnt  cifs  username=USERNAME,workgroup=WORKGROUP,iocharset=utf8,uid=LOCALUSER,gid=LOCALGROUP 0 0


----------
# For samba
/home/username/.smbcredentials
--
username=shareuser
password=sharepassword
domain=domain_or_workgroupname
--
chmod 0600 ~/.smbcredentials
--

Mount partitions

# Samba server
sudo mount -t cifs //server/shared /mnt -o username=USERNAME,workgroup=WORKGROUP,iocharset=utf8,uid=LOCALUSER,gid=LOCALGROUP

sensors

https://askubuntu.com/questions/748615/how-to-make-lm-sensors-return-cpu-temp-it87

TODO

Wifi setup to install For wireless connections, iw(8), wpa_supplicant(8) and netctl are available. See Wireless network configuration.