I had been using MacOS since 2012 when together with some friends I started Evomote, a startup which was going to be the revolution of the remote controller (Spoiler: It ended not to be it, but that’s a story for another day), on those days it took me a while to get used to the MacOS nuances but I managed to do it and I kept using it without any issues for the next 8 years (after a small hardware revamp in 2018 when I upgraded the memory to 16GB RAM and extended the SSD Drive to 512GB one).
Last year, I decided it was time for a change, and since I had been always a Linux fan, I started to look for a substitute for the old Macbook Pro, this time searching for a Linux specialized brand where I could find a good value for money lightweight laptop, so I ended up buying a Slimbook PROX 14.
For the initial setup, I tweaked a little bit the laptop specs for the long run (See below for details), and among the options for the OS, I took the Slimbook OS (a modified version of Ubuntu distribution), thinking that it was the best choice as it would be fully optimized for the hardware (indeed it was) a part from bringing some small jewels in form of apps such as Slimbook battery.
As I started to get my toes wet into my new role as CTO in Goxo, technology started to grow within my daily activities, please don’t get me wrong, I consider myself a technology geek, I am always playing around with some sort of technology, and although my previous roles allowed me to be in touch with technology, this was a totally different level, so a feeling of going deeper in my productivity stack started growing up inside me.
Having this in mind, I started the investigation journey for choosing the right distribution for me which had the characteristics that allow me to keep learning at the same time that I could have full control of all the pieces within the system, and after few attempts, installations and conversations with colleagues I ended up picking Arch Linux as the candidate (special thanks to Iban for being a great mentor and support with this).
So here, it is the story of my up to date experience with Arch linux, this document constitutes a compilation of my learnings during Arch Linux
Installation & Configuration in my Slimbook ProX14.
DISCLAIMER: I am not a linux expert, with this guide I am trying to put together all the learnings I made a long the way, I hope to save some time in the future not only for me in a potential reinstallation situation but for other people who are in the same situation as me which basically it is a strong desire for becoming knowledgeable in the linux world, I adjusted this setup balancing my taste, time and comprenhension of the subsystems and modules, probably there are better ways to do these configurations, go out
there and find yours because that is the beauty of the open source software.
Following you can find the specs of the setup (excerpt from inxi
command):
Machine:
Type: Laptop System: SLIMBOOK product: PROX14–10
Memory:
RAM: total: 31.22 GiB used: 883.6 MiB (2.8%)
CPU:
Info: Quad Core model: Intel Core i7–10510U bits: 64 type: MT MCP arch: Kaby Lake
Graphics:
Device-1: Intel UHD Graphics
Device-2: NVIDIA GP108M [GeForce MX250]
Device-3: Chicony HD Webcam type: USB
Audio:
Device-1: Intel Comet Lake PCH-LP cAVS vendor: Tongfang Hongkong Limited
Network:
Device-1: Intel Comet Lake PCH-LP CNVi WiFi
Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
Bluetooth:
Device-1: Intel Bluetooth 9460/9560 Jefferson Peak (JfP)
Drives:
ID-1: Samsung model: SSD 970 EVO Plus 500GB
Battery:
ID-1: 46.7 Wh
The document is divided in two parts:
- Installation of a plain vanilla Arch Linux
- Configuration and customization for a development oriented user
NOTE: The starting point was a single boot with Slimbook OS (modified Ubuntu 20.04) preinstalled.
1. Installation of a plain vanilla Arch Linux
This procedure includes the root partition encryption (using LUKS without LVM)
0. Fetch the latest Arch linux iso to a USB flash memory
In linux you can use the following:
dd if=/path/to/iso of=/dev/sdX
where sdX is the device representing your usb key.
1. Load Spanish keyboard layout, connect to internet and adjust clock:
loadkeys es
iwctl station wlan0 connect "MiWifi"
timedatectl set-ntp true
2. Load additional kernel modules for encryption
modprobe dm-crypt
modprobe dm-mod
3. Create the partitions, we are going to need three of them:
Please use the tool you feel the most comfortable with, in my case I used fdisk
fdisk /dev/nvme0n1
If everything goes fine you should see something like this:
4. Encrypt root partition
You will be requested to confirm with a YES (in uppercase) and then set a password:
cryptsetup luksFormat -v -s 512 -h sha512 /dev/nvme0n1p3
cryptsetup open /dev/nvme0n1p3 luks_root
5. Format partitions
mkfs.vfat -n “EFI System” /dev/nvme0n1p1
mkfs.ext4 -L boot /dev/nvme0n1p2
mkfs.ext4 -L root /dev/mapper/luks_root
6. Mount partitions
Be careful to execute the commands in the proper order so that directories
are created in the proper partitions:
mount /dev/mapper/luks_root /mnt
mkdir /mnt/boot
mount /dev/nvme0n1p2 /mnt/boot
mkdir /mnt/boot/efi
mount /dev/nvme0n1p1 /mnt/boot/efi
7. Swap file
Only if you are planning to hibernate the laptop to the hard drive.
Change the parameter count to set the amount of swap you would want:
cd /mnt
dd if=/dev/zero of=swap bs=1M count=2048
mkswap swap
swapon swap
chmod 0600 swap
8. Install base system and some minor utils
I am using neovim and Network Manager but feel free to install some other editor or network utilities:
pacstrap -i /mnt base base-devel efibootmgr grub linux \
linux-firmware networkmanager sudo vim bash-completion neovim \
man-db iproute2 intel-ucode udev
9. Generate fstab file
genfstab -U /mnt >> /mnt/etc/fstab
10. Ch-root in your new system
arch-chroot /mnt
11. Add a new user
Create a new user, this user will be the one to operate the system (via sudo) as I am not using the root user:
useradd -m -s /bin/bash your_user_name
passwd your_user_name
12. Setup sudo
Execute the following line to edit the config with vim:
EDITOR=/usr/bin/vim visudo
Add the following line after the "root" user one:
your_user_name ALL=(ALL) ALL
Config your default visudo editor by adding the following line to the sudo config file:
Defaults editor=/usr/bin/nvim
13. Setup locale configuration
- Change Region by a valid one (e.g. Europe) as well as the City (e.g. Madrid);
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
hwclock --systohc
- Edit and uncomment by removing the '#' at the beginning of your locale configuration in my case Spanish (for me es_ES.UTF-8) then run:
locale-gen
- Add language support:
echo "LANG=es_ES.UTF-8" > /etc/locale.conf
echo "KEYMAP=es" > /etc/vconsole.conf
14. Setup network
- Set your hostname:
echo "your-host-name" > /etc/hostname
- Set your /etc/hosts
file adding:
127.0.0.1 localhost
::1 localhost
127.0.1.1 your-host-name.localdomain your-host-name
15. Setup grub
- Modify the following line in file /etc/default/grub
so it looks like the following:
GRUB_CMDLINE_LINUX=”cryptdevice=/dev/nvme0n1p3:luks_root”
- Add "encrypt" module at the line starting with HOOKS between block and filesystem at the /etc/mkinitcpio.conf
HOOKS=(base udev autodetect modconf block encrypt filesystems keyboard fsck)
Then execute the following command to re-create the kernel config:
mkinitcpio -p linux
16. Install and config grub
grub-install --boot-directory=/boot --efi-directory=/boot/efi /dev/nvme0n1p2
grub-mkconfig -o /boot/grub/grub.cfg
grub-mkconfig -o /boot/efi/EFI/arch/grub.cfg
17. Reboot
You are ready to go, exit from the chroot and reboot:
exit
reboot
18. First boot
You will need to introduce the password for the encrypted partition (the one in the step 4. above)
After that the login will require you to Introduce your user's credentials
You can get online with the Network Manager, either by using nmtui or nmcli using, you should start it first:
sudo systemctl start NetworkManager
nmcli --ask device wifi connect "MiWifi"
Where "MiWifi" is the name of your SSID. After that enable NetworkManager:
sudo systemctl enable NetworkManager
2. Configuration and customization
After the arch installation it is time to start customizing the system for your
taste. See my repository for futher details.
The selection of the tools has been very vim-oriented and trying to be as much agnostic to any major Desktop Environment (such us Gnome, KDE, etc.)
In my case, I performed the customization in the following domains:
- Installation of a pacman wrapper to be able to handle easily official packages as well the ones included in AUR. In my case I chose yay because its simplicity and because it's been developed in Golang. See installation details in yay target within the Makefile.
- Installation of the graphical environment and some related utilities. My stack in this case is:
- XServer
- Nvidia proprietary driver and its utilities
- Light Desktop Manager with Slick Greeter
- Bspwm as a tiled window manager
- Sxhkd as a key stroke handler
- Rofi as a launcher
- Polybar as a status bar
- Dunst as a notification manager
- Picom as composer
- Pulseaudio as the audio system
- Betterlockscreen as screenlocker
- Blueman, and NetworkManager for handling BT and Network respectively - For the daily task activities I am using:
- Kitty as terminal, plus Oh-my-zsh and Startship as enhancements
- Neovim as editor with a bunch of plugins such as (airline, vim-go, and others)
- pqiv as image viewer
- ranger and pcmanfm for file management
- zathura as pdf reader
- scrot as screenshooter
- GVFS for Virtual filesystem (enables Trash bin, remote filesystem access, etc.)
- CUPS for the printer config
- Sane for the scanner config
- Tmux as screen multiplexer
- Onlyoffice as ofimatics suite
- Firefox as main browser, although I have also installed Chromium - For the theme I am using:
- GTK Theme: Matcha
- Icons: Flat remix
- Cursor: Bibata - Development tools (other than nvim): Visual Studio Code, Robo3T, Postman, MongoDB Compass, Portainer, Go-Swagger, Go, Github CLI and git.
- Cloud environment and k8s toolkit: Google cloud SDK, Kubectx, kubens, dive, popeye, helm, linkerd, velero, and the beautiful k9s
- For media utilities: gimp, kazam, handbrake, vlc
- For social interaction: Slack, Cawbird (twitter) and Telegram
All the installation and configuration of these utilities can be seen in the proper targets in the Makefile, usually there is one target for installation and another one (*-config)for configuration.
Last but not the least, I also include within this repository my dotfiles for the
fine tuning of those tools as I have it today.
Hope you find this compilation of info useful.
Happy hacking!
— This article was written by Ángel J. Ramos, CTO & Head of Product at Goxo
References
All this installation and setup couldn't have been possible without the help
of the following links and guides, my biggest thanks for them.
- Arch Installation Guide
- Arch Install With Full Disk Encryption
- NVIDIA in Arch Linux
- NVIDIA Optimus
- NVIDIA Prime render
- PRIME Render Offload
- Offloading Graphics Display with RandR 1.4
- UDev
- Bspwm
- Printer Config - CUPS
- Scanner Config - SANE
- PCManFM
- File Manager Utility
- Ranger User Guide
- Polybar Themes
- Dunst
- Dunst Module for Polybar
- Samba