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 it is not based on any of the main distros 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 excellent 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.
You’ll probably notice that there’s no xbps
man page and no individual xbps
binary because XBPS is a collection of programs that are pretty much related and similar in structure. Still, of course, they’re different commands.
Even though the XBPS package manager has many advanced features, basic software management operations are accomplished with four command-line programs.
-
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.
An installation package in Void Linux consists of one .xbps
file and an associated .xbps.sig
file, which is 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 the required package and 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 will 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 using the grep
command.
For example, to find all the packages currently installed on your Void Linux system which contain the vlc
within their name, run:
xbps-query -l | grep vlc
Installing and Updating Packages
The xbps-install
command enables you to install, reinstall, or update packages as required by the use case.
Passing the -S
, (--sync
) option to the xbps-install
command is recommended, which updates the package index to ensure 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 them.
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 xbps-query -Rs
command gives you a brief introduction to 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. You would use it mainly to install packages that are not in the official repositories.
The core of Void’s method of organizing source package directories, build directories, and associated build system paths is a clone of 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 will 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 required to build the binary packages in isolation.
cd void-packages
./xbps-src binary-bootstrap
For 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 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 the 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.
Thank you for these articles. I’m considering moving to Void from Arch-based Endeavour. Your articles are really helping with the decision-making process. Can you explain how to uninstall something installed from source. Once you’ve built the binary using xbps-src and installed with xbps-install, do you uninstall using xbps-remove as you would for a package in the repos? Or is there another way? Thank you.
Hi Steve,
There is no difference between uninstalling a package installed directly from Void’s repo and one built from the source. In both cases, the xbps-remove command is used.
Thank you for reading Linuxiac!
Best,
Bobby