Updating Arch Linux
First things first , don’t take a lot of time to update (Chances of breaking is quite low) yet better to update once in a while. Like weekly or two weeks once. I also get to find folks who update like hourly. That’s certainly an addiction for sure which needs to be treated.
AUR is your holy grail. Each and every update is posted over here. Any doubts visit AUR. Any problems visit AUR. Anything related to Arch , first visit Arch user repository.
Before updating, just visit the linux kernel archives to check the stable version which is currently present and check with the linux-lts
version in AUR just to get an idea of the update and understand about security patches and new features if present.
You can check the current version of your arch by pacman -Qi linux
. This is just a sample of how it looks like
Name : linux
Version : 6.12.10.arch1-1
Description : The Linux kernel and modules
Architecture : x86_64
URL : https://github.com/archlinux/linux
Licenses : GPL-2.0-only
Groups : None
Provides : KSMBD-MODULE VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE
Depends On : coreutils initramfs kmod
Optional Deps : linux-firmware: firmware images needed for some devices [installed]
scx-scheds: to use sched-ext schedulers
wireless-regdb: to set the correct wireless channels of your country
Check Mirrors
Mirrors, simply put are the server locations from which your system gets to download packages and receive updates. These mirrors are needed for retrieval of packages for updates,installs and upgrades.
Since this is entirely cloud based, these mirrors face the challanges of bandwidth and availability. If there are too many connections or network traffic at that particular point of time, the server can end up being slow.
Hence it is important to make sure that the mirrors you computer uses is up-to-date.
Go to Mirrors and then proceed to Successfully syncing mirrors.
Sort by your country and check the completion percentage and the mirror score.Lower mirror score indicates more reliability and performance.This is just to get an idea about the mirrors which we might potentially use.
Using Reflector
While there is certainly the manual way of selecting mirrors and then updating them via the command line. I personally prefer using reflector
. It is a tool to generate mirror lists and updates the mirrorlist files.
You can pass parameters based on the region you are from and rank the them according to download speed as well.
Install reflector by sudo pacman -S reflector
.
Now just make a backup of your old mirrorlist, just in case.
sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/old-mirrorlist
Once the backup is taken, find out your country’s code using the command reflector --list-countries
. Now you can update your mirrorlist by running the command based on your country.
sudo reflector --verbose --country IN --protocol https --sort rate --latest 10 --save /etc/pacman.d/mirrorlist
What does this command mean:
- verbose - gives us a detailed output
- protocol - Selecting mirrors based on specified protocol like https,http etc
- sort - used to sort the results based on the download rate here.Doing this ensures we have the fastest mirror upfront.
Great! Now that you have updated your mirrorlist manually, you can also automate it. Using this command
sudo systemctl enable reflector.timer
sudo systemctl start reflector.timer
This ensures that your mirrorlist is updated whenever you boot your computer.
Update the system
Now that the mirrorlist is updated, single commands is all it takes
sudo pacman -Syyu
- Force a complete refresh of the package databases (-yy), ensuring that your local mirror list and package metadata are up-to-date.
- Upgrade all packages (-u) on your system to the latest versions available in the repositories
Dont forget to reboot the system, to enforce the updates done!.
Over a period of time, you can create a custom bash script that automatically gets to do all this via a single command.
After updating check the version for confirmation. Voila!