How to Use XBPS Package Manager on Void Linux

XBPS is the default command-line package manager tool in Void Linux. Here is how to easily install, remove, update, and upgrade packages in Void Linux.

Void Linux is an independently developed, rolling-release, general-purpose Linux operating system. It is built from scratch and 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 this distro is the excellent package management system. If you are new to Void or want to learn more about using the XBPS package manager, this guide is for you.

In this article, we will explain what XBPS is, how to install and update packages, search for packages, and manage dependencies. By the end of this guide, you will have a solid understanding of using the XBPS package manager on Void Linux.

What is XBPS in Void Linux?

XBPS (X Binary Package System) is the package manager used on Void Linux to handle software installation, upgrades, and removal. Initially written for Void from scratch, it is also a portable package manager you could theoretically use elsewhere.

You’ll probably notice that there is 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 are 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 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 is a division between free 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 the 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
Get List of the Working Void Linux Repositories Configured on the System

Update Package Lists

Like all package managers, XBPS uses repositories to obtain packages. And like any other system, keeping your Void system up-to-date is essential.

The xbps-install -Su command (--sync, --update) downloads up-to-date information about available software packages:

sudo xbps-install -Su
XBPS Update Package Lists

This downloads the latest 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
XBPS Searching for Packages

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? 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
Searching Through Installed Packages in Void Linux by Using XBPS

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 ensure you get the most recent version.

So if you want to install something, for example, vlc, run:

sudo xbps-install -S vlc
Installing Packages on Void Linux by Using XBPS

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. In addition, 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
Removing Packages from Void Linux by Using XBPS

Remove Orphaned (Unused) Packages

After removing a package in Void Linux, there may still be some remaining orphaned (unused) packages that were dependencies of the removed package. However, these orphaned packages are not required anymore, so we can get rid of them to free up some space.

To remove these packages, run the following:

sudo xbps-remove -yo

You can also free up more space by removing old installed versions of the Linux kernel from your system:

sudo vkpurge rm all

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
XBPS Get Detailed Information About Package

Clean-Up Package Cache

Every time xbps-install downloads a new pkg, either a new installation or upgrade, it is stored in “/var/cache/xbps.” So, if you don’t remove them periodically, they will slowly eat up your hard drive space; sooner or later, you could have low disk space.

To avoid this is good to remove the cache periodically. For example, to remove all the cached packages, execute the following:

sudo xbps-remove -yO

Installing Packages from Source

The xbps-src tool itself is 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 will mainly use it to install packages unavailable in the official Void 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
Cloning the Void's Packages Repository from GitHub

This will create the directory void-packages with the source tree of all Void packages in srcpkgs.

The Void's Source Packages GitHub Repository

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
Void's XBPS 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 the following:

./xbps-src pkg google-chrome
XBPS Building Package from Source on Void Linux

The above process places the built binary package in the void-packages/hostdir/binpkgs/nonfree/ directory.

Void Linux XBPS Package

Finally, the package can be installed:

sudo xbps-install --repository=hostdir/binpkgs/nonfree google-chrome
Installing Package from Source with XBPS on Void Linux

Conclusion

The XBPS package manager is a powerful tool that makes managing software on Void Linux easy and efficient. This guide has covered most of the commands you need to know when using it. Hopefully, it was helpful in your journey with Void Linux. With this knowledge, you can now explore the vast and growing library of packages available on Void and customize your system to suit your needs.

Moreover, similarly to Arch or Gentoo, Void can be transformed into whatever you want. Here is our comprehensive 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.

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Think You're an Ubuntu Expert? Let's Find Out!

Put your knowledge to the test in our lightning-fast Ubuntu quiz!
Ten questions to challenge yourself to see if you're a Linux legend or just a penguin in the making.

1 / 10

Ubuntu is an ancient African word that means:

2 / 10

Who is the Ubuntu's founder?

3 / 10

What year was the first official Ubuntu release?

4 / 10

What does the Ubuntu logo symbolize?

5 / 10

What package format does Ubuntu use for installing software?

6 / 10

When are Ubuntu's LTS versions released?

7 / 10

What is Unity?

8 / 10

What are Ubuntu versions named after?

9 / 10

What's Ubuntu Core?

10 / 10

Which Ubuntu version is Snap introduced?

The average score is 68%

4 Comments

  1. 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,

      First, go to the “void-packages” directory and run “git pull“. Then, you can use the “./xbps-src update-sys” command. It automatically rebuilds and updates all source packages in your Void Linux system that are outdated.

  2. 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

Leave a Reply

Your email address will not be published. Required fields are marked *