XBPS is the default command line package manager tool in Void Linux. Here’s how to use it to install, remove, update, and upgrade packages in Void Linux in a breeze.
Table of Contents
- Void Linux Repositories
- Update Package Lists
- Searching for Packages
- Searching Through Installed Packages
- Installing and Updating Packages
- Removing Packages
- Get Details About Package
- Installing Packages from Source
- Conclusion
Void Linux is an independently developed, rolling-release, general-purpose operating system. It’s built from scratch, which means that it is not based on any of the principal distros that we know. In addition, Void is arguably the most BSD-like of all Linux distributions.
One of the reasons to consider using Void is the amazing package management system.
XBPS (X Binary Package System) is the package manager that’s used on Void Linux. It was originally written for Void from scratch, but it’s supposed to be also a portable package manager you could theoretically use somewhere else.
One thing you’ll probably notice is there’s no xbps
man page, there’s no individual xbps
binary because XBPS is a collection of several programs that are pretty much related, similar in structure but of course, they’re different commands.
Even though the XBPS package manager has very advanced functions, basic software management operations can be accomplished with only four commands.
-
xbps-query
for querying the repositories and the installed system. -
xbps-install
for updates and installations. -
xbps-remove
for uninstalling. -
xbps-src
for building packages distributed by third parties as source archives.
A package in Void Linux consists of one .xbps
file and associated .xbps.sig
file, which together are used to install a particular piece of software on a Void system.
Void Linux Repositories
By default Void Linux only has free software. In other words, there’s a division between free software and non-free software. If you want to install non-free software on your Void Linux system, you need to install the following extra repository:
void-repo-nonfree
void-repo-multilib-nonfree
Just type in terminal:
sudo xbps-install -S void-repo-nonfree void-repo-multilib-nonfree
To query the list of working repositories, add the -L
(--list-repos
) option to the xbps-query
command:
xbps-query -L
Update Package Lists
Like all package managers, XBPS uses repositories to obtain packages. And like any other system, it’s important to keep your Void system up-to-date.
The xbps-install -Su
command (--sync
, --update
) downloads up-to-date information about available software packages:
sudo xbps-install -Su
This downloads the latest up-to-date software packages and their metadata – package names, version numbers, etc.
Searching for Packages
To search available repositories for packages, use the xbps-query
command. This utility in XBPS enables you to search for a required package and also about the information on the repository.
To search for a specific package, for example, vlc
, in the remote repositories, run:
xbps-query -Rs vlc
The -R
(--repository
) option enables repository mode and -s
(--search
) searches for packages by matching patterns. In our case it looks for vlc
related packages, so everything that has vlc
either in the name or the description is going to pop up.
Searching Through Installed Packages
What if you want to list specific currently installed packages only? Just pass the -l
(--list-pkgs
) option to the xbps-query
command and pipe the output by using the grep
command.
For example, to find all the packages currently installed on your Void Linux system which contains the vlc
within their name run:
xbps-query -l | grep vlc
Installing and Updating Packages
The xbps-install
command enables you to install or reinstall or update packages as required by the use case.
It’s recommended to pass the -S
(--sync
) option to the xbps-install
command which basically updates the package index just to make sure you’re getting the most recent version.
So if you want to install something, for example vlc
, run:
sudo xbps-install -S vlc
As you can see from the image above, xbps-install
will automatically identify all the necessary dependencies and take care of it.
Removing Packages
The xbps-remove
utility removes installed packages from the system. Adding the -R
(--recursive
) option to the command removes unneeded dependencies that were installed by the target package.
To remove a package with all its dependencies, for example, vlc
, run the following command:
sudo xbps-remove -R vlc
Get Details About Package
The output of the xbps-query -Rs
command gives you a brief introduction of the packages. If you want more details, use the xbps-query
command with only the -R
(--repository
) option added.
For example, to display the detailed information from the sync database about the vlc package, run:
xbps-query -R vlc
Installing Packages from Source
xbps-src
itself is nothing but a Bash shell script that allows you to build and install source packages from Void’s GitHub repository into Void’s binaries that you can use XBPS to install.
The main reason you would use it is to install packages that are not in the official repositories.
The core of Void’s method of organizing source packages directories, build directories, and associated build system paths is a clone Void’s GitHub repository of source packages.
Therefore, make sure that you have the git
package installed. Run this command in your terminal if it is not.
sudo xbps-install -S git
Then you are going to need to clone the Void’s packages repository from GitHub.
git clone https://github.com/void-linux/void-packages.git
This will create the directory void-packages
with the source tree of all Void packages in srcpkgs
.
Next, cd
into the newly created directory and install the binary bootstrap which are required to build the binary packages in isolation.
cd void-packages
./xbps-src binary-bootstrap
For the purpose of this guide, I am going to install the Google Chrome browser. This will work for any package though.
First, enable restricted packages:
echo XBPS_ALLOW_RESTRICTED=yes >> etc/conf
The package is built with:
./xbps-src pkg google-chrome
The above process places the built binary package in the void-packages/hostdir/binpkgs/nonfree/
directory.
Finally, the package can be installed with:
sudo xbps-install --repository=hostdir/binpkgs/nonfree google-chrome
Conclusion
This guide has covered most of the commands that you need to know when using the XBPS package manager. Hopefully, it was helpful in your journey with Void Linux.
Comparable to Arch or Gentoo, Void can be turned into whatever you wish to assemble. Here’s our excellent step-by-step tutorial, which will guide you through all the steps of the installation: How to Install Void Linux: A Complete Step-by-Step Guide
You can find detailed documentation about XBPS package manager in the official Void Linux Handbook.
Hello and thank you for the excellent set of articles on Void. I found them invaluable in getting started with the distro. I have a question about the source packages. Is there a simple way to keep them up to date? I assume that every so often I will need to refresh the git repo and then somehow compare what has been updated? If you have any advice on this I would love to hear it. Thanks again!
Hi Eric,
You can use the “xbps-src update-sys” command. It rebuilds all packages in your Void Linux system that are outdated and updates them.