Updating a Linux system is not that complicated, is it? After all, to update Ubuntu-like distros, you just have to use apt update && apt upgrade.
That would have been the case if all the packages had been installed through a single package manager.
But that’s not the case anymore. You have the classic apt/dnf/pacman and then come Snap, Flatpak, and AppImage files. It doesn’t end here...
You may also install applications using PIP (for Python) and Cargo (for Rust) as well.
Use Node.js? The npm packages need to be updated separately. And, Oh My Zsh? It needs to be updated separately too.
Plugins in Vim, Atom, etc, may also not be covered by apt/dnf/pacman.
Do you see the problem now? It may not be convenient to update all packages in your system. This is the problem a new tool called topgrade aims to solve.
Topgrade: A single utility to take care of all kinds of updates
This topgrade is a CLI utility that detects which tools you use and then runs the appropriate commands to update them.
Apart from the usual Linux package managers, it can detect and update brew, cargo, PIP, pihole, Vim and Emacs plugins, R packages etc.
You can explore its GitHub page to know more.
Key Features of Topgrade:
- Ability to update packages from different package managers, including firmware!
- You do have control over how you want to update packages.
- Extremely customizable.
- Ability to have an overview even before updating packages.
So without wasting any time, let’s jump to the installation.
Install Topgrade in Linux using Cargo
The installation process is quite straightforward as I’m going to use the cargo package manager.
We already have a detailed guide with multiple methods for setting up a cargo package manager So I’m going to make it quick by using Ubuntu in my example.
So let’s start with some dependencies and installation of cargo in the least extensive way:
sudo apt install cargo libssl-dev pkg-config
Once the cargo has been installed, utilize the given command to install topgrade:
cargo install topgrade
And it will throw a warning as given:
Where you just have to add the path of cargo to run binaries. This can be done through given command where you’ve to change
sagar with your username:
echo 'export PATH=$PATH:/home/sagar/.cargo/bin' >> /home/sagar/.bashrc
Now, reboot your system and topgrade is ready to use. But wait, we need to install another package that will update cargo to get the most recent packages.
cargo install cargo-update
And we’re done with installation.
Using topgrade is extremely easy. Use a single command and that’s it:
But this won’t give you any control apart from system packages, but as I mentioned, you can blacklist the repo you don’t want to get updated.
Exclude package managers and repositories from Topgrade
Let’s suppose I want to exclude snaps and packages downloaded from the default package manager, so my command would be:
topgrade --disable snap system
For making a permanent change, you’d have to make a few changes in its config file which can be accessed through the given command:
For this example, I discluded snaps and default system repo:
Dry run topgrade
Having an estimation of outdated packages that will be updated is always a good idea and I find this most useful option from the entire catalog of topgrade.
You just have to use topgrade with
-n option and it will generate a summary of outdated packages.
A neat way of checking packages that need to be updated.
After using Topgrade for a few weeks, it became an integral part of my Linux arsenal. Like most other Linux users, I only updated packages through my default package manager. Python and Rust packages were ignored completely. Thanks to topgrade, my system is updated entirely now.
I understand that this is not a tool everyone would want to use. What about you? Willing to give it a try?