Managing Packages with xbps
Foreword⌗
This guide assumes no prior knowledge. We will go through the basics of installing packages, finding explicitly installed packages, finding/deleting orphaned packages and finally blacklisting dependencies that may not be needed. This guide assumes the user has followed the minimal installation guide or has a similarly barebones system.
Updating xbps
⌗
First, let’s make sure xbps is up to date.
$ sudo xbps-install -Su
Searching for Packages⌗
Searching Locally⌗
We can search locally installed packages with xbps-query
and the name of the package. this will prove useful for managing dependencies as we’ll get to below.
This will output all details about the “linux” package currently installed, including all of it’s dependencies.
# Searches locally
$ sudo xbps-query linux
Searching the Repo⌗
To search online for software not currently installed, use the -Rs operand with xbps-query. This will search for every package that contains the entered string. To view every package that contains “firefox” in it’s name, utilize the -Rs
operands.
# Searches the repo for any package containing "firefox"
$ xbps-query -Rs firefox
If instead we wanted to view all of the details of a particular package on the repo, we would utilize the -R
operand. This will output all of the details of the package “firefox”
# Outputs the specific details for the "firefox" package
$ xbps-query -R firefox
List all Explicitly Installed⌗
To search for programs explicitly installed by you (i.e, not a dependency, rather one you explicitly installed via xbps-install
), use the -m
argument
# Displays all explicitly installed packages
$ xbps-query -m
In addition to this, we may utilize a the below command to output a list of currently installed packages in order of installation date. The ones closest to the bottom are the most recently installed
$ sudo xbps-query -p install-date -s '' | sort -k2
Removing Software⌗
Now let’s discuss the removal of software. We will cover regular removal, purging of orphans, cleaning the cache and blacklisting dependencies via “ignorepkg”. That last part is completely optional and may lead to instability unless what you’re adding to ignorepkg is 100 percent unneeded.
The most basic implimentation of package removal is xbps-remove
with no further arguments. This command will remove the explicitly named package, leaving it’s dependencies and config files in ~/.config intact.
Recursively Remove Orphans⌗
We will be utilizing the xbps-remove command to delete packages. Here is the most robust way to do it out of the gate.
$ sudo xbps-remove -Rcov firefox
# The -R operand will recursively delete dependencies for the named package
# The -o operand will delete all orphans in the system.
# The -c operand also deletes the config files for the named packages.
# The -v operand ensures that xbps's output is verobse for this command.
Blacklisting dependencies⌗
This part is wholly optional. Many packages (looking at you, KDE) will have packages listed as dependencies which aren’t actually necessary for function on your computer. Here is how to track them down and blacklist them from being installed. We will be using “void-artwork” as an example here, which is included in base-system. first, we must look at a package. look at the output of “run depends”
$ sudo xbps-query base-system
as we can see, void-artwork
is listed as a dependency. if we attempt to remove it right now, it’ll tell us we can’t as it’s a dependency of base-system
. we could force it’s removal, but it would be reinstalled next time we update. let’s blacklist it and remove it.
in this file, we define exactly what packages to ignore. by defualt, this file should not exist and will be created empty.
$ nano /etc/xbps.d/99-ignore.conf
...
# Packages from base-system below:
ignorepkg=void-artwork
# Packages from kde5 below:
ignorepkg=bluedevil
in the above example, i also included another file for bluetooth that KDE pulls. we have not done this in our example.
for void-artwork
, however, as you do this it’s a good idea to separate these packages and comment what you’re removing, perhaps based on function or package group.
now we may remove the void-artwork
package, and it will not be reinstalled next time we update
$ xbps-remove void-artwork