Warning: THE VOID WIKI IS DEPRECATED. It is no longer being maintained, contains outdated and incorrect information, and will eventually be shut down. Please refer to the Void Handbook, https://docs.voidlinux.org/, for the official documentation. If you can't find the information you're seeking, please raise an issue at https://github.com/void-linux/void-docs/issues

Difference between revisions of "XBPS"

From Void Linux Wiki
Jump to navigation Jump to search
m (Duncaen moved page XBPS - to XBPS without leaving a redirect)
(14 intermediate revisions by 4 users not shown)
Line 1: Line 1:
The '''X Binary Package System''' (or '''xbps''') is the binary package system used by [[Void Linux]]. xbps was designed and implemented from scratch. Its goal is to be fast, easy to use, bug-free, featureful and portable as much as possible.
As this wiki is deprecated, and will soon disappear, please refer to [https://docs.voidlinux.org/xbps/index.html the "XBPS Package Manager" section of the Void Handbook].
The XBPS code is totally compatible with [https://en.wikipedia.org/wiki/POSIX POSIX]/[https://en.wikipedia.org/wiki/Single_UNIX_Specification#1997:_Single_UNIX_Specification_version_2 SUSv2]/[https://en.wikipedia.org/wiki/C99 C99] standards, and released with a [https://en.wikipedia.org/wiki/BSD_licenses#2-clause Simplified BSD license (2 clause)]. There is a well-documented API provided by the XBPS Library that is the basis for its frontends to handle binary packages and repositories. Some highlights:
* Supports multiple local and remote repositories (HTTP/HTTPS/FTP).
* RSA signed remote repositories
* SHA256 hashes for package metadata, files and binary packages
* Supports package states (ala dpkg) to mitigate broken package installs/updates
* Ability to resume partial package install/updates
* Ability to unpack only files that have been modified in package updates
* Ability to use virtual packages
* Ability to check for incompatible shared libraries in reverse dependencies
* Ability to replace packages
* Ability to put packages on hold (to never update them)
* Ability to preserve/update configuration files
* Ability to force reinstallation of any installed package
* Ability to downgrade any installed package
* Ability to execute pre/post install/remove/update scriptlets
* Ability to check package integrity: missing files, hashes, missing or unresolved (reverse)dependencies, dangling or modified symlinks, etc.
= Rosetta Stone =
The [[Rosetta stone]] table may help you find the right commands quickly, if you know your way around in other main distro families.
=Basic Usage=
To install a single package or list of packages (including dependencies), issue the following command:
# xbps-install -S ''package_name1'' ''package_name2'' ...
To search for a package:
# xbps-query -Rs ''package_name''
To remove a single package, leaving all of its dependencies installed:
# xbps-remove ''package_name''
To remove a single package and all of its dependencies that are not required by other packages:
# xbps-remove -R ''package_name''
To synchronize your repository databases and update your system to the most recent packages, including their dependencies:
# xbps-install -Su
==Package expressions==
Package expressions are used to refer to specific packages based on package name and version number.
A package expression matches specific packages to a pattern; currently XBPS >= 0.19 supports 3 ways to specify them:
*by specifying a package name, i.e foo.
$ xbps-query foo
*by specifying the exact package name and version, i.e foo-1.0_1:
$ xbps-query foo-1.0_1
*by specifying a package name and version separated by any of the following version comparison operators:
< less than
> greater than
<= less or equal than
>= greater or equal than
$ xbps-query foo>=2.0
$ xbps-query foo<=1.0.
Repositories are the heart of the xbps package system. Repositories can be locally or remotely available:
*local: repository is available in a local directory, e.g /xbps/repository.
*remote: repository is available in a remote location, e.g <nowiki>http://my.domain.com/repository</nowiki>
Repositories can be declared in a file stored in <code>/etc/xbps.d</code> with a simple format:
Where url can be a path to a directory (local) or an URL to the repository (remote):
# echo 'repository=/path/to/dir' > /etc/xbps.d/my-local-repo.conf
# echo 'repository=<nowiki>http://my.domain.com/repository</nowiki>' > /etc/xbps.d/my-remote-repo.conf
System repositories can be available at <code>/usr/share/xbps.d</code>, files bearing the same filename available in <code>/etc/xbps.d</code> override those defined in <code>/usr/share/xbps.d</code>.
==== Substituting the default system repository with a regional repository ====
This helps relieve the workload for the default server plus typically improves update speeds. 
'''Step One:'''  Identify the file containing your system repository
# ls /usr/share/xbps.d
00-repository-main.conf  musl-arch.conf  void-virtualpkgs.conf  xbps.conf
A quick check (<code># cat 00-repository-main.conf</code>) demonstrates that, in our example, <code>00-repository-main.conf</code> is the file that contains the system repository.
'''Step Two:''' From the next [[XBPS#Official_Repositories|section]], select the official repository for your installation (glibc vs musl) that is nearest to your location.  In our example, for a musl installation, we will assume that it is https://alpha.de.repo.voidlinux.org/current/musl.
Replace the url in the following example with your regional repository's url (note no trailing slash), and replace <code>00-repository-main.conf</code> with whichever filename you identified in Step One to create a like-named file in /etc/xbps.d:
# echo 'repository=<nowiki>https://alpha.de.repo.voidlinux.org/current/musl</nowiki>' > /etc/xbps.d/00-repository-main.conf
'''Step Three:'''  Sync repo
# xbps-install -Su
==Official Repositories==
'''For the official and up-to-date mirror list''' please see the [https://voidlinux.org/download/#mirrors download] page.
==== glibc ====
Packages for glibc builds are found in the "current" subdirectory of any official repo, like so:
* '''''repo_URL'''''/current/
Packages for musl builds are found in the "current/musl" subdirectory of any official repo, like so:
* '''''repo_URL'''''/current/musl/
====Repository public keys====
Packages and repositories provided by [[Void Linux]] are signed with RSA keys.
You can print the repository RSA public key fingerprint with xbps-query:
$ xbps-query -vL
Signed-by: Void Linux
4096 60:ae:0c:d6:f0:95:17:80:bc:93:46:7a:89:af:a3:2d
Signed-by: Void Linux
4096 3d:b9:c0:50:41:a7:68:4c:2e:2c:a9:a2:5a:04:b7:3f
== Sub-repositories ==
Additional glibc sub repositories exist in the official repositories:
Packages for these repositories exist in the main repository, i.e:
  # xbps-query -Rs void-repo
  [*] void-repo-debug-9_1            Void Linux drop-in file for the debug repository
  [*] void-repo-nonfree-9_1          Void Linux drop-in file for the nonfree repository
  [*] void-repo-multilib-6_1        Void Linux drop-in file for the multilib repository
  [*] void-repo-multilib-nonfree-6_1 Void Linux drop-in file for the multilib/nonfree repository
To install a subrepository, simply run <code>xbps-install ''repository_name''</code>.
==== debug ====
Contains -dbg pkgs for debugging:
  # xbps-install void-repo-debug
==== nonfree ====
Contains pkgs that don’t have free licenses
  # xbps-install void-repo-nonfree
==== multilib ====
Contains 32bit pkgs for 64bit platforms
  # xbps-install void-repo-multilib
==== multilib/nonfree ====
Contains non free 32bit pkgs for 64bit platforms
  # xbps-install void-repo-multilib-nonfree
'''*NOTE: There are nonfree and debug sub repositories for musl but no multilib subrepo.'''
After installing any of them don’t forget to synchronize the repository data:
# xbps-install -S
Unlike some other package management utilities, xbps consists of multiple discrete utilities to accomplish  certain tasks for package management:
*<code>[[#xbps-install|xbps-install]]</code> - XBPS utility to (re)install and update packages
*<code>[[#xbps-query|xbps-query]]</code> - XBPS utility to query for package and repository information
*<code>[[#xbps-remove|xbps-remove]]</code> - XBPS utility to remove packages
*<code>[[#xbps-reconfigure|xbps-reconfigure]]</code> - XBPS utility to configure installed packages
*<code>[[#xbps-pkgdb|xbps-pkgdb]]</code> - XBPS utility to report/fix issues and modify the package database (pkgdb)
*<code>[[#xbps-rindex|xbps-rindex]]</code> - XBPS utility to manage local binary package repositories
*<code>[[#xbps-alternatives|xbps-alternatives]]</code> - XBPS utility to handle alternatives
This utility can be used to install, update, reinstall, or downgrade a package, or all packages in your system, and to syncronize the remote repositories data.
====Synchronize remote repository data====
# xbps-install -S
'''''Note''': It's generally a good idea to synchronize your repository index before installing or updating packages to avoid attempting to download outdated packages. The <code>-S, --sync</code> flag can be used while installing or updating to be always in sync with remote repositories, i.e:
====Installing/updating a single package====
# xbps-install -S pkg
If pkg is installed and there’s a newer version, the package will be upgraded to that version of the first repository containing it; otherwise the package will be installed.
====Reinstalling/downgrading to a specific package version====
The easiest way to downgrade is by using {{ic|xdowngrade}} from [[xtools]].
To downgrade using just XBPS, you must first add the package name you want to downgrade to your local repository:
# xbps-rindex -a /var/cache/xbps/package-name.xbps
Then downgrade with {{ic|xbps-install}} replacing {{ic|pkg-1.0_1}} with the desired package:
# xbps-install -R /var/cache/xbps/ -Sf pkg-1.0_1
The -R option enables repository mode. This mode explicitly looks in repositories, rather than looking in the target root directory. The -f flag is necessary to force downgrade/reinstallation of an already installed package.
====Updating your system====
# xbps-install -Su
This will update all currently installed packages to the latest version found in the registered repositories, performing a global system update. This is the recommended command to keep your system up to date daily.
This utility can be used to query for information about packages installed in your system and in specific repositories.
<code>xbps-query</code> has two working modes:
*Local: shows information of packages installed in the rootdir
*Repository: shows information of packages stored in repositories
The <code>-R</code> or <code>--repository</code> option switches to the repository mode. Most options are able to work in local and repository mode.
====Listing registered repositories====
$ xbps-query -L
====Listing installed packages====
$ xbps-query -l
====Listing packages in a specific mode====
$ xbps-query -p hold -s ""
$ xbps-query -p repolock -s ""
====Showing information for a package====
$ xbps-query [-R] pkg
====Showing the files list for a package====
$ xbps-query [-R] -f pkg
====Showing the required dependencies for a package====
$ xbps-query [-R] -x pkg
====Showing the reverse dependencies for a package (packages that depend on it):====
$ xbps-query [-R] -X pkg
====Searching for packages matching its package name/version and/or description====
$ xbps-query [-R] -s pattern
====Searching for packages matching a filename====
$ xbps-query [-R] -o '*/filename'
This utility can be used to remove installed packages and clean the cache directory.
====Removing a single package====
# xbps-remove pkg
====Removing a single package and recursively all packages that were installed as dependencies====
# xbps-remove -R pkg
====Cleaning up the cache directory====
# xbps-remove -O
====Removing all package orphans====
# xbps-remove -o
Note: here "orphan" means packages not installed manually and no packages depended. In Debian, "orphan packages" refer to packages abandoned by their package maintainer.
====Removing all package orphans and clean the cache directory====
# xbps-remove -Oo
This utility can be used to configure or force reconfiguration of an installed package.
When xbps-install installs a package, it performs the task in two phases: unpacking and configuration. The unpacking phase unpacks the package files of the binary package into disk, and the configuration phase performs additional steps necessary to execute the software.
Packages that were not configured can be listed with <code>xbps-query -l</code> if its first two characters are uu. In that case, those packages should be reconfigured:
# xbps-reconfigure -a
====Configure a package that is in unpacked state====
# xbps-reconfigure pkg
====Configure all packages that are in unpacked state====
# xbps-reconfigure -a
====Force reconfiguration of a package (even if it was configured previously):====
# xbps-reconfigure -f pkg
This utility can be used to report errors in installed packages, as well as changing some of its properties.
====Checking for errors in an installed package====
# xbps-pkgdb pkg
If pkg does not have any error there won’t be any output and return value will be 0.
====Checking for errors in all installed packages====
# xbps-pkgdb -a
====Changing properties of an installed package====
An installed package can have different modes depending how it was installed. If a package was explicitly installed by the administrator and not as a dependency, its installation mode will be set to manual, otherwise auto.
Packages that were installed manually can be listed with:
$ xbps-query -m
or per-package:
$ xbps-query -p automatic-install pkg
It’s possible to change this mode with xbps-pkgdb(1):
# xbps-pkgdb -m auto pkg
# xbps-pkgdb -m manual pkg
A package can also be put on hold mode to skip updates while performing a system update:
# xbps-pkgdb -m hold pkg
# xbps-pkgdb -m unhold pkg
A package can also be put in repository locked mode (only update from the same repository it installed):
# xbps-pkgdb -m repolock pkg
# xbps-pkgdb -m repounlock pkg
This utility can be used to generate local repositories, remove obsolete binary packages stored in them, and to sign the packages with a cryptographic key.
====Creating a local repository====
$ xbps-rindex -a /path/to/dir/*.xbps
Once the command has run, a local repository is available at /path/to/dir and can be used as an argument to the --repository option or be declared in /etc/xbps.d/.
====Adding a specific package to a repository====
$ xbps-rindex -a /path/to/dir/foo-1.0_1.x86_64.xbps
====Force addition of a specific package to a repository====
$ xbps-rindex -f -a /path/to/dir/foo-1.0_1.x86_64.xbps
====Cleaning a repository (removing stalled entries)====
$ xbps-rindex -c /path/to/dir
====Removing obsolete packages in a repository====
$ xbps-rindex -r /path/to/dir
====Signing a repository====
Initialize the repository metadata with signing properties:
$ xbps-rindex --sign --signedby "I'm Groot" /path/to/dir
Signs all binary packages stored in repository with your specified RSA key. If the --privkey argument is not set, it defaults to ~/.ssh/id_rsa.
$ xbps-rindex --signedby "I'm Groot" --sign-pkg /path/to/dir/*.xbps
The xbps-alternatives utility lists or sets the alternatives provided by installed packages. Alternatives are classified by groups, and a group contains a number of symbolic links which are applied when the group is set.
====List all alternatives====
$ xbps-alternatives -l
====List alternatives for a specific package====
$ xbps-alternatives -l foo
====Set all alternative groups====
$ xbps-alternatives -s foo
====Set specific alternative groups====
$ xbps-alternatives -g bar -s foo
= Front-ends =
there are 3 front-ends for xbps
# <code>octoxbps</code>, which is a qt gui for xbps. https://github.com/aarnt/octoxbps
# <code>XbpsUi</code>, which is a simple script bash helper for xbps. https://github.com/davidpaulos/XbpsUI
# <code>vpm</code>, which is another simple bash helper for xbps. https://github.com/netzverweigerer/vpm
== octoxbps (qt)==
==== Install octoxbps: ====
  # xbps-install octoxbps kde-cli-tools
== XbpsUI ==
simple front-end script for the x binary package system meant for void-Linux meant to safe time and sanity when installing many packages
requires: fzf
==== Install requires programs: ====
  # xbps-install wget fzf
==== download script: ====
  # wget https://codeload.github.com/davidpaulos/XbpsUI/zip/master
==== launch: ====
  # sh XbpsUI.sh
== vpm ==
Installing vpm should be as easy as following the simple following steps:
==== Install git via xbps-install ====
  # xbps-install -S wget git
==== Download tools ====
# wget https://codeload.github.com/netzverweigerer/vpm/zip/master
==== Or clone vpm repository ====
  # git clone git@github.com:netzverweigerer/vpm.git
[[Category:System administration]]

Latest revision as of 14:32, 13 June 2020

As this wiki is deprecated, and will soon disappear, please refer to the "XBPS Package Manager" section of the Void Handbook.