Arching into Linux: My Paws-On Adventure with Arch Linux — Part 1
Introduction
Hey there, fellow tech enthusiasts and cat lovers!
I've been using Linux almost exclusively for about 5 months now, except for a couple of months in my previous job (but that's an entirely different story). Most of this time has been with Linux Mint, and a few VMs set up with Ubuntu and Debian. In an effort to deepen my understanding of Linux, I decided to take on the task of setting up and configuring Arch Linux on my old laptop. This way, I could experiment, possibly break things, without affecting my primary system.
I consider myself quite technical, with a strong background using Windows, basic programming experience, and many years of configuring home networks and operating systems. However, Arch Linux has a reputation of being 'hard' and requires manual setup and configuration, so I went into this knowing I might face challenges.
Recently, Arch does have a GUI installer, but after watching a few YouTube videos and reviewing the Arch Wiki, I opted for the manual route. This post isn't a step-by-step guide, but rather my journey and experiences setting up Arch. I'll share some of the steps I took, options I chose, and even some commands and screenshots. I relied on various YouTube videos and the Arch Wiki, which I'll link at the end for detailed instructions.
Pre-installation Prep
- USB Stick: 8 GB with the Arch Install ISO.
- Laptop: Lenovo Y510p with 12 GB RAM, 4th Gen Intel CPU, 2x NVIDIA GeForce GT 755M GPUs, and 2x 240 GB SSD drives.
There wasn't much to my install preparation, apart from downloading an Arch install ISO and putting this on to a bootable USB drive, I left my laptop as it was, in an 'in-progress' state from a previous Linux installation.
Installation Steps
Again, as this is not a step-by-step guide, I'll just be running through the commands I used along the way, why I used some of them, and so on. If you want the guides, check out Bread on Penguins and Learn Linux TV on YouTube.
Connecting to the Laptop
The first step, was to ssh in to the laptop once it had booted from the USB drive with the Arch install on it. Mainly, this was because the laptop is on a moveable arm attached to my desk, so it's not in the best position, and I really don't like the standard laptop keyboards.
Once I had SSH open in to the laptop, I wanted to verify the boot mode, so I could decide which options to use when setting up the boot partitions and configuring GRUB, and using cat /sys/firmware/efi/fw_platform_size
would confirm this.
Getting a 64 response indicates that my laptop had booted in UEFI mode and has a 64-bit x64 UEFI.
Next, I just ran loadkeys uk
and timedatectl
to set my key map for the installation, and ensure that the system clock was synced.
Partitioning Disks
lsblk
allows me to view the storage devices attached to my laptop, and from this, I know that the device I need to work with is /dev/sda
Using fdisk
I can get to my partition table and run through several commands to great a new GPT disk label, then create and set the EFI, Boot and LVM partitions. Most of this is just entering certain letters to push commands after entering fdisk /dev/sda
- Set new GPT disk label
- Create 1 GB partition for EFI, format as Fat32
- Create 1 GB partition for Boot, format as Ext4
- Create a partition with remaining disk space and set the type for LVM
As this is my laptop, and often is with me when I have to travel, I wanted a secure partition so used cryptsetup luksFormat /dev/sda3
to encrypt the partition, then needed to open it with cryptsetup open --type luks /dev/sda3 lvm
so we can continue working with it.
Then I went through the following, to set up volumes and partitions within the LVM partition.
- Create the partition volume:
pvcreate /dev/mapper/lvm
- Create volume group:
vgcreate volgroup0 /dev/mapper/lvm
- Create the logical volumes:
- Root:
lvcreate -L 30GB volgroup0 -n lv_root
- Home:
lvcreate -L 191GB volgroup0 -n lv_home
- Root:
- Format the logical volumes:
mkfs.ext4 /dev/volgroup0/lv_root
mkfs.ext4 /dev/volgroup0/lv_home
- Make the necessary directories for the mount points:
mkdir /mnt/boot && mkdir /mnt/home
- Finally, mount the volumes:
mount /dev/sda2 /mnt/boot
mount /dev/volgroup0/lv_home /mnt/home
Preparing the Installation Environment
Now the partitions are set, it's time to get started on the installation. The first thing needed was to set up the base system with pacstrap -i -K /mnt base vim
I also opted to install vim
at this point too, in case any files needed to be looked at. I normally don't use Vim, but if I'm going to be learning new things with this project, why not add Vim in there too.
During the installation of the base system and vim, I got a message in the terminal stating there were two providers for libxtables.so=12-64
, these were iptables
and iptables-nft
.
I am not too familiar with either of these at the moment, so more research is needed, but a quick look online did seem to indicate that iptables-nft
is the newer variant, so I went with that option.
Once the base installation was complete, then it was on to generating the fstab
file with genfstab -U -p /mnt >> /mnt/etc/fstab
and then using cat /mnt/etc/fstab
to ensure this had correctly configured
Setting Locale and Users
With the pre-configuration done, I run arch-chroot /mnt
to enter into the in-progress installation, set up the timezone and hardware clock with ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime
and then hwclock --systohc
.
Using vim /etc/locale.gen
to remove the comment indicator from en_GB.UTF-8 UTF-8
and en_GB ISO-8859-1
then running locale-gen
to set this configuration, before moving on to editing the locale.conf
file with vim /etc/locale.conf
and pasting in LANG=en_GB.UTF-8
before saving and exiting the file.
echo "ArchLaptop" >> /etc/hostname
set up the hostname before I then went on to set the root
password, and then using useradd -m -G wheel,users duma
to create a new user and add them to the wheel
and users
groups.
Installing Packages and Drivers
Now the installation is taking shape, but at the moment it's still not ready to be restarted, and several packages need to be installed. Linux is great for allowing the installation of several packages at once, so I used pacman -S base-devel dosfstools grub efibootmgr lvm2 mtools nano networkmanager openssh sudo os-prober linux linux-firmware linux-headers linux-lts linux-lts-header
I'll give a brief overview of these packages below, but as this will be my 'away-from-home' device, and will be used for some additional projects and learning, I wanted a little more than base functionality.
base-devel
: Package of development tools, required for building and linking packages.dosfstools
: DOS filesystem utilities, handy for working with FAT based filesystems.grub
: Boot loader package, so we can get options for booting in to our OS.efibootmgr
: Manages UEFI boot entries, and required when we set up the bootloader.lvm2
: Storage device management tools for the Linux kernelmtools
: Package to allow reading and writing of files on MS-DOS filesystems.nano
: A simple, and easy to use text editor.networkmanager
: Package that gives high-level access to network configuration.openssh
: Enables secure, remote access to other systems.sudo
: A command-line utility to give administrator access for running commands.os-prober
: Lists other OS's so that they can be selected in a bootloader.linux-firmware
: Provides functionality for hardware devices.linux
andlinux-headers
: The kernel and the headers to define system calls etc.linux-lts
andlinux-lts-headers
: A long-term-support version of the Linux kernel and headers, useful if we break something and can access the system with a different kernel.
To make sure that the Laptop would have network connectivity, and we can ssh in to it, when it is started, I ran both systemctl enable sshd
and systemctl enable NetworkManager
to have these run automatically.
While I don't have a desktop environment, or window manager, installed yet, I need to make sure that my installation has the required drivers for the graphics cards. I know which cards are in the laptop, but I need to make sure that these are identified by the Linux environment, so running lspci
will show me the PCI devices connected.
The output does show the GeForce GT 755M, so I ran pacman -S nvidia nvidia-utils nvidia-lts
to install drivers for both the Linux and LTS kernels.
Encrypted Filesystem and Ramdisk setup.
Having an encrypted filesystem is all good, but it's no good until the kernel knows how to deal with it. Editing the /etc/mkinitcpio.conf
to add 'encrypt' and 'lvm2' to the line starting HOOKS
so that it now shows HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block encrypt lvm2 filesystems fsck)
makes sure the kernel knows how to handle the LVM partition correctly.
Next up, was creating some ramdisks for the two Linux kernels, using mkinitcpio -p linux
and mkinitcpio -p linux-lts
Bootloader Configuration
The installation is almost done, the point of restarting is near, but there's the final step of getting the bootloader correctly configured.
First, the EFI partition needs a location, so that we can set the mount point, and this was easily done with the mkdir /boot/EFI
and mount /dev/sda1 /boot/EFI
commands.
Editing the grub
file is required next, so that the volume group created earlier is correctly set.
Using nano /etc/default/grub
to modify the file so that the lineGRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 cryptdevice=/dev/sda3:volgroup0 quiet"
is set in there, so that the command grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck
can be run to install GRUB
The next step is to get the required files copied to the boot directory with cp /usr/share/locale/en@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
and then the config file for the bootloader is generated with grub-mkconfig -o /boot/grub/grub.cfg
Finally, it's the exit
command to exit out of chroot
, umount -a
to unmount all the drives, and reboot
to restart the laptop.
Post-installation
The laptop booted up fine, and I got into the command line of Arch Linux, and can log in. The next steps will be looking at a desktop environment, or window manager.
I haven't decided yet which to choose. I'm using Cinnamon on my desktop PC, and in some VMs, while all the others are on Gnome, but I am currently tempted to try something like DWM while I'm experimenting, and learning, with new systems and applications.
Challenges and Solutions
Thankfully, I didn't seem to run in to any challenges, and the setup and configuration went smoothly, with no issues. So much easier than I initially expected, but I believe this is in large part thanks to the amazing guides from a couple of Linux content creators that I had previously watched on YouTube.
Personal Insights
- So far, I don't think I have any particular thoughts on Arch, but it is early days, and I'm only at the login command-line at the moment.
- I did learn that installing Arch is not as scary as some places on the internet make it sound, and I'm looking forward to learning more.
- I have learned some new things about Linux, especially what's required to get it running, but I do need to learn more about some of the basic, and essential, packages.
Resources and Acknowledgments
- Learn Linux TV - Arch Linux Installation Guide 2024: An Easy to Follow Tutorial
- Bread on Penguins - Beginner friendly ARCH LINUX Installation Guide and Walkthrough
- Arch Wiki – Installation Guide
Conclusion
Arch isn't as scary as it first appears, but I can see why it may appear that way. I'm looking forward to getting more involved with Arch, and Linux as a whole, and expanding my knowledge with it.
If you have a spare device, an old laptop, a Raspberry Pi, and want to get knowledge of a new OS, I'd definitely recommend giving Linux a shot, and especially Arch if you want to know more about what goes on underneath it all.
This is just part one of my experience, and I will be doing more posts with my further adventures in getting paws-on with Arch.
Follow Me
Currently, there's no option to subscribe to my blog. I want to get a privacy policy page done first, but you can follow me on X (Twitter).
There's not much there at the moment, but I'm hoping to grow this little side-project, and give myself a place to share my learning, my knowledge, and some cat pictures and tales too.