Switching OSs

Background

For the longest time, I used Linux exclusively. At some point in the past few years I found it easier to utilize Windows as my primary Operating System. This mostly came down to gaming support not being great in Linux.

Lately, I don’t play that many PC games… or games in general. I’ve also got a whole TWO working computers again(desktop and laptop fairly typical).

With all that I thought it’d be fun to go back to running Linux somewhere. I went with my laptop because it gets way less use overall, in fact 90% of the time all it does is steam Plex while I’m working.

Getting started

Quick and dirty how I got rolling on this project:

  1. Download ISO
  2. Throw it on a USB drive using Rufus
  3. Fight w/ BIOS/UEFI to boot off the USB drive
  4. Be in an Arch Linux live environment and start the installation process

On the “Installer”

The SINGLE MOST USEFUL LINK WHEN INSTALLING ARCH IS NOT MY SITE, BUT THIS: https://wiki.archlinux.org/title/Installation_guide

For the most part, this walkthrough of what I did is a 1 for one of the above link. There are some minor changes since but for the most part, you’d be better off following the official guide.

Everything from here on, assumes you are in the live environment.

Verify the boot mode

Was pretty sure I booted into UEFI mode.

cat /sys/firmware/efi/fw_platform_size

  • Expected return: 64
  • Possible return: 32
  • Possible return: file does not exist
  • Actual return: 64

Based on the return everything was going as planned.

Setup Networking

I have a USB ethernet adapter for my laptop. I did not use it.

Get device name

IF I was smart, I’d have taken some screen captures during installation. I however, only typed up what I was doing. With that in mind, all screenshots were done on my live system way after the fact. This first step wasn’t actually needed.

ip link Folders Folders

Connect to Wi-Fi

As previously stated, I was using Wi-Fi during the installation. iwctl is what the installation guide recommended using to get connected. I looked into screenshotting this on my live system. However, due to using a different network manager that seemed like more work than it was worth.

iwctl

[iwd]# device list 
[iwd]# station wlan0 scan 
[iwd]# station wlan0 get-networks  
[iwd]# station wlan0 connect MyNetwork
[iwd]# exit

Partition the Disk

Get disk(s) name

I MIGHT have gotten away with not doing this, but it’s been a long time since I really messed around with Linux. I figured it couldn’t hurt to verify the disk names prior to trying to wipe them and do a fresh installation.

fdisk -l Folders Folders

My screenshot again being from my actual install isn’t exactly what you’ll see, and clearly I screwed up by forgetting sudo. Granted on the live environment, you run as root, so sudo isn’t needed.

Partitioning

Installation guide says use fdisk to do the partitioning. I’ve always preferred cfdisk. There are lots of good reasons to separate your partitions to more than just /boot and /. I didn’t see the need at this point though.

cfdisk /dev/nvme01n1 Folders Folders
delete all partitions Folders Folders
New 1G
Folders Folders
Type EFI System (top on list)
Folders Folders
New… EVERYTHING ELSE
Folders Folders Folders Folders
Write

Quit

File Systems

You can read a ton of articles about why one file system is better than another. For me ext4 is simple and reliable. This made it an easy choice for the / partition.

mkfs.ext4 /dev/nvme0n1p2
mkfs.fat -F 32 /dev/nvme0n1p1
mount /dev/nvme0n1p2 /mnt
mount --mkdir /dev/nvme0n1p1/mnt/boot

Install & Configure the system

Install and Enter

I’ve always liked using pacstrap to install as many of the things I know I want on my system as possible. Someday, I really should RTFM and make sure that’s smart. However, today was not that day.

pacstrap -K /mnt  base linux linux-firmware base-devel intel-ucode iwd tmux plasma-meta kde-applications-meta sof-firmware vim zsh git fortune-mod openssh bitwarden docker hugo
genfstab -U /mnt >> /mnt/etc/fstab`  
arch-chroot /mnt 

Quick breakdown of the above:

  • pacstrap: installs all the items below
    • base
    • linux
    • linux-firmware
    • base-devel
    • intel-ucode
    • iwd
    • tmux
    • plasma-meta
    • kde-applications-meta
    • sof-firmware
    • vim
    • zsh
    • git
    • fortune-mod
    • openssh
    • bitwarden
    • docker
    • hugo
  • genfstab: creates the “file system table”
  • arch-chroot: “logs into” the newly installed system

Edit /etc/locale.gen and uncomment en_US.UTF-8 UTF-8 and other needed UTF-8 locales. Generate the locales by running:

Starting to configure

Setting Loccale

Create the locale.conf # locale-gen

vim /etc/locale.conf
#uncomment following line
LANG=en_US.UTF-8
Set the root password

# passwd

Bootloader Magic
bootctl install
cp /usr/share/systemd/bootctl/* /boot/loader
cd /boot/loader
mv arch.conf entries/
tmux
# SPLIT SCREEN (CTL-b, %)
vim /boot/loader/entries/arch.conf
# Move to other side of tmux (CTL-b, Arrow left or right depending)
ls -l /dev/disk/by-uuid
# update arch.conf with your / partition uuid

Folders Folders

Despite what our Gospel link above says, we are ready to get into the real system. Make sure to remove the installation media.

umount -R /mnt
reboot

Post Install

First Boot

Since I haven’t created my user yet, this is done on the root account. I’m kind of aware that typically you shouldn’t do things as root.

Make sure to change out $HOSTNAME, & $USERNAME with your hostname and username, as some screenshot above show, mine are lenovo13 & nick.

timedatectl set-timezone US/Central
hostnamectl hostname $HOSTHAME
systemctl enable sddm
systemctl enable NetworkManager
EDITOR=vim visudo
visudo
# uncomment this line
# %wheel      ALL=(ALL:ALL) ALL
useradd -m -g users -G wheel $USERNAME
passwd $USERNAME
reboot

Quick breakdown of what happened above:

  • Set timezone
  • Set hostname
  • Enabled our display manager
  • Enabled NetowrkManager (this will replace)
  • Setup sudo to work with our user
  • Created our user
  • Set our password
  • rebooted the computer because lazy.
    • We could have just as easily used systemctl start $bothThingsWeEnabled

First Login

YAY

After logging in open a terminal:

mkdir aur
cd aur
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si

Honestly, the above probably isn’t super necessary. When I first started using Arch I feel like the AUR was harder to use and “helpers” where more useful. However, I think they are still nice and am currently using yay.

.Files

One of the first things I did was grab my old dotfiles. After looking at the date on them… I HIGHLY recommend you don’t use them. They won’t get updated due to me not using github anymore. They might be good starting points though.

Here is the one way you could start using my dot-files if you wanted to…

git clone --bare https://github.com/theflyingfool/dot-files $HOME/.dot
alias dot='/usr/bin/git --git-dir="$HOME/.dot/" --work-tree="$HOME"'
dot checkout
dot config --local status.showUntrackedFiles no

I haven’t dug too deep into the differences between zsh and bash in at least 7 years. However, I know I was using zsh before so the next thing I did was change my default shell.

chsh

Finishing Up

I’m sure I missed a few steps along the way, for example making sure the docker service gets started.

systemctl enable docker

Creating and utilizing an ssh key for this system.

ssh-keygen -C "$(whoami)@$(uname -n)-$(date -I)"

touch ~/.config/environment.d/ssh_askpass.conf
vim ~/.config/environment.d/ssh_askpass.conf
SSH_ASKPASS=/usr/bin/ksshaskpass
SSH_ASKPASS_REQUIRE=prefer

Final Thoughts

Almost all of this process could be easily automated. I’ve got a script that I run when I do a fresh installation of windows that can be found here. I really should look into doing something similar for Arch.