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.
Table of Contents
- What is XBPS in Void Linux?
- Void Linux Repositories
- Update Package Lists
- Searching for Packages
- Searching Through Installed Packages
- Installing and Updating Packages
- Removing Packages
- Remove Orphaned (Unused) Packages
- Get Details About Package
- Clean-Up Package Cache
- Installing Packages from Source
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:
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
--list-repos) option to the
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.
xbps-install -Su command (
--update) downloads up-to-date information about available software packages:
sudo xbps-install -Su
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
--repository) option enables repository mode, and
--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
--list-pkgs) option to the
xbps-query command and pipe the output using the
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
xbps-install command enables you to install, reinstall, or update packages as required by the use case.
--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,
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.
xbps-remove utility removes installed packages from the system. In addition, adding the
--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
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
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
--repository) option added.
For example, to display the detailed information from the sync database about the vlc package, run:
xbps-query -R vlc
Clean-Up Package Cache
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
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
This will create the directory
void-packages with the source tree of all Void packages in
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 the following:
./xbps-src pkg google-chrome
The above process places the built binary package in the
Finally, the package can be installed:
sudo xbps-install --repository=hostdir/binpkgs/nonfree google-chrome
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.
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!
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.
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!