UP | HOME
Kristian Alexander P

Kristian Alexander

Free Software Enthusiast | GNU Emacs User

Archlinux on HP Probook 4420s

Published on Mar 13, 2022 by Kristian Alexander P.

This is how I setup my archlinux on HP Probook 4420s:

probook-4420s.jpg

Partitions

header-args: :exports both
lsblk /dev/sda
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    0 232.9G  0 disk
|-sda1   8:1    0     1M  0 part
|-sda2   8:2    0   500M  0 part /boot
|                                /efi
|-sda3   8:3    0     4G  0 part [SWAP]
`-sda4   8:4    0 228.4G  0 part /home
                                 /
blkid /dev/sda*
/dev/sda: PTUUID="8cb2d283-12d9-1b4a-a243-b67401089ded" PTTYPE="gpt"
/dev/sda1: PARTUUID="55e8ee87-ca6e-6845-a950-6b0fe7c9b83f"
/dev/sda2: LABEL_FATBOOT="EFI" LABEL="EFI" UUID="B62E-3C95" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="6dd9fef5-d5f3-7748-8ccc-38f188314920"
/dev/sda3: LABEL="swap" UUID="beec6b47-9a1c-41d9-aee7-babfbe0be198" TYPE="swap" PARTUUID="d67a8634-fc47-0a44-810e-41efaac903eb"
/dev/sda4: LABEL="root" UUID="654e6dbd-97f7-4aa6-8243-3afa51153038" UUID_SUB="a80dcbd5-16e0-46fe-a165-aeffb916c54a" BLOCK_SIZE="4096" TYPE="btrfs" PARTUUID="4cdbfe1d-aefb-3a49-a0bd-a6eea749d2f1"

btrfs subvolumes

sudo btrfs subvolume list /
ID 256 gen 89902 top level 5 path @
ID 259 gen 80884 top level 256 path @/home
ID 260 gen 96591 top level 259 path @/home/arch
ID 263 gen 89901 top level 256 path @/snapshots
ID 267 gen 88978 top level 256 path @/guix
ID 268 gen 89901 top level 256 path @/data
ID 269 gen 85827 top level 268 path @/data/music
ID 270 gen 89903 top level 256 path @/arch
ID 271 gen 96591 top level 270 path @/arch/root
ID 272 gen 89918 top level 271 path var/lib/portables
ID 273 gen 89919 top level 271 path var/lib/machines

Bootloader

I’m using refind, with no modification on the main configuration(refind.conf), but since I’m mounting the EFI partition on /efi and the /boot partition is actualy a bind mount to /efi/EFI/arch/, the only modification needed is in the refind_linux.conf, which basically points to where my root partition is.

cat /boot/refind_linux.conf
"Normal Boot" "root=PARTUUID=4cdbfe1d-aefb-3a49-a0bd-a6eea749d2f1 rw rootflags=subvol=@/arch/root initrd=EFI\arch\intel-ucode.img initrd=EFI\arch\initramfs-%v.img"

The main reason why I choose refind is convenience, I often install other linux distro on this laptop, usually for testing. And with refind I don’t need to setup bootloader for other distro, I just need to setup the boot partition under the /efi/EFI, configure the refind_linux file(this is because refind needs to knows where the initrd files and the root partition for the specific kernel), and refind will automatically adds it to the boot menu. The same reason why I chose the btrfs filesystem.

Archlinux packages

header-args: :tangle no :exports both

These are the packages I’ve installed apart from the obvious(such as filesystem packages, networking packages etc) of course.

essential packages

sudo pacman -S --noconfirm --needed wget screen emacs git htop bash-completion
wget
Network utilities for retrieving files from the web.
screen
Terminal multiplexer, nothing special, I’m just never used tmux, plus screen is usually available on many linux installer by default.
emacs
For writing this of course.
htop
Monitoring stuffs.
bash-completion
TAB-ing is like a bad habit for me.

emacs packages

Emacs packages usually handled by it’s own package manager, but some of the packages also needed other functionalities provided by the OS:

sudo pacman -S --noconfirm --needed w3m fd libvterm
w3m
I personally like it more than the defaultl eww (emacs web wowser).
fd
It’s an alternative to the GNU Findutils.

xorg

sudo pacman -S --noconfirm --needed xorg

In arch, xorg is a package group, although I can choose to install individual packages manually, eventually I’ll installed them all.

video driver

sudo pacman -S --noconfirm --needed xf86-video-intel

Usually using kernel modesettings method is better. But using this package I don’t have to setup additional backlight configuration(apart from the xorg.conf).

input driver

cat /etc/X11/xorg.conf.d/30-touchpad.conf

The driver itself already installed(xf86-input-libinput) by default.

xinit

sudo pacman -S --noconfirm --needed xorg-xinit

It’s not needed when using display manager (lightdm etc).

additional packages

sudo pacman -S --noconfirm --needed bash-completion  pass pass-otp sbcl
  • Networking
    sudo pacman -S --noconfirm --needed blueman network-manager-applet
    
    blueman
    for bluetooth
    network-manager-applet
    obviously because I’m using Network Manager.
  • mail packages
    sudo pacman -S --noconfirm --needed notmuch isync goimapnotify msmtp msmtp-mta
    
  • multimedia
    sudo pacman -S --noconfirm --needed beets mpv pulseaudio pulseaudio-{alsa,bluetooth,equalizer}
    
  • fonts
    sudo pacman -S --noconfirm --needed ttf-fantasque-sans-mono gnu-free-fonts bdf-unifont ttf-fontawesome noto-fonts-emoji ttf-bitstream-vera adobe-source-{code-pro,sans,serif}-fonts
    
  • desktop packages
    sudo pacman -S --noconfirm --needed xterm python-pywal feh picom dunst xsettingsd udiskie unclutter xclip capitaine-cursors papirus-icon-theme arc-gtk-theme firefox
    
    xterm
    Terminal emulator inside xorg.
    feh
    Minimal image viewer that can also acts as wallpaper setter.
    python-pywal
    xorg colorscheme setter on the fly.
    picom
    X compositor.
    dunst
    Lightweight notification daemon
    xsettingsd
    Provides settings for X11 applications.
    udiskie
    Removable disk automounter using udisks.
    unclutter
    For auto hide the mouse cursor.
    xclip
    CLI interface for X11 clipboard.
  • setup makepkg.
  • aur helper
    pushd /tmp
    git clone https://aur.archlinux.org/yay
    cd yay
    makepkg -si
    popd
    
  • additional packages for polybar.

    Install these first since it’s not explicitly required in polybar PKGBUILD. i3-gaps installed to avoid installing the standard i3-wm.

    sudo pacman -S i3-gaps libmpdclient
    
  • additional aur packages
    yay -S --noconfirm --needed polybar
    yay -S --noconfirm --needed tgs2png # for emacs-telega
    yay -S --noconfirm --needed grive # google-drive sync
    
  • additional packages for grive
    sudo pacman -S --noconfirm --needed inotify-tools cppunit
    
  • beets optional dependencies
    sudo pacman -S --noconfirm --needed chromaprint ffmpeg gst-plugins-{bad,ugly,good} gst-{libav,python} imagemagick python-{beautifulsoup4,flask,mpd2,pyacoustid,pylast,xdg,pymad}
    
  • emacs desktop-environment packages
    sudo pacman -S --noconfirm alsa-utils pamixer brightnessctl scrot slock upower tlp playerctl
    
  • emacs projectile packages
    sudo pacman -S --noconfirm --needed ripgrep
    

    Ripgrep is a GNU Grep alternatives.

  • Window-manager

    exwm and stumpwm can be started as user using xinit and sbcl respectively, other window manager that interest me:

    sudo pacman -S --needed --noconfirm qtile # python
    
    • qtile deps
      sudo pacman -S --needed --noconfirm canto-daemon cmus jupyter_console khal moc python-{dbus-next,iwlib,keyring,mpd2,psutil,setproctitle}
      
    • python-pip

      Needed to install user python packages

      sudo pacman -S --noconfirm --needed python-pip
      

Archlinux configuration files

header-args: :exports both :results verbatim

System-wide configuration

fstab

To automatically mount nfs shares, first install nfs-utils

sudo pacman -S --noconfirm --needed nfs-utils
  • TODO /etc/fstab
    • State “TODO” from [2022-03-13 Sun 15:20]
    cat /etc/fstab
    
    # Static information about the filesystems.
    # See fstab(5) for details.
    
    # <file system> <dir> <type> <options> <dump> <pass>
    # /dev/sda4 LABEL=root
    UUID=654e6dbd-97f7-4aa6-8243-3afa51153038	/         	btrfs     	rw,relatime,space_cache=v2,subvolid=271,subvol=/@/arch/root	0 0
    
    # /dev/sda2 LABEL=EFI
    UUID=B62E-3C95      	/efi      	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2
    
    # /dev/sda4 LABEL=root
    UUID=654e6dbd-97f7-4aa6-8243-3afa51153038	/home     	btrfs     	rw,relatime,space_cache=v2,subvolid=260,subvol=/@/home/arch	0 0
    
    # /mnt/boot/EFI/arch
    /efi/EFI/arch  	/boot     	none      	rw,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro,bind	0 0
    
    # /dev/sda3 LABEL=swap
    UUID=beec6b47-9a1c-41d9-aee7-babfbe0be198	none      	swap      	defaults  	0 0
    
    

acpi_backlight

RUN+="/bin/chgrp video /sys/class/backlight/acpi_video0/brightness"
RUN+="/bin/chmod g+w /sys/class/backlight/acpi_video0/brightness"

skip this if using intel driver (xf86-video-intel).

intel_backlight

RUN+="/bin/chgrp video /sys/class/backlight/intel_backlight/brightness"
RUN+="/bin/chmod g+w /sys/class/backlight/intel_backlight/brightness"

libinput

I’ve switched to using libinput since the synaptic driver often acting weird.

Section "InputClass"
        Identifier "touchpad"
        Driver "libinput"
        MatchIsTouchpad "on"
        Option "Tapping" "on"
        Option "NaturalScrolling" "true"
EndSection

lis3lv02d

ST LIS3LV02Dx three-axis digital accelerometer driver, to autoload this using systemd:

lis3lv02d

Details for this module here.

  • TODO packages
    • State “TODO” from [2022-03-18 Fri 16:22]

    perhaps handled by evdev?

    sudo pacman -S --noconfirm --needed xf86-input-evdev
    

battery

  • packages
    sudo pacman -S --needed --noconfirm acpi acpid
    
    • enable acpid
      sudo systemctl enable --now acpid
      

pacman

Enable multilib repository at /etc/pacman.conf. While we’re at it, also enable other functionalities as well:

  1. UseSyslog :: Enable logging to systemd-journald.
  2. Color :: Use colored output.
  3. CheckSpace :: Enable space checking before running pacman.
  4. VerbosePkgLists :: Detailed package information
  5. ParallelDownloads :: Enable parallel downloads, useful since it’s arch afterall, expect kernel updates faster than other distro.
#
# /etc/pacman.conf
#
# See the pacman.conf(5) manpage for option and repository directives

#
# GENERAL OPTIONS
#
[options]
# The following paths are commented out with their default values listed.
# If you wish to use different paths, uncomment and update the paths.
#RootDir     = /
#DBPath      = /var/lib/pacman/
#CacheDir    = /var/cache/pacman/pkg/
#LogFile     = /var/log/pacman.log
#GPGDir      = /etc/pacman.d/gnupg/
#HookDir     = /etc/pacman.d/hooks/
HoldPkg     = pacman glibc
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
#CleanMethod = KeepInstalled
Architecture = auto

# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
#IgnorePkg   =
#IgnoreGroup =

#NoUpgrade   =
#NoExtract   =

# Misc options
UseSyslog
Color
#NoProgressBar
CheckSpace
VerbosePkgLists
ParallelDownloads = 5

# By default, pacman accepts packages signed by keys that its local keyring
# trusts (see pacman-key and its man page), as well as unsigned packages.
SigLevel    = Required DatabaseOptional
LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required

# NOTE: You must run `pacman-key --init` before first using pacman; the local
# keyring can then be populated with the keys of all official Arch Linux
# packagers with `pacman-key --populate archlinux`.

#
# REPOSITORIES
#   - can be defined here or included from another file
#   - pacman will search repositories in the order defined here
#   - local/custom mirrors can be added here or in separate files
#   - repositories listed first will take precedence when packages
#     have identical names, regardless of version number
#   - URLs will have $repo replaced by the name of the current repo
#   - URLs will have $arch replaced by the name of the architecture
#
# Repository entries are of the format:
#       [repo-name]
#       Server = ServerName
#       Include = IncludePath
#
# The header [repo-name] is crucial - it must be present and
# uncommented to enable the repo.
#

# The testing repositories are disabled by default. To enable, uncomment the
# repo name header and Include lines. You can add preferred servers immediately
# after the header, and they will be used before the default mirrors.

#[testing]
#Include = /etc/pacman.d/mirrorlist

[core]
Include = /etc/pacman.d/mirrorlist

[extra]
Include = /etc/pacman.d/mirrorlist

#[community-testing]
#Include = /etc/pacman.d/mirrorlist

[community]
Include = /etc/pacman.d/mirrorlist

# If you want to run 32 bit applications on your x86_64 system,
# enable the multilib repositories as required here.

#[multilib-testing]
#Include = /etc/pacman.d/mirrorlist

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

# An example of a custom package repository.  See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs

After the first sync (pacman -Syu), also install multilib-devel if you’re planning to install lib32 aur packages.

other packages

  • fwupd
    sudo pacman -S --noconfirm --needed fwupd
    
    • fwupd get-devices
      sudo fwupdmgr get-devices
      
      
      ?
      ??HP Integrated Module:
      ?     Device ID:          c0170efdf195b8590000fa21474253c0d97e7335
      ?     Current version:    3.6
      ?     Vendor:             Broadcom Corp (USB:0x03F0)
      ?     GUIDs:              08412d80-639e-522b-abd2-7d46b9445334 ? USB\VID_03F0&PID_231D&REV_0306
      ?                         79814083-7581-5801-b6f3-8792cc340f0c ? USB\VID_03F0&PID_231D
      ?     Device Flags:       ? Updatable
      ?
      ??WDC WD2500BEVT-22ZCT0:
            Device ID:          602b0a6cc821d155208724f0e22f8d111542b74c
            Summary:            ATA drive
            Current version:    11.01A11
            Vendor:             Western Digital (ATA:0x101C, OUI:0014ee)
            Serial Number:      WD-WXE1E10S5682
            GUIDs:              b03be26b-ec23-5084-b50a-3a381315f822 ? IDE\WDC_WD2500BEVT-22ZCT0___________________11.01A11
                                b958b198-9fdf-5b92-b0fc-8f6e116d9693 ? IDE\0WDC_WD2500BEVT-22ZCT0___________________
                                68dbccef-a445-5349-b9c1-3d748058bd36 ? WDC WD2500BEVT-22ZCT0
            Device Flags:       ? Internal device
                                ? Updatable
                                ? System requires external power source
                                ? Needs a reboot after installation
                                ? Device is usable for the duration of the update
      
      

User configuration

makepkg.conf

The system-wide configuration is /etc/makepkg.conf, but it’s better to create user configuration at ~/.config/pacman/makepkg.conf.

MAKEFLAGS="-j2"
BUILDENV=(!distcc color !ccache !check sign)
PKGDEST=/data/pacman/packages
SRCDEST=/data/pacman/sources
SRCPKGDEST=/data/pacman/srcpackages
LOGDEST=/data/pacman/makepkglogs

PACKAGER="$(git config --global user.name) <$(git config --global user.email)>"
GPG_KEY="$(git config --global user.signingkey)"
  • if using own gpg-key, first add it to pacman-key:

    sudo pacman-key --recv-keys "<your_key_here>"
    sudo pacman-key --lsign-keys "<your_key_here>"
    
  • create the necessary directories

    sudo mkdir -pv /data/pacman/{packages,sources,srcpackages,makepkglogs}
    sudo chown -v :admin /data/pacman/{packages,sources,srcpackages,makepkglogs}
    sudo chmod -v 1775 /data/pacman/{packages,sources,srcpackages,makepkglogs}
    

    admin is a user-defined group, if no other user is using makepkg, it’s safe to use your own user group and set the directories inside your user “${HOME}”.

grive

A fork from the original grive, with the support for the new Drive REST API and partial sync. Create a directory for syncing (in my case it’s ~/Documents/google-drive). Run grive -a inside the directory for initializing the connection. Once it’s established, we can continue with the systemd user unit (grive-changes@$(systemd-escape Documents/google-drive).service).

systemctl --user enable --now grive-changes@$(systemd-escape Documents/google-drive).service

To verify:

systemctl --user status grive-changes@$(systemd-escape Documents/google-drive).service
* grive-changes@Documents-google\x2ddrive.service - Google drive sync (changed files)
     Loaded: loaded (/usr/lib/systemd/user/grive-changes@.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-03-13 17:23:22 WIB; 41s ago
   Main PID: 61459 (grive-sync.sh)
      Tasks: 2 (limit: 4423)
     Memory: 1004.0K
        CPU: 40ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/app-grive\x2dchanges.slice/grive-changes@Documents-google\x2ddrive.service
             |-61459 /bin/bash /usr/lib/grive/grive-sync.sh listen "Documents-google\\x2ddrive"
             `-61463 inotifywait -q -r -e modify,attrib,close_write,move,create,delete --exclude ".grive_state|.grive" Documents/google-drive

Mar 13 17:23:22 arch-4420s systemd[382]: Started Google drive sync (changed files).
Mar 13 17:23:22 arch-4420s grive-sync.sh[61459]: Listening for changes in ~/Documents/google-drive

It depends on inotify-tools so make sure it’s installed.