You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
urosm 9327a34def add pandoc stuff 3 weeks ago
.config add gnu screen dotfiles 4 weeks ago
.local add pandoc stuff 3 weeks ago
doc add pandoc stuff 3 weeks ago
.bash_logout
.bashrc fix prompts 1 month ago
.profile add gnu screen dotfiles 4 weeks ago
README.md

README.md

dotfiles

This repo contains the tracked dotfiles and keeps a description of all the configuration steps needed to reproduce our current setup on a Thinkpad x230.

This file can be downloaded with curl:

# curl -os README.md https://git.kompot.si/urosm/dot/raw/branch/main/README.md

Installation guide

This section covers installing Arch Linux. The instructions roughly follow the structure of the ArchWiki's Installation guide which should be the main reference when installing Arch. Instructions and commands in this guide are in no way hardware of software agnostic. Do not follow them without adapting the commands to your system and preferences.

Commands are documented inside code-blocks. Placeholders formatted in italics or between angled brackets <> must be manually replaced with correct specific values.

Booting from an Arch install image is recommended. It includes the necessary networking packages, as well as some useful scripts for bootstrapping.

To create a bootable flash drive from and ISO image run the following command, replacing image.iso with the path to the ISO image and /dev/sdx with the correct drive. Use lsblk to list all block devices, do not append a partition number.

# cp <image.iso> </dev/sdx>

Aside:
To restore the USB to a useful state after the installation run these commands. wipefs wipes the filesystem. dd wipes the remaining bytes so drive is usable on Windows machines. With fdisk we repartition the drive . Make sure to set the type to FAT32. Then we reformat the created partition with mkfs.fat which is provided in the dosfstools package.

See also USB flash installation medium on the ArchWiki.

# wipefs --all </dev/sdx>
# dd if=/dev/zero of=</dev/sdx> bs=1k count=1024
# fdisk </dev/sdx>
# mkfs.fat </dev/sdx0>

The rest of this guide assumes we've successfully booted to a live system in UEFI mode. Every command taken is documented, the guide does not assume any unlisted commands were executed. This guide is separated into three stages based on the root environment -- live iso, chroot and the installed system.

Live ISO

This part will prepare the target disks (partition and format) and install the base packages with pacstrap.

First synchronize pacman's package databases.

# pacman -Sy

When running in a virtual machine you might need to configure systemd-resloved.

Scan and connect to a network. Use iwctl station list to list station names (usually wlan0) and iwctl station <station-name> get-networks to list available ssid names.

# iwctl station <station-name> scan
# iwctl station <station-name> connect <ssid-name>

Set time zone and update the system clock:

# timedatectl set-timezone <region>/<city>
# timedatectl set-ntp true

Use fdisk to partition the drive(s). Use lsblk to list block devices and replace /dev/sdx.

See also Fdisk and Partitioning for usage and schemes.

# fdisk </dev/sdx>

The usual personal setup (UEFI with GPT, a separate /home partition):

mount point partition partition type size
/mnt/boot /dev/sda1 EFI 1 +300M
[SWAP] /dev/sda2 Linux swap 19 +16G
/mnt /dev/sda3 Linux filesystem 20 +30G
/mnt/home /dev/sda4 Linux filesystem 20 remaining space

Format the created partitions and set up the swap partition. The boot partition should be formatted to fat, root and home can be formatted to ext4. The commands use device names from the table above, replace accordingly.

See also File systems and Swap on the ArchWiki.

# mkfs.fat -F 32 -n boot /dev/sda1
# mkswap -L swap /dev/sda2
# mkfs.ext4 -L root /dev/sda3
# mkfs.ext4 -L home /dev/sda4

Mount the formatted file systems and enable swap. Mount root to /mnt, boot and home to respective mount points which should first be created.

# mount /dev/disk/by-label/root /mnt
# mkdir /mnt/{boot,home}
# mount /dev/disk/by-label/boot /mnt/boot
# mount /dev/disk/by-label/home /mnt/home
# swapon /dev/disk/by-label/swap

Install the base package.

# pacstrap /mnt base

Generate an fstab file and "change root" to the new system.

# genfstab /mnt >> /mnt/etc/fstab
# arch-chroot /mnt

Chroot

The base package does not include packages from the iso that are essential for, for example, wireless networking, or even the kernel. These will have to be installed before rebooting, otherwise the system won't boot or won't be able to update.

Install the kernel and firmware.

# pacman -Syu linux linux-firmware

Install iwd for wireless networking later.

# pacman -Syu iwd

Another thing that will make configuring the system easier is a text editor.

# pacman -Syu neovim

Set the time zone and sync the hardware clock.

# ln -sf /usr/share/zoneinfo/<Region/City> /etc/localtime
# hwclock --systohc

Edit locale.gen and uncomment necessary locales.

# nvim /etc/locale.gen
- #sl_SI.UTF-8 UTF-8
+ sl_SI.UTF-8 UTF-8
- #en_US.UTF-8 UTF-8
+ en_US.UTF-8 UTF-8

Generate the locales.

# locale-gen

Edit locale.conf:

# nvim /etc/locale.conf
+ LANG=sl_SI.UTF-8
+ LC_MESSAGES=en_US.UTF-8

Edit hostname.

# nvim /etc/hostname
+ <hostname>

Create a password for the root user.

# passwd

We will use systemd-boot as it is already included in the base package. To be able to boot to this install, configure the bootloader.

# bootctl install

Aside:
Install and use efibootmgr to manage and delete boot entries made with previous installs. Or use bootctl update if a Linux boot entry already exists.

Edit loader.conf.

# nvim /boot/loader/loader.conf
+ default <entry>

Edit <entry>.conf.

# nvim /boot/loader/entries/<entry>.conf
+ title Arch Linux
+ linux /vmlinuz-linux
+ initrd /intel-ucode.img
+ initrd /initramfs-linux.img
+ options root=/dev/sda3 rw
+ options resume=/dev/sda2
+ options i915.fastboot=1

See Systemd-boot about these files and options.

Exit chroot, unmount and reboot.

# exit
# umount -R /mnt
# reboot

Post-installation

We can login as root with the password set earlier.

The post-installation stage assumes the iwd package is installed. A text editor (nvim) is also assumed to be installed.

To continue configuring the system on the first boot, we need to configure networking. We use systemd-resolved and iwd for resolving, configuring dhcp and connecting to wifi.

Enable and start systemd-resolved and iwd:

$ sudo systemctl enable --now systemd-resolved.service
$ sudo systemctl enable --now iwd.service

Aside:
Enable and start systemd-networkd.service if using a wired connection.

Edit main.conf:

# nvim /etc/iwd/main.conf
[General]
EnableNetworkConfiguration=true

Install the sudo package to manage user privileges and edit the sudoers file.

# pacman -Syu sudo
# EDITOR=nvim visudo
- # %wheel ALL=(ALL) ALL
+ %wheel ALL=(ALL) ALL

We can now create a regular user, add them to the wheel group for sudo privileges and set their password.

# useradd -mG wheel <username>
# passwd <username>

Dotfiles and maintainence

A bare functional Arch system with a kernel, wireless networking, a text editor and a non-root administrator user is complete. The continuation of this stage is more opinionated and specific. We use personal meta package pkgbuilds to maintain the system. These are hosted in this git repo along with our dotfiles.

Install git and clone this repo into the home .config directory.

$ sudo pacman -Syu git
$ cd
$ mkdir .config
$ cd .config
$ git clone https://git.kompot.com/urosm/dot .

Link profile and bashrc to their correct places. (Use full paths.)

$ ln -sf /home/<user>/.config/profile /home/<user>/.profile
$ ln -sf /home/<user>/bash/bashrc /home/<user>/.bashrc

Before installing the personal meta packages, we need to install the base-devel package group.

$ sudo pacman -Syu base-devel

Move to .config/pkgbuilds and install the meta packages.

$ makepkg -sicp <pkgbuild>

When the meta packages are installed all other packages can be set to "installed as dependencies". All setup is basically contained as a dependency tree of these tracked pkgbuilds. All that is left is some one-time configurations.

Kernel

Since this should also only be done once and for all, the configuration file is included here and not as a standalone tracked file in the repo. See mkinitcpio.

Edit mkinitcpio.conf:

# nvim /etc/mkinitcpio.conf
- HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)
+ HOOKS=(base systemd autodetect block filesystems fsck)
- #COMPRESSION="lz4"
+ COMPRESSION="lz4"

Generate the kernel:

# mkinitcpio -p linux

Auto-hibernate

A udev rule is used for hibernate-on-low-battery trigger. The kernel hooks and boot options also need to be set up correctly.

Edit 99-lowbat.rules:

# nvim /etc/udev/rules.d/99-lowbat.rules
SUBSYSTEM=="power_supply", ATTR{status}=="Discharging", ATTR{capacity}=="[0-5]", RUN+="/usr/bin/systemctl hibernate"

Services

Enable fstrim:

$ sudo systemctl enable fstrim.timer

Enable gammastep

$ systemctl --user enable gammastep

See also

  • other repos

Debian

  • network-manager

  • sway

alternative

sudo

$ sudoedit /etc/sudoers.d/disable_admin_file_in_home
+ # Disable ~/.sudo_as_admin_successful file
+ Defaults !admin_flag