🌶️ Chilli

Arch Linux - I made a booboo!

Never underestimate the power of my human stupidity.

So I opened my arch linux laptop to update Arch using pacman. Whilst doing that, I realised that my battery was at a stunning 6%, so I picked up the power cable, and plugged it into my laptop. two seconds later my laptop simply shut-down, mid-way through the mkinitcpio stuff. Why? Well, the eegit writing this blog post hadn't checked to see if the other end of the power cable was actually plugged into the mains. Doh! Whenever I then started my Dell, it simply sent me to the BIOS screen, like the good BIOS that it is.

So, I spent about 40 mins this afternoon repairing my arch install, and this is how I did it.

  1. I went to the arch website, and downloaded their latest arch ISO onto my Apple MBP. I burnt the ISO image using Balena Etcher onto a micro SD card, and then plugged it into my Dell microSD card slot. It booted up into the BIOS, and so I changed the boot order to boot first from my microSD card; which thankfully it did.

  2. Setting up wifi using iwctl Once I had a bash interface, I followed the arch wiki and using iwctl got my wifi up and running. It's quite simple using iwctl to set this up using the CLI. Here's the condensed version:

  1. Mounting the necessary mount points. I needed to mount 3 different mount points to get everything working. I used lsblk to determine my original partition information. I then mounted them using the mount command:

then I could arch-chroot to my arch install.

  1. Cleaning up the mess First I tried to run pacman -Syu but I got an error, as I needed to remove the pacman lock file. This is simply enough sudo trash /var/lib/pacman/db.lck. You could substitute trash for rm if you're feeling brave. My thought behind doing this first was that it might trigger a mkinitcpio and also a kernel rebuild. However, it wasn't to be!

Once I had removed the lock file, and tried to update pacman -Syu, it complained that there were some files that had not been cleaned up in the linux header folders, so it failed to update the packages. I simply deleted the header files from that location, and tried running pacman again. It seemed to have worked, so I rebooted my laptop.

It hadn't worked! So I followed steps 2 & 3 above to get back online, and to remount my partitions. I started to look into my /boot area, which under arch is a standard systemd-boot config and I found a number of files were missing, namely my linux kernel (vmlinuz-linux), and the initramfs-linux.img, and I think also the intel-ucode.img. I think it's kinda logical that if my arch install is not booting up then the first place to look is the /boot folder, hence me starting my search here.

I realised that I actually had to remove the following packages from my arch install and re-install them again.

Then I needed to reinstall them both once again:

This triggered a full download and a clean install of both of these packages. Everything seemed to work, and the correct files now seem to be placed into the /boot location. Fingers crossed, so once again I rebooted, and removed the USB dongle.

Success! This time when I booted up, the familiar arch systemd-boot options displayed, and I was then able to use my arch linux system as I usually do. Phew!

So, this really speaks to the usefulness of arch-chroot, as it enabled me to get my system back up and running again. It also taught me a lesson to make sure I have a full backup of my dot files, which I still need to do (and to obviously not do a pacman -Syu without first checking my battery levels and that the power cable is plugged in on both ends!)

#Arch #Linux #troubleshooting