<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Matthias</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Matthias"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Matthias"/>
	<updated>2026-05-05T12:35:28Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Alpine_Package_Keeper&amp;diff=28848</id>
		<title>Alpine Package Keeper</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Alpine_Package_Keeper&amp;diff=28848"/>
		<updated>2025-01-17T10:09:08Z</updated>

		<summary type="html">&lt;p&gt;Matthias: /* Search for Packages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--For searching: apk, APK--&amp;gt;&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
This page documents the Alpine Package Keeper(APK), the package manager in Alpine Linux. For a quickstart, refer [https://docs.alpinelinux.org/user-handbook/0.1a/Working/apk.html Working with APK]. Package management in [[Installation#Diskless_Mode|Diskless]] mode requires additional steps involving [[Alpine_local_backup|Alpine Local Backup Utility (&#039;&#039;&#039;lbu&#039;&#039;&#039;) ]].&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
The {{pkg|apk-tools}} provides &#039;&#039;&#039;apk&#039;&#039;&#039; and it supports the following operations:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| [[#Add a Package|add]] &lt;br /&gt;
| Add new packages or upgrade packages to the running system&lt;br /&gt;
|-&lt;br /&gt;
| [[#Remove a Package|del]]&lt;br /&gt;
| Delete packages from the running system&lt;br /&gt;
|-&lt;br /&gt;
| [[#World|fix ]]&lt;br /&gt;
| Repair packages or system&lt;br /&gt;
|-&lt;br /&gt;
| [[#Update Package list|update]] &lt;br /&gt;
| Update the index of available packages&lt;br /&gt;
|-&lt;br /&gt;
| [[#Information on Packages|info]]&lt;br /&gt;
| Prints information about installed or available packages&lt;br /&gt;
|-&lt;br /&gt;
| [[#Search for Packages|search]] &lt;br /&gt;
| Search for packages or descriptions with wildcard patterns&lt;br /&gt;
|-&lt;br /&gt;
| [[#Upgrade a Running System|upgrade]]&lt;br /&gt;
| Upgrade the currently installed packages&lt;br /&gt;
|-&lt;br /&gt;
| [[#Cache maintenance|cache]]&lt;br /&gt;
| Maintenance operations for locally cached package repository&lt;br /&gt;
|-&lt;br /&gt;
| version &lt;br /&gt;
| Compare version differences between installed and available packages&lt;br /&gt;
|-&lt;br /&gt;
| index &lt;br /&gt;
| create a repository index from a list of packages&lt;br /&gt;
|-&lt;br /&gt;
| fetch &lt;br /&gt;
| download (but not install) packages&lt;br /&gt;
|-&lt;br /&gt;
| audit &lt;br /&gt;
| List changes to the file system from pristine package install state&lt;br /&gt;
|-&lt;br /&gt;
| verify &lt;br /&gt;
| Verify a package signature&lt;br /&gt;
|- &lt;br /&gt;
| [[#apk dot|dot]]&lt;br /&gt;
| Create a [https://graphviz.org/ graphviz] graph description for a given package&lt;br /&gt;
|- &lt;br /&gt;
| [[#apk_policy|policy]]&lt;br /&gt;
| Display the repository that updates a given package, plus repositories that also offer the package&lt;br /&gt;
|- &lt;br /&gt;
| stats &lt;br /&gt;
| Display statistics, including number of packages installed and available, number of directories and files, etc.&lt;br /&gt;
|- &lt;br /&gt;
| manifest&lt;br /&gt;
| Display checksums for files contained in a given package&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Packages and Repositories ==&lt;br /&gt;
&lt;br /&gt;
Software packages for Alpine Linux are digitally signed tar.gz archives containing programs, configuration files, and dependency metadata. They have the extension &amp;lt;code&amp;gt;.apk&amp;lt;/code&amp;gt;, and are often called &amp;quot;a-packs&amp;quot;. Packages in Alpine Linux are organized into three official [[Repositories|&#039;&#039;&#039;repositories&#039;&#039;&#039;]]. Technically, any directory with a collection of *.apk files with a special index file, named {{Path|APKINDEX.tar.gz}} can be considered a repository, albeit a personal repository. [[Repositories#Repository_pinning|Pinned Repositories]] can be used to [[#Holding_a_specific_package_back|holdback]] a specific version of a package.&lt;br /&gt;
&lt;br /&gt;
== World ==&lt;br /&gt;
&lt;br /&gt;
At {{Path|/etc/apk/world}}, apk maintains the world, that is, a list of constraints the package selection needs to fulfill. World describes the desired system state. The commands &amp;lt;code&amp;gt;apk add foo&amp;lt;/code&amp;gt; and  &amp;lt;code&amp;gt;apk del bar&amp;lt;/code&amp;gt; manipulate the desired state  by adding foo or bar as a dependency constraint in {{Path|/etc/apk/world}}. &lt;br /&gt;
&lt;br /&gt;
{{Path|/etc/apk/world}} is a plaintext file with one constraint using dependency notation per line. Each line has the format: &lt;br /&gt;
&amp;lt;code&amp;gt;name{@tag}{[&amp;lt;&amp;gt;~=]version}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Every constraint listed here must be solvable in order for the system to be considered correct, and no transaction may be committed that is incorrect. If it cannot verify the correctness of the requested change, it will back out adding the constraint before attempting to change what packages are actually installed on the system. Thus apk will never [[#ERROR:_unsatisfiable_constraints|commit]] a change to the system that leaves it unbootable.   &lt;br /&gt;
&lt;br /&gt;
If {{Path|/etc/apk/world}} is edited manually, run &amp;lt;code&amp;gt;apk fix&amp;lt;/code&amp;gt; to synchronize the installed packages with the desired system state. Package installation or removal is done as a side effect of modifying this system state.&lt;br /&gt;
{{cmd|apk fix}}&lt;br /&gt;
&lt;br /&gt;
== Update Package list ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux [[Repositories|&#039;&#039;&#039;repositories&#039;&#039;&#039;]] change as packages are added and upgraded. To get the latest list of available packages, use the &#039;&#039;update&#039;&#039; command.  The command downloads the {{Path|APKINDEX.tar.gz}} from each repository and stores it in the local cache, typically {{Path|/var/cache/apk/}}, {{Path|/var/lib/apk/}} or {{Path|/etc/apk/cache/}}.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk update}}&lt;br /&gt;
&lt;br /&gt;
Adding the &amp;lt;code&amp;gt;--update-cache&amp;lt;/code&amp;gt;, or for short &amp;lt;code&amp;gt;-U&amp;lt;/code&amp;gt; switch to another apk command, as in &amp;lt;code&amp;gt;apk --update-cache upgrade&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;apk -U add ...&amp;lt;/code&amp;gt;, the command has the same effect as first running &amp;lt;code&amp;gt;apk update&amp;lt;/code&amp;gt; before the other apk command.&lt;br /&gt;
&lt;br /&gt;
It is a good idea to always do an &#039;&#039;&#039;update&#039;&#039;&#039; right &#039;&#039;&#039;before&#039;&#039;&#039; doing an &#039;&#039;&#039;upgrade or add&#039;&#039;&#039; command. That way the command will install the latest available packages from the [[Repositories|&#039;&#039;&#039;repositories&#039;&#039;&#039;]].&lt;br /&gt;
&lt;br /&gt;
== Add a Package ==&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;add&#039;&#039;&#039; to install packages from a [[Repositories|&#039;&#039;&#039;repository&#039;&#039;&#039;]]. Any necessary dependencies are also installed. If you have multiple repositories, the &#039;&#039;&#039;add&#039;&#039;&#039; command installs the newest package.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add openssh&lt;br /&gt;
apk add openssh openntp vim}}&lt;br /&gt;
&lt;br /&gt;
Packages from [[Repositories#Repository_pinning|pinned repositories]] can be installed by adding tags to them. &lt;br /&gt;
{{cmd| apk add wireguard-go@testing}}.&lt;br /&gt;
&lt;br /&gt;
== Add a local Package ==&lt;br /&gt;
&lt;br /&gt;
To install a locally available apk package, for example if this device has no internet access but you can upload apk packages directly to it, use the &#039;&#039;&#039;--allow-untrusted&#039;&#039;&#039; flag:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add --allow-untrusted /path/to/file.apk}}&lt;br /&gt;
&lt;br /&gt;
Note that multiple packages can be given.  When installing a local package, all dependencies should also be specified.  For example:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add --allow-untrusted /var/tig-2.2-r0.apk /var/git-2.11.1-20.apk}}&lt;br /&gt;
&lt;br /&gt;
== Remove a Package  ==&lt;br /&gt;
&lt;br /&gt;
Use &#039;&#039;&#039;del&#039;&#039;&#039; to remove a package (and dependencies that are no longer needed.)  &lt;br /&gt;
&lt;br /&gt;
{{cmd|apk del openssh&lt;br /&gt;
apk del openssh openntp vim}}&lt;br /&gt;
&lt;br /&gt;
== Upgrade a Running System ==&lt;br /&gt;
To get the latest security upgrades and bugfixes available for the currently installed [[Repositories#Release_Branches|release branch]] of a running system, there are two steps:&lt;br /&gt;
* &#039;&#039;&#039;update&#039;&#039;&#039; the list of available packages &lt;br /&gt;
* &#039;&#039;&#039;upgrade&#039;&#039;&#039; the installed packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk update&lt;br /&gt;
apk upgrade&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Or, combining the same into one single command:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk -U upgrade&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Here is an example, showing the procedure on a system that has [[#Repository_pinning|repositories pinned]]:&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
 # apk update&lt;br /&gt;
 fetch &amp;lt;nowiki&amp;gt;https://dl-3.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 fetch &amp;lt;nowiki&amp;gt;https://dl-3.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 fetch &amp;lt;nowiki&amp;gt;https://dl-3.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 v3.6.2-191-gf98d79930f &amp;lt;nowiki&amp;gt;[https://dl-3.alpinelinux.org/alpine/v3.6/main]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 v3.6.2-190-ga5d68c47df &amp;lt;nowiki&amp;gt;[https://dl-3.alpinelinux.org/alpine/v3.6/community]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 v3.6.0-4624-g11f1b9c8ab &amp;lt;nowiki&amp;gt;[https://dl-3.alpinelinux.org/alpine/edge/testing]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 OK: 20118 distinct packages available&lt;br /&gt;
 &lt;br /&gt;
 # apk upgrade&lt;br /&gt;
 (1/2) Upgrading extra-cmake-modules@testing (5.38.0-r0 -&amp;gt; 5.39.0-r0)&lt;br /&gt;
 (2/2) Upgrading extra-cmake-modules-doc@testing (5.38.0-r0 -&amp;gt; 5.39.0-r0)&lt;br /&gt;
 Executing mdocml-apropos-1.14.1-r0.trigger&lt;br /&gt;
 OK: 2635 MiB in 803 packages&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
To upgrade only &#039;&#039;specific&#039;&#039; packages, use the &#039;&#039;&#039;upgrade&#039;&#039;&#039; command and specify them:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk update&lt;br /&gt;
apk upgrade busybox&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
To enable unattended, automatic upgrades of packages, see the {{pkg|apk-autoupdate}} package. Refer [[Upgrading_Alpine|Upgrading Alpine]] to upgrade Alpine Linux to a newer [[Repositories#Release_Branches|release branch]].&lt;br /&gt;
&lt;br /&gt;
== Upgrading &amp;quot;diskless&amp;quot; and &amp;quot;data&amp;quot; disk mode installs ==&lt;br /&gt;
{{Main|Diskless Mode}}&lt;br /&gt;
&lt;br /&gt;
For upgrading [[Diskless Mode|diskless]] and [[Installation#Data Disk|Data disk]] mode installs, Upgrading a running system requires [[Diskless Mode#Upgrading a Running System|few extra steps]].&lt;br /&gt;
&lt;br /&gt;
== Search for Packages ==&lt;br /&gt;
The &#039;&#039;&#039;search&#039;&#039;&#039; command searches the repository Index files for installable packages. &lt;br /&gt;
&lt;br /&gt;
The return format is &#039;&#039;&#039;Package&#039;&#039;&#039;-&#039;&#039;&#039;Version&#039;&#039;&#039;. Omit &#039;&#039;&#039;Version&#039;&#039;&#039; for &#039;&#039;apk add &#039;&#039;&#039;Package&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
* To list all packages available, along with their descriptions: {{cmd|apk search -v}}&lt;br /&gt;
* To list all packages are part of the ACF system: {{cmd|apk search -v &#039;acf*&#039; }}&lt;br /&gt;
* To list all packages that list NTP as part of their description, use the &#039;&#039;-d&#039;&#039; or &#039;&#039;--description&#039;&#039; option: {{cmd|apk search -v --description &#039;NTP&#039; }}&lt;br /&gt;
* To list all packages that provide the &amp;lt;code&amp;gt;git&amp;lt;/code&amp;gt; command: {{cmd|apk search -v &#039;cmd:git&#039;}}&lt;br /&gt;
&lt;br /&gt;
== Information on Packages ==&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;info&#039;&#039;&#039; command provides information on the contents of packages, their dependencies, and which files belong to a package.&lt;br /&gt;
&lt;br /&gt;
For a given package, each element can be chosen (for example, &#039;&#039;-w&#039;&#039; to show just the webpage information), or all information displayed with the &#039;&#039;-a&#039;&#039; command.&lt;br /&gt;
&lt;br /&gt;
Example: {{cmd|apk info -a zlib}}&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 description:&#039;&#039;&#039;&lt;br /&gt;
 A compression/decompression Library&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 webpage:&#039;&#039;&#039;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;https://zlib.net&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 installed size:&#039;&#039;&#039;&lt;br /&gt;
 94208&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 depends on:&#039;&#039;&#039;&lt;br /&gt;
 libc0.9.32&lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 is required by:&#039;&#039;&#039;&lt;br /&gt;
 libcrypto1.0-1.0.0-r0&lt;br /&gt;
 apk-tools-2.0.2-r4&lt;br /&gt;
 openssh-client-5.4_p1-r2&lt;br /&gt;
 openssh-5.4_p1-r2&lt;br /&gt;
 libssl1.0-1.0.0-r0&lt;br /&gt;
 freeswitch-1.0.6-r6&lt;br /&gt;
 atop-1.25-r0 &lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 contains:&#039;&#039;&#039;&lt;br /&gt;
 lib/libz.so.1.2.5&lt;br /&gt;
 lib/libz.so.1&lt;br /&gt;
 lib/libz.so &lt;br /&gt;
 &lt;br /&gt;
 &#039;&#039;&#039;zlib-1.2.5-r1 triggers:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
As shown in the example you can determine&lt;br /&gt;
* The &#039;&#039;&#039;description&#039;&#039;&#039; of the package (&#039;&#039;-d&#039;&#039; or &#039;&#039;--description&#039;&#039;)&lt;br /&gt;
* The &#039;&#039;&#039;webpage&#039;&#039;&#039; where the application is hosted (&#039;&#039;-w&#039;&#039; or &#039;&#039;--webpage&#039;&#039;)&lt;br /&gt;
* The &#039;&#039;&#039;size&#039;&#039;&#039; the package will require once installed (in bytes) (&#039;&#039;-s&#039;&#039; or &#039;&#039;--size&#039;&#039;)&lt;br /&gt;
* What packages are required to use this one  (&#039;&#039;&#039;depends&#039;&#039;&#039;) (&#039;&#039;-R&#039;&#039; or &#039;&#039;--depends&#039;&#039;)&lt;br /&gt;
* What packages require this one to be installed (&#039;&#039;&#039;required by&#039;&#039;&#039;) (&#039;&#039;-r&#039;&#039; or &#039;&#039;--rdepends&#039;&#039;)&lt;br /&gt;
* The &#039;&#039;&#039;contents&#039;&#039;&#039; of the package, that is, which files it installs (&#039;&#039;-L&#039;&#039; or &#039;&#039;--contents&#039;&#039;)&lt;br /&gt;
* Any &#039;&#039;&#039;triggers&#039;&#039;&#039; this package sets. (&#039;&#039;-t&#039;&#039; or &#039;&#039;--triggers&#039;&#039;) Listed here are directories that are watched; if a change happens to the directory, then the trigger script is run at the end of the apk add/delete. For example, doing a depmod once after installing all packages that add kernel modules.&lt;br /&gt;
&lt;br /&gt;
===  Check file ownership ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;info&#039;&#039;&#039; command is also useful to determine which package a file belongs to.  For example: {{cmd|apk info --who-owns /sbin/lbu}} &lt;br /&gt;
will display&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/sbin/lbu is owned by alpine-conf-x.x-rx&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===  Check Dependencies ===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;info&#039;&#039;&#039; command specific to check package dependency and reverse dependency is explained below:&lt;br /&gt;
&lt;br /&gt;
The option &#039;&#039;&#039;-R&#039;&#039;&#039; or &#039;&#039;&#039;--depends&#039;&#039;&#039; lists the dependencies of the package.&lt;br /&gt;
{{Cmd| apk info --depends pipewire}} &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pipewire-1.0.6-r1 depends on:&lt;br /&gt;
/bin/sh&lt;br /&gt;
so:libc.musl-x86_64.so.1&lt;br /&gt;
so:libpipewire-0.3.so.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The option &#039;&#039;&#039;-r&#039;&#039;&#039; or  &#039;&#039;&#039;--rdepends&#039;&#039;&#039; lists the  reverse dependencies of the package (all other packages which depend on the package).&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk info --rdepends pipewire}}  &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pipewire-1.0.6-r1 is required by:&lt;br /&gt;
xdg-desktop-portal-wlr-0.7.1-r0&lt;br /&gt;
pipewire-pulse-1.0.6-r1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Listing installed packages ===&lt;br /&gt;
&lt;br /&gt;
To list all installed packages, use:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk info}}&lt;br /&gt;
&lt;br /&gt;
To list all installed packages in alphabetical order, with a description of each, do:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk -vv info|sort}}&lt;br /&gt;
&lt;br /&gt;
The apk tool does not have a subcommand to list manually-installed packages that do not have reverse dependencies. To get this information on a traditional system that is not using [[Alpine local backup|lbu]], try this script. Note that this approach will also list core packages like alpine-base that should not be removed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
apk info | grep -ve &#039;-doc$&#039; | sort | while read pkg&lt;br /&gt;
        do&lt;br /&gt;
                rdep=`apk info -qr &amp;quot;$pkg&amp;quot;`&lt;br /&gt;
                [ -z &amp;quot;$rdep&amp;quot; ] &amp;amp;&amp;amp; echo $pkg&lt;br /&gt;
        done&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== apk dot ==&lt;br /&gt;
&lt;br /&gt;
The dot option renders package dependencies as {{pkg|graphviz}} graphs. Steps to use the dot option is documented below:&lt;br /&gt;
&lt;br /&gt;
Save the output of apk dot option to a dot file.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ apk dot seatd &amp;gt; seatd_dependencies.dot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Use Graphviz to convert the &amp;lt;code&amp;gt;dot&amp;lt;/code&amp;gt; file into a graphical format such as PNG, PDF, or SVG. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ dot -Tpng seatd_dependencies.dot -o seatd_dependencies.png&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[File:Seatd dependencies.png|800px|center|alt=Seatd dependencies|Seatd dependencies]]&lt;br /&gt;
&lt;br /&gt;
== apk policy ==&lt;br /&gt;
&lt;br /&gt;
To display the repository a package was installed from and will be updated from, plus any [[#Repository_pinning|tagged]] or enabled repositories where it is also offered, if any, for this architecture - its &#039;&#039;&#039;policy&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk policy &#039;&#039;package&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 $ apk policy vlc&lt;br /&gt;
 vlc policy:&lt;br /&gt;
  2.2.6-r1:&lt;br /&gt;
    lib/apk/db/installed&lt;br /&gt;
    https://dl-3.alpinelinux.org/alpine/v3.7/community&lt;br /&gt;
  3.0.0_rc2-r1:&lt;br /&gt;
    @edgecommunity https://dl-3.alpinelinux.org/alpine/edge/community&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Local Cache ==&lt;br /&gt;
&lt;br /&gt;
{{:Local_APK_cache}}&lt;br /&gt;
&lt;br /&gt;
== Advanced APK Usage ==&lt;br /&gt;
&lt;br /&gt;
=== Commandline repository options ===&lt;br /&gt;
&lt;br /&gt;
By default, the &#039;&#039;&#039;apk&#039;&#039;&#039; utility will use the system repositories for all operations. This behavior can be overridden by the following options:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| --repositories-file REPOFILE&lt;br /&gt;
| Override the system repositories by specifying a repositories file.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;-X|--repository REPO&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
| Specify a supplemental repository that will be used in addition to the system repositories. This option can be provided multiple times.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add cherokee --update-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted}}&lt;br /&gt;
&lt;br /&gt;
=== Holding a specific package back ===&lt;br /&gt;
&lt;br /&gt;
In certain cases, you may want to upgrade a system, but keep a specific package at a back level. It is possible to add &amp;quot;sticky&amp;quot; or versioned dependencies. For instance, to hold the &#039;&#039;asterisk&#039;&#039; package to the 1.6.2 level or lower:&lt;br /&gt;
{{cmd|1=apk add asterisk=1.6.0.21-r0}}&lt;br /&gt;
or&lt;br /&gt;
{{cmd|apk add &#039;asterisk&amp;lt;1.6.1&#039;}}&lt;br /&gt;
&lt;br /&gt;
after which a {{cmd|apk upgrade}}&lt;br /&gt;
&lt;br /&gt;
will upgrade the entire system, keeping the asterisk package at the 1.6.0 or lower level&lt;br /&gt;
&lt;br /&gt;
To later upgrade to the current version,&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add &#039;asterisk&amp;gt;1.6.1&#039;}}&lt;br /&gt;
&lt;br /&gt;
will ensure that 1.6.1 is the minimum version used.&lt;br /&gt;
&lt;br /&gt;
You can also use &amp;quot;fuzzy&amp;quot; version matching to pin the version to a major/minor release.  For example:&lt;br /&gt;
&lt;br /&gt;
{{cmd|1=apk add &#039;asterisk=~1.6&#039;}}&lt;br /&gt;
&lt;br /&gt;
will match any version of asterisk that starts with 1.6 (such as 1.6.0.21-r0 or 1.6.9.31-r9).  &lt;br /&gt;
&lt;br /&gt;
If you desire deterministic, repeatable package installation (such as with containerized environments) via package pinning, it is important to understand your package repo&#039;s version retention rules.  Always pin to a package version that is intended for your [[Repositories#Release_Branches|release branch]]. Pinning to a version on the [[Repositories#Edge|edge]] branch may stop working after the package version is revoked from the repo.&lt;br /&gt;
&lt;br /&gt;
=== Commit hooks ===&lt;br /&gt;
&lt;br /&gt;
If you&#039;d like to trigger an action or run a certain script on every commit made by apk, there&#039;s a built-in method for that. On every commit apk looks for executables located in the &amp;quot;/etc/apk/commit_hooks.d/&amp;quot; directory, and executes them both before and after the commit. To provide some way to selectively run hooks either before or after a change is commited by apk, the scripts are called with &amp;quot;pre-commit&amp;quot; or &amp;quot;post-commit&amp;quot; as argument 1.&lt;br /&gt;
This is an example of a hook to do different things before and after commit:&lt;br /&gt;
&lt;br /&gt;
{{cmd|1=#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$1&amp;quot; = &amp;quot;pre-commit&amp;quot; ]; then&lt;br /&gt;
    do_something&lt;br /&gt;
&lt;br /&gt;
elif [ &amp;quot;$1&amp;quot; = &amp;quot;post-commit&amp;quot; ]; then&lt;br /&gt;
    do_something_else&lt;br /&gt;
fi}}&lt;br /&gt;
&lt;br /&gt;
Commit hooks are $PATH-aware, so for the sake of security it&#039;s recommended to specify absolute paths to executables.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==  Rosetta Stone ==&lt;br /&gt;
&lt;br /&gt;
[[Comparison with other distros#Comparison chart/Rosetta Stone|Rosetta Stone]] or a Comparison chart shows how standard things related to package management are done in Alpine Linux compared to other popular distributions. &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== ERROR: unable to select packages ===&lt;br /&gt;
&lt;br /&gt;
This error typically indicates that the package manager cannot find a suitable package to install. On issuing a command to add a package for eg: {{Codeline|apk add labwc}}, you may receive below error message:&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
ERROR: unable to select packages:&lt;br /&gt;
 labwc (no such package):&lt;br /&gt;
 required by: world[labwc]&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above error indicates {{pkg|labwc}} does not exist in the [[Repositories|repositories]] currently configured in {{Path|/etc/apk/repositories}}. Ensure that &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repository is [[Repositories#Managing_repositories|enabled]], as by default only &amp;lt;code&amp;gt;main&amp;lt;/code&amp;gt; repository is enabled. You may also want to check [https://pkgs.alpinelinux.org/packages packages database] to identify the correct package name and the [[Repositories|repository]] in which the package is available.&lt;br /&gt;
&lt;br /&gt;
=== ERROR: unsatisfiable constraints === &lt;br /&gt;
&lt;br /&gt;
This error signifies a dependency conflict. It means that the package you&#039;re trying to install has dependencies that cannot be simultaneously satisfied within the current package repository. &lt;br /&gt;
&lt;br /&gt;
You may want to check [https://pkgs.alpinelinux.org/packages packages database] to identify the correct package name and version and the [[Repositories|repository]] in which the package is available. &lt;br /&gt;
&lt;br /&gt;
=== WARNING: This apk-tools is OLD! ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;apk update&#039;&#039;&#039;, &#039;&#039;&#039;apk upgrade&#039;&#039;&#039; or &#039;&#039;&#039;apk add&#039;&#039;&#039; may report the following: &lt;br /&gt;
 WARNING: This apk-tools is OLD! Some packages might not function properly&lt;br /&gt;
&lt;br /&gt;
This may happen if you are running Alpine Linux stable version with a certain edge/main, edge/community or testing package(s) also installed.  One resolution is to consider upgrading {{pkg|apk-tools}}.  If edge is already [https://wiki.alpinelinux.org/wiki/Alpine_Linux_package_management#Repository_pinning tagged] in your repositories, then try:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|apk add --upgrade apk-tools@edge}}&lt;br /&gt;
&lt;br /&gt;
=== ERROR:  UNTRUSTED signature ===&lt;br /&gt;
&lt;br /&gt;
This happens when the release version changes. You need to update the local apk keys.&lt;br /&gt;
&lt;br /&gt;
If you have already updated your repositories, allow them to update without the trusted key:&lt;br /&gt;
{{Cmd|apk update --allow-untrusted}}&lt;br /&gt;
&lt;br /&gt;
Then install the keys upgrade:&lt;br /&gt;
{{Cmd|apk fix --upgrade --allow-untrusted alpine-keys}}&lt;br /&gt;
&lt;br /&gt;
Now updates and upgrades should proceed normally.&lt;br /&gt;
&lt;br /&gt;
Alternative, the updated alpine-keys package may be obtained, verified, installed directly, as covered earlier, prior to a repository update.&lt;br /&gt;
&lt;br /&gt;
=== World updated but the following packages are not removed === &lt;br /&gt;
&lt;br /&gt;
On issuing a command to remove a package for eg: {{Codeline|apk del btrfs-progs}}, you may receive below error message:&lt;br /&gt;
&amp;lt;Pre&amp;gt;&lt;br /&gt;
World updated, but the following packages are not removed due to:&lt;br /&gt;
  btrfs-progs: btrbk&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, the removal of package {{Pkg|btrfs-progs}} affects another package {{Pkg|btrbk}} in the constraints file [[#World|/etc/apk/world]]. So the package {{Pkg|btrfs-progs}} will be removed from the constraints file, but not removed from the system. The {{Pkg|btrfs-progs}} will remain in the system, until the constraint i.e {{Pkg|btrbk}} which depends on {{Pkg|btrfs-progs}} is removed. &lt;br /&gt;
&lt;br /&gt;
If {{Codeline|apk del btrbk}} is issued, the package {{Pkg|btrfs-progs}} will be automatically removed from system as the constraint {{Pkg|btrfs-progs}} does not exist in {{Path|/etc/apk/world}}.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Comparison with other distros]]&lt;br /&gt;
* [[Upgrading_Alpine|Upgrading Alpine Linux to newer Release Branch]]&lt;br /&gt;
* [[Repositories|Understand Repositories in Alpine Linux]]&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
* [https://www.cyberciti.biz/faq/10-alpine-linux-apk-command-examples/ 10 Alpine Linux apk Command Examples]&lt;br /&gt;
* [https://man.archlinux.org/man/apk-world.5.en man 5 apk-world]&lt;br /&gt;
* [https://ariadne.space/2021/04/25/why-apk-tools-is-different-than-other-package-managers/  Why apk-tools is different than other package managers]&lt;br /&gt;
* [https://ariadne.space/2021/10/31/spelunking-through-the-apk-tools-dependency-solver/ spelunking through the apk-tools dependency solver]&lt;br /&gt;
* [https://whynothugo.nl/journal/2023/02/18/in-praise-of-alpine-and-apk/ in praise of alpine and apk]&lt;br /&gt;
&lt;br /&gt;
[[Category:Package Manager]]&lt;br /&gt;
[[Category:System_Administration]]&lt;/div&gt;</summary>
		<author><name>Matthias</name></author>
	</entry>
</feed>