A while back I wrote about playing around with different distributions on an older laptop I had lying around. Well my time with Zorin OS has come to an end and I thought I might try out a distribution I’d been meaning to mess with for some time now: Arch Linux.
Arch Linux is an interesting distribution where you sort of build your own setup using some excellent tools provided by the Arch team. So instead of downloading, say, an Ubuntu ISO and installing everything that the Ubuntu team had decided to include, with Arch you download an Arch ISO which includes only the tools needed to help you download and install the packages and components that you want for your Linux installation. This gives you quite a bit of flexibility but also comes with some added complexity, which is honestly why I’ve been putting it off for a while. That said on the difficulty scale Arch is supposed to be a bit more friendly than Gentoo and if you’ll recall I had plenty of fun with Gentoo so this can’t be so bad right?
Anyway I downloaded the latest release of Arch, which wasÂ archlinux-2017.08.01-x86_64 at the time of this writing, and copied it to my installation USB using the following command from their website:
sudo dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress && sync
Warning: this commandÂ will destroy any data you had on your USB drive so be careful when running it!
Next up I booted my machine using the USB drive and was taken to a terminal with the following info:
Arch Linux 4.12.3-1ARCH (tty1)
archiso login: root (automatic login)
root@archiso ~ #
The Arch installation guide recommends getting a network connection at this point. Seeing as this is a laptop I’m installing it on my goal was to setup a wireless connection and so after confirming that I couldn’t currently ping anything (which would have been magic had that actually worked without any Ethernet cable connected!) I followed their instructions to disable DHCP by running the following command:
systemctl stop email@example.com
The part after the ‘@’ may vary on your computer. This is when I hopped over to the Wireless network configuration part of their wiki which told me that in order toÂ find the name of my wireless adaptor I should run:
which printed out the following devices: lo (loopback), ens2 (ethernet card) and wls3 (WiFi card). So now that I knew the name of the WiFi card I could enable it by running:
ip link set wls3 up
Lucky for me I didn’t get any errors when running that command which means my machine should already have the correct drivers to use! OK so now the first big choice: do I want to manage my wireless network manually or automatically? Well seeing as I’m pretty lazy, and far more likely to break something if I do it manually, I opted for the automatic approach and chose netctl to help because it was included in the download ISO.
After reading about where to copy example configuration files from and where they need to go I stumbled across something about a neat command calledÂ wifi-menu which helps to automate things for you. Sounds just like what I need!
Running this command, selecting my WiFi network and entering the password created the configuration file I needed and put it into the right directory location at /etc/netctl! Now was the big test… would it work?
netctl start profile_name
FAIL! And things were going so well up until now! OK let’s try and figure out why it failed…
This printed a lot of info but it highlighted that the reason it failed was because the interface was already up? Uhh… OK?
ip link set wls3 down
netctl start profile_name
Right… so I have to turn off the WiFI card before starting netctl which I guess turns it back on? Seems like it could have just confirmed that it was already on before continuing but anyway it worked! I can now ping things! I am l33t! The last step here is to make sure this profile is always used on startup which can be done by running this command:
netctl enable profile_name
Cool so now that I’ve master command line WiFi kung fu and I’m internet enabled I can continue with my installation. What super exciting next step stands in my way to total Arch installation? Oh… updating the system clock… cool.
timedatectl set-ntp true
Normally now would be the time to blow away your hard drive and setup your partitions but I’m coming from a previous Linux install on this system so the partitions are probably sized OK. Instead all I’m going to do is re-format the root partition:
Alright, now to mount my partition so the real fun can begin!
mount /dev/sda1 /mnt
And start installing the base system:
pacstrap /mnt base
After a lot of scrolling text (when did I join the Matrix?) the base installation was complete which means I could move on to creating my fstab file (you know so my system can actually boot again at some point… I hope):
genfstab -U /mnt >> /mnt/etc/fstab
Which I guess means it’s time to chroot into our new system!
Oh look more fun with setting up the clock!:
ln -sf /usr/share/zoneinfo/America/Toronto /etc/localtime
Wow there are a lot of manual steps here… OK next I had to set my system locale by editing the fileÂ /etc/locale.gen and removing the comment (#) in front of the language I want to use (en_US.UTF8 UTF8). And finally by running:
Apparently you also need to add “LANG=en_US.UTF-8” (without quotes) to the file /etc/locale.conf.
And obviously the most important step: naming your machine by adding its name to the fileÂ /etc/hostname. The installation guide also recommends you add “127.0.1.1 myhostname.localdomain myhostname” to your /etc/hosts. What happens if you don’t? No idea, but if they thought it deserved a recommendation then I’m going to do it!
Setting the root password can be done by running theÂ passwd command:
Finally every machine needs some sort of boot loader and I’m partial to the classic GRUB so that’s what I installed:
pacman -S grub
Then once it was installed to my computer I ran:
grub-install –target=i386-pc /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
which actuallyÂ installedÂ and configured it as the boot loader.
Also because my laptop has an Intel CPU the installation guide recommends installing the intel-ucode package and getting the latest microcode updates for the CPU. So I did that by running:
pacman -S intel-ucode
grub-mkconfig -o /boot/grub/grub.cfg
which also re-generated the grub config file so that it could correctly use the microcode.
OK we’re at the moment of truth… will it actually boot?
umount -R /mnt
Success! It booted to a login where I was able to login as root without issue. Unfortunately it appears as though my networking was no longer working and after some investigation it looks like it didn’t carry over my networking configuration (which must have been stored outside of the chrooted environment). Sadly the base installation did not include the package dialog which was needed for theÂ wifi-menuÂ command to work. It also didn’t include wpa_supplicant which is needed to connect to my secured WiFi network so I actually had to resort to grabbing an Ethernet cable and installing those two packages after getting a connection that way. Note to future self: remember to install those two packagesÂ before finishing with the initial installation.
I think I’ll leave it at that for this post. Join me next time as I go through and configure my system!