<?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=Dfen</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=Dfen"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Dfen"/>
	<updated>2026-05-05T19:00:29Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Alpine_local_backup&amp;diff=20400</id>
		<title>Alpine local backup</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Alpine_local_backup&amp;diff=20400"/>
		<updated>2021-12-02T19:13:07Z</updated>

		<summary type="html">&lt;p&gt;Dfen: /* Saving and loading ISO image customizations */ link to relevant section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;When Alpine Linux boots in diskless mode, it initially only loads a few required packages from the boot device.&lt;br /&gt;
&lt;br /&gt;
However, local adjustments to what-gets-loaded-into-RAM are possible, e.g. by [[Alpine_package_management|installing a package]] or adjusting the configuration files in {{path|/etc}}. The modifications can be saved to an overlay file (.apkovl) that can be automatically loaded when booting, to restore the saved state.&lt;br /&gt;
&lt;br /&gt;
The .apkovl file that contains the custom configuration can be saved to writable storage with Alpine&#039;s local backup utility &amp;lt;code&amp;gt;lbu&amp;lt;/code&amp;gt;. By configuring a [[Alpine_Linux_package_management#Local_Cache|local package cache]] the additional packages the configuration depends on, can also be kept available on local, writable storage.&lt;br /&gt;
&lt;br /&gt;
{{Note|If you installed Alpine in &amp;quot;sys&amp;quot; disk mode, you don&#039;t need to use &amp;lt;code&amp;gt;lbu&amp;lt;/code&amp;gt; to save the system state. With a system disk, all modifications are&lt;br /&gt;
written directly to disk. Nevertheless, &amp;lt;code&amp;gt;lbu&amp;lt;/code&amp;gt; can be useful for some maintenance tasks.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Warning|&lt;br /&gt;
&#039;&#039;&#039;By default, an &amp;lt;code&amp;gt;lbu commit&amp;lt;/code&amp;gt; only stores modifications below {{Path|/etc}}&#039;&#039;&#039;, with the exception of the {{Path|/etc/init.d/}} directory.&lt;br /&gt;
&lt;br /&gt;
However, [[#Include_special_files.2Ffolders_to_the_apkovl|lbu include]] enables modifying that set of included files, and can be used to specify additional files or folders.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Saving and loading ISO image customizations ==&lt;br /&gt;
&lt;br /&gt;
Besides supporting a boot parameter to load customizations from a web server, Alpine&#039;s &amp;quot;diskless mode&amp;quot; ISO images try to load an .apkovl volume from system partitions. It is therefore possible to save customized running states to a .apkovl file on a writable partition, and have these automatically loaded when booting the ISO image.&lt;br /&gt;
&lt;br /&gt;
{{Note|When the machine reboots, the remote repositories will not be available until after networking has started. That means packages newer than on your local boot media would not be available after a reboot, unless they were made to persistent, by having a [[#Local Cache|local package cache]] available on a local, writable, storage device.}}&lt;br /&gt;
&lt;br /&gt;
The local package cache, which enables additional and updated packages to automatically be copied into RAM during boot, may be stored on the same partition as the .apkovl file.&lt;br /&gt;
&lt;br /&gt;
To use partitions on &#039;&#039;&#039;internal disks&#039;&#039;&#039;, however, you need to prepare a specific /etc/fstab entry manually, and save the configuration, as follows (setup-alpine does not list them for saving configs or package cache):&lt;br /&gt;
&lt;br /&gt;
1. Boot the diskless system from ISO (as shown at [[Installation]])&amp;lt;br&amp;gt;&lt;br /&gt;
2. If necessary, create and format a partition as in [[Setting_up_disks_manually#For_.22diskless.22_and_.22data.22_disk_mode_installs_2]]. For the examples we will use /dev/sdXY&amp;lt;br&amp;gt;&lt;br /&gt;
* Bug: [https://gitlab.alpinelinux.org/alpine/mkinitfs/-/issues/5 Initramfs-init does not respect apkovl device fstab entry], so the partition can not be mounted to /boot. The workaround given there does not seem to work (e.g. &amp;lt;code&amp;gt;mkdir -p /boot/ovl_dev/cache ; touch /boot/ovl_dev/cache/.boot_repository&amp;lt;/code&amp;gt;)&amp;lt;br&amp;gt;&lt;br /&gt;
=&amp;gt; Alternative: Configure the /etc/fstab to mount the writable partition to /media/sdXY instead of /boot (i.e. conforming to the hot/cold-plug mountpoints):&amp;lt;br&amp;gt;&lt;br /&gt;
3. &amp;lt;code&amp;gt;mkdir /media/sdXY&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
4. &amp;lt;code&amp;gt;echo &amp;quot;/dev/sdXY /media/sdXY ext4 noatime,ro 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt; (Mounting read-only is possible, because the tools temporarily remount it writable for their operation.)&amp;lt;br&amp;gt;&lt;br /&gt;
5. Use &amp;lt;code&amp;gt;mount -a&amp;lt;/code&amp;gt; to load the partitions listed in /etc/fstab. Look at the output of &amp;lt;code&amp;gt;mount&amp;lt;/code&amp;gt; to verify that the /etc/fstab changes have been applied correctly.&amp;lt;br&amp;gt;&lt;br /&gt;
6. If setup-alpine has not run before, it may be used and should now enable you to choose the partition for saving the local configs and package cache. (If asked, there is no need to first unmount the partition, that would only be needed to allow installing on its parent disk.)&amp;lt;br&amp;gt;&lt;br /&gt;
If setup-alpine has already been used to configure the diskless system, the storage settings may be modified directly with &amp;lt;code&amp;gt;setup-lbu sdXY&amp;lt;/code&amp;gt; and  &amp;lt;code&amp;gt;mkdir /media/sdXY/cache ; setup-apkcache /media/sdXY/cache&amp;lt;/code&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
7. If the partition is large enough, it can be useful to edit lbu.conf to uncomment and set &amp;lt;code&amp;gt;BACKUP_LIMIT=3&amp;lt;/code&amp;gt;. For example, to allow reverting to a previous, working state if needed.&lt;br /&gt;
{{cmd| # apk add nano&lt;br /&gt;
 # nano /etc/lbu/lbu.conf&lt;br /&gt;
}}&lt;br /&gt;
8. Finally, generate the first .apkovl file containing all the previous changes with [https://wiki.alpinelinux.org/wiki/Alpine_local_backup Alpine_local_backup], by executing &amp;lt;code&amp;gt;lbu commit&amp;lt;/code&amp;gt;, so the customizations that were just made will persist a reboot.&lt;br /&gt;
&lt;br /&gt;
From then on, whenever packages are installed or newly configured, and the changes should be kept, execute &amp;lt;code&amp;gt;lbu commit&amp;lt;/code&amp;gt; again.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* For a virtual machine, the &#039;&#039;&#039;[[QEMU#Live_mode|QEMU example]]&#039;&#039;&#039; shows how an ISO image can automatically boot with .apkovl customizations.&lt;br /&gt;
* The [[Alpine_local_backup#Include_special_files.2Ffolders_to_the_apkovl|Include special files section]] explains how to include custom files outside of &amp;lt;code&amp;gt;/etc&amp;lt;/code&amp;gt; in the .apkovl file.&lt;br /&gt;
* [[Alpine_Linux_package_management#Local_Cache]] covers managing a local package cache.&lt;br /&gt;
** The packages get listed in /etc/apk/world which gets saved with the lbu, for them to be automatically installed when the live system boots.&lt;br /&gt;
* It&#039;s possible to load an APKOVL file from a webserver, by supplying a custom url with the &amp;lt;code&amp;gt;APKOVL&amp;lt;/code&amp;gt; kernel boot parameter.&lt;br /&gt;
** If you don&#039;t have a web server you can run busybox&#039;s httpd temporarily to serve an .apkovl - &amp;lt;code&amp;gt;busybox httpd -p 127.0.0.1:80&amp;lt;/code&amp;gt;.&lt;br /&gt;
* To customize the boot sequence further, one may refer to [[PXE_boot#Specifying_an_apkovl]] and [[How_to_make_a_custom_ISO_image_with_mkimage]].&lt;br /&gt;
&lt;br /&gt;
== Committing changes ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;lbu&amp;lt;/code&amp;gt; tool has several subcommands to manage the .apkovl:&lt;br /&gt;
* lbu&lt;br /&gt;
* lbu commit &#039;&#039;(Same as &#039;lbu ci&#039;)&#039;&#039;&lt;br /&gt;
* lbu package &#039;&#039;(Same as &#039;lbu pkg&#039;)&#039;&#039;&lt;br /&gt;
* lbu status &#039;&#039;(Same as &#039;lbu st&#039;)&#039;&#039;&lt;br /&gt;
* lbu list &#039;&#039;(Same as &#039;lbu ls&#039;)&#039;&#039;&lt;br /&gt;
* lbu diff&lt;br /&gt;
* lbu include &#039;&#039;(Same as &#039;lbu inc&#039; or &#039;lbu add&#039;)&#039;&#039;&lt;br /&gt;
* lbu exclude &#039;&#039;(Same as &#039;lbu ex&#039; or &#039;lbu delete&#039;)&#039;&#039;&lt;br /&gt;
* lbu list-backup &#039;&#039;(Same as &#039;lbu lb&#039;)&#039;&#039;&lt;br /&gt;
* lbu revert&lt;br /&gt;
&lt;br /&gt;
In the examples below, you will find some characters with special meaning:&lt;br /&gt;
* &#039;&#039;&#039;|&#039;&#039;&#039; = &#039;&#039;&#039;or&#039;&#039;&#039; &#039;&#039;(&#039;lbu commit|ci&#039; means that you can type ether &#039;lbu commit&#039; or &#039;lbu ci&#039;)&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;[ ]&#039;&#039;&#039; = &#039;&#039;&#039;optional&#039;&#039;&#039; &#039;&#039;(In &#039;lbu commit|ci [-nv]&#039; you can skip the &#039;-n&#039;, &#039;-v&#039; or &#039;-nv&#039; part if you don&#039;t want it)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Basic &amp;quot;commit&amp;quot; command ===&lt;br /&gt;
When you &amp;quot;commit&amp;quot; or save changes you&#039;ve made to your system, &amp;lt;code&amp;gt;lbu&amp;lt;/code&amp;gt; will generate a file named something like {{Path|&amp;lt;var&amp;gt;myboxname&amp;lt;/var&amp;gt;.apkovl.tar.gz}} &#039;&#039;(&#039;myboxname&#039; will be the same as the hostname)&#039;&#039;.&lt;br /&gt;
The file (which contains your modifications) is called your &amp;quot;apkovl&amp;quot;.&lt;br /&gt;
You will need to save your apkovl on suitable media (floppy, usb, cf, etc.).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: lbu commit|ci [-nv] [&amp;lt;media&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
  -d	Remove old apk overlay files.&lt;br /&gt;
  -e	Protect configuration with a password.&lt;br /&gt;
  -n	Don&#039;t commit, just show what would have been committed.&lt;br /&gt;
  -p &amp;lt;password&amp;gt;	Give encryption password on the command-line&lt;br /&gt;
  -v	Verbose mode.&lt;br /&gt;
&lt;br /&gt;
The following values for &amp;lt;media&amp;gt; are supported: floppy usb&lt;br /&gt;
If &amp;lt;media&amp;gt; is not specified, the environment variable LBU_MEDIA will be used.&lt;br /&gt;
&lt;br /&gt;
Password protection will use aes-256-cbc encryption. Other ciphers can be&lt;br /&gt;
used by setting the DEFAULT_CIPHER or ENCRYPTION environment variables.&lt;br /&gt;
For possible ciphers, try: openssl -v&lt;br /&gt;
&lt;br /&gt;
The password used to encrypt the file, can be specified with the -p&lt;br /&gt;
option or by using the PASSWORD environment variable.&lt;br /&gt;
&lt;br /&gt;
The environment variable can also be set in /etc/lbu/lbu.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Creating an .apkovl &amp;quot;package&amp;quot; elsewhere than on the configured media ===&lt;br /&gt;
&lt;br /&gt;
To &amp;quot;commit&amp;quot; changes, but override the destination of the generated apkovl file, use &amp;lt;code&amp;gt;lbu package&amp;lt;/code&amp;gt; instead of &amp;lt;code&amp;gt;lbu commit&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: lbu package|pkg -v [&amp;lt;dirname&amp;gt;|&amp;lt;filename&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
  -v   Verbose mode.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;dirname&amp;gt; is a directory, a package named &amp;lt;hostname&amp;gt;.apkovl.tar.gz will&lt;br /&gt;
be created in the specified directory.&lt;br /&gt;
&lt;br /&gt;
If &amp;lt;filename&amp;gt; is specified, and is not a directory, a package with the&lt;br /&gt;
specified name will be created.&lt;br /&gt;
&lt;br /&gt;
If neither &amp;lt;dirname&amp;gt; nor &amp;lt;filename&amp;gt; is specified, a package named&lt;br /&gt;
&amp;lt;hostname&amp;gt;.apkovl.tar.gz will be created in the current working directory.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Creating and saving an apkovl from a remote host ===&lt;br /&gt;
&lt;br /&gt;
To create an apkovl from a client on a remote server, it&#039;s possible to use &amp;lt;code&amp;gt;lbu package&amp;lt;/code&amp;gt; via SSH with {{Path|-}} as the apkovl name:&lt;br /&gt;
&lt;br /&gt;
On the server:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ssh root@client &amp;quot;lbu package -&amp;quot; &amp;gt;client.apkovl.tar.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Checking what will be added to your apkovl ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;lbu status&amp;lt;/code&amp;gt; lists what will be saved the next time you run &amp;lt;code&amp;gt;lbu commit&amp;lt;/code&amp;gt;. Its default output is incremental, that is, it shows&lt;br /&gt;
only the files that have changed since the last commit. &amp;lt;br&amp;gt;&lt;br /&gt;
This can be overridden with the &amp;lt;code&amp;gt;-a&amp;lt;/code&amp;gt; flag:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: lbu status|st [-av]&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
  -a    Compare all files, not just since last commit.&lt;br /&gt;
  -v    show include and exclude lists.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another option is &amp;lt;code&amp;gt;lbu list&amp;lt;/code&amp;gt;. This works like &amp;lt;code&amp;gt;lbu status -a&amp;lt;/code&amp;gt; but the format of the output is a bit different. (It&#039;s strictly equivalent to &amp;lt;code&amp;gt;lbu package -v /dev/null&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
 usage: lbu list|ls&lt;br /&gt;
&lt;br /&gt;
A third option is &amp;lt;code&amp;gt;lbu diff&amp;lt;/code&amp;gt;. This shows the same incremental changes that &amp;lt;code&amp;gt;lbu status&amp;lt;/code&amp;gt; (without &amp;lt;code&amp;gt;-a&amp;lt;/code&amp;gt;) does, but in a different format.&lt;br /&gt;
&lt;br /&gt;
  usage: lbu diff&lt;br /&gt;
&lt;br /&gt;
== Include special files/folders to the apkovl ==&lt;br /&gt;
Assume you have some files you want to save permanently, but they are not located in {{Path|/etc}}.&amp;lt;BR&amp;gt;&lt;br /&gt;
e.g. {{Path|/root/.ssh/authorized_keys}} (used by &amp;lt;code&amp;gt;sshd&amp;lt;/code&amp;gt; to authenticate ssh-users). Such files/folders can be added to lbu&#039;s &#039;&#039;include&#039;&#039; list with the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: lbu include|inc|add [-rv] &amp;lt;file&amp;gt; ...&lt;br /&gt;
       lbu include|inc|add [-v] -l&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
  -l	List contents of include list.&lt;br /&gt;
  -r	Remove specified file(s) from include list.&lt;br /&gt;
  -v	Verbose mode.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|This information used to be maintained in {{Path|/etc/lbu/include}}. Now it&#039;s maintained together with the &#039;&#039;exclude&#039;&#039; list in {{Path|/etc/apk/protected_paths.d/lbu.list}}. Either way, the command &amp;lt;code&amp;gt;lbu include&amp;lt;/code&amp;gt; only modifies lbu&#039;s configuration.&lt;br /&gt;
You will need to run &amp;lt;code&amp;gt;lbu commit&amp;lt;/code&amp;gt; to actually create/modify your apkovl.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Exclude specific files/folders from the apkovl ==&lt;br /&gt;
Assume you have some files located in {{Path|/etc}} or one of its subfolders you &#039;&#039;do not&#039;&#039; want to save.&lt;br /&gt;
It could be a log file or status file that for some reason isn&#039;t in {{Path|/var/log/}} but in a location that would otherwise be tracked by &amp;lt;code&amp;gt;lbu&amp;lt;/code&amp;gt;.&lt;br /&gt;
Such files/folders can be added to lbu&#039;s &#039;&#039;exclude&#039;&#039; list by manually editing the file or using the following command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: lbu exclude|ex|delete [-rv] &amp;lt;file&amp;gt; ...&lt;br /&gt;
       lbu exclude|ex|delete [-v] -l&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
  -l	List contents of exclude list.&lt;br /&gt;
  -r	Remove specified file(s) from exclude list.&lt;br /&gt;
  -v	Verbose mode.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
{{Note|As stated above, this information is now maintained in {{Path|/etc/apk/protected_paths.d/lbu.list}}. The command &amp;lt;code&amp;gt;lbu exclude&amp;lt;/code&amp;gt; also only modifies lbu&#039;s configuration. &amp;lt;br&amp;gt;&lt;br /&gt;
You will need to run &amp;lt;code&amp;gt;lbu commit&amp;lt;/code&amp;gt; to actually create/modify your apkovl.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Execute a script as part of a backup ==&lt;br /&gt;
&lt;br /&gt;
Sometimes it&#039;s necessary to run a script before or after a backup.  Scripts in two optional directories enable that:&lt;br /&gt;
&lt;br /&gt;
 /etc/lbu/pre-package.d&lt;br /&gt;
 /etc/lbu/post-package.d&lt;br /&gt;
&lt;br /&gt;
Files in those directories are run using run-script rules (meaning they must have the executable bit set, they are run in alphabetical order, and cannot contain an extension. e.g. {{Path|runme}} works, but {{Path|runme.sh}} does not.)&lt;br /&gt;
&lt;br /&gt;
The scripts in {{Path|pre-package.d}} are run before apkovl is created. Scripts in {{Path|post-package.d}} are run after apkovl is created.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
Rather than adding the raw database directories to {{Path|/etc/lbu/include}}, you can do a &amp;quot;database dump&amp;quot;.    e.g. {{Pkg|postgresql}}:&lt;br /&gt;
&lt;br /&gt;
* Create {{Path|/etc/lbu/pre-package.d/sqldump}} with the following contents: &amp;lt;pre&amp;gt;pg_dumpall -U postgres | gzip -c &amp;gt;/root/pgdatabases.gz&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Mark the file executable: &amp;lt;code&amp;gt;chmod +x /etc/lbu/pre-package.d/sqldump&amp;lt;/code&amp;gt;&lt;br /&gt;
* Create {{Path|/etc/lbu/post-package.d/sqldumpdelete}} with the following contents: &amp;lt;pre&amp;gt;rm -f /root/pgdatabases.gz&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Mark the file executable: &amp;lt;code&amp;gt;chmod +x /etc/lbu/post-package.d/sqldumpdelete&amp;lt;/code&amp;gt;&lt;br /&gt;
* Finally, add the database dump file to the list of files to back up: &amp;lt;code&amp;gt;lbu include root/pgdatabases.gz&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now when you do a &amp;lt;code&amp;gt;lbu commit&amp;lt;/code&amp;gt;, the sql databases are dumped and gzipped to {{Path|/root/pgdatabases.gz}}.&lt;br /&gt;
The temporary file is deleted at the end of the lbu commit.&lt;br /&gt;
&lt;br /&gt;
On a catastrophic restore, the databases are not automatically restored (that&#039;s not lbu&#039;s job), but you will find a complete database dump in the {{Path|/root}} directory, where it can be restored manually.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Multiple backup versions ==&lt;br /&gt;
Lbu can now keep multiple backups so you can revert back to older configurations.&lt;br /&gt;
Set BACKUP_LIMIT in {{Path|/etc/lbu/lbu.conf}} to the number of backups you want&lt;br /&gt;
to keep.&lt;br /&gt;
&lt;br /&gt;
If you&#039;ve set BACKUP_LIMIT, then the previously active .apkovl will be renamed before creating the new file.&lt;br /&gt;
&lt;br /&gt;
You can list the currently available backups with:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|lbu list-backup [&amp;lt;media&amp;gt;]}}&lt;br /&gt;
&lt;br /&gt;
and you can revert to an older one with:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|lbu revert &amp;lt;filename&amp;gt; [&amp;lt;media&amp;gt;]}}&lt;br /&gt;
&lt;br /&gt;
NOTE: Nothing is changed on your running system when &amp;quot;reverting&amp;quot;, it only affects which apkovl is considered active at the next boot.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Back Up a Flash Memory Installation]]&lt;br /&gt;
* [[Manually editing a existing apkovl]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Booting]]&lt;br /&gt;
[[Category:Package Manager]]&lt;br /&gt;
[[category: LBU]]&lt;/div&gt;</summary>
		<author><name>Dfen</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Alpine_Package_Keeper&amp;diff=20398</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=20398"/>
		<updated>2021-12-02T19:01:49Z</updated>

		<summary type="html">&lt;p&gt;Dfen: /* Listing installed packages */ get list of non-automatic packages&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--For searching: apk, APK--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Because Alpine Linux is designed to run from RAM, package management involves two phases:&lt;br /&gt;
* Installing / Upgrading / Deleting packages on a running system.&lt;br /&gt;
* Restoring a system to a previously configured state (e.g. after reboot), including all previously installed packages and locally modified configuration files. &#039;&#039;&#039;(RAM-Based Installs Only)&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;apk&#039;&#039;&#039; is the tool used to install, upgrade, or delete software on a running system.&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;lbu&#039;&#039;&#039; is the tool used to capture the data necessary to restore a system to a previously configured state.&lt;br /&gt;
&lt;br /&gt;
This page documents the [https://git.alpinelinux.org/apk-tools/ apk tool] - See the [[Alpine_local_backup|Alpine Local Backup page]] for the lbu tool.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;apk&#039;&#039;&#039; tool 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;
| fix &lt;br /&gt;
| Attempt to repair or upgrade an installed package &lt;br /&gt;
|-&lt;br /&gt;
| [[#Update the 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;
| dot&lt;br /&gt;
| Create a [http://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;.&lt;br /&gt;
&lt;br /&gt;
The packages are stored in one or more &#039;&#039;repositories&#039;&#039;. A repository is simply a directory with a collection of *.apk files.  The directory must include a special index file, named {{Path|APKINDEX.tar.gz}} to be considered a repository.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;apk&#039;&#039;&#039; utility can install packages from multiple repositories.  The list of repositories to check is stored in {{Path|/etc/apk/repositories}}, one repository per line. If you booted from a USB stick ({{Path|/media/sda1}}) or CD-ROM ({{Path|/media/cdrom}}), your repository file probably looks something like this:&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/apk/repositories|/media/sda1/apks/}}&lt;br /&gt;
&lt;br /&gt;
In addition to local repositories, the &#039;&#039;&#039;apk&#039;&#039;&#039; utility uses &#039;&#039;&#039;busybox wget&#039;&#039;&#039; to fetch packages using &#039;&#039;http:&#039;&#039;, &#039;&#039;https:&#039;&#039; or &#039;&#039;ftp:&#039;&#039; protocols. The following is a valid repository file:&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/apk/repositories|&lt;br /&gt;
/media/sda1/apks&lt;br /&gt;
http://dl-3.alpinelinux.org/alpine/v2.6/main&lt;br /&gt;
https://dl-3.alpinelinux.org/alpine/v2.6/main&lt;br /&gt;
ftp://dl-3.alpinelinux.org/alpine/v2.6/main&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Note|  A list of public repositories is in [https://mirrors.alpinelinux.org/ mirrors.alpinelinux.org].  Accepted protocols vary.}}&lt;br /&gt;
&lt;br /&gt;
== Repository pinning ==&lt;br /&gt;
&lt;br /&gt;
You can specify additional &amp;quot;tagged&amp;quot; repositories in {{Path|/etc/apk/repositories}}:&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/apk/repositories|&lt;br /&gt;
http://nl.alpinelinux.org/alpine/v3.7/main&lt;br /&gt;
http://nl.alpinelinux.org/alpine/v3.7/community&lt;br /&gt;
@edge http://nl.alpinelinux.org/alpine/edge/main&lt;br /&gt;
@edgecommunity http://nl.alpinelinux.org/alpine/edge/community&lt;br /&gt;
@testing http://nl.alpinelinux.org/alpine/edge/testing&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
After which you can &amp;quot;pin&amp;quot; dependencies to these tags using:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add stableapp newapp@edge bleedingapp@testing}}&lt;br /&gt;
&lt;br /&gt;
Apk will now by default only use the untagged repositories, but adding a tag to specific package:&lt;br /&gt;
&lt;br /&gt;
1. will prefer the repository with that tag for the named package, even if a later version of the package is available in another repository&lt;br /&gt;
&lt;br /&gt;
2. &#039;&#039;allows&#039;&#039; pulling in dependencies for the tagged package from the tagged repository (though it &#039;&#039;prefers&#039;&#039; to use untagged repositories to satisfy dependencies if possible)&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;
= Update the Package list =&lt;br /&gt;
&lt;br /&gt;
Remote repositories 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;
&amp;lt;!--&lt;br /&gt;
fetch http://dl-3.alpinelinux.org/alpine/v2.1/main/APKINDEX.tar.gz&lt;br /&gt;
--&amp;gt;&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;
{{Tip|With remote repositories, 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.}}&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 repository. 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;
If you only have the main repository enabled in your configuration, apk will not include packages from the other repositories. To install a package from the edge/testing repository without changing your repository configuration file, use the command below. This will tell apk to use that particular repository.&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add cherokee --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted}}&lt;br /&gt;
&lt;br /&gt;
{{Note|Be careful when using third-party or the testing repository. Your system can go down.}}&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;
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;
&lt;br /&gt;
=== Packages in general ===&lt;br /&gt;
&lt;br /&gt;
To get the latest security upgrades and bugfixes available for the &#039;&#039;installed&#039;&#039; packages of a running system, first &#039;&#039;&#039;update&#039;&#039;&#039; the list of available packages and then &#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 several additional [[#Repository_pinning|repositories pinned]]:&lt;br /&gt;
&lt;br /&gt;
 # apk update&lt;br /&gt;
 fetch http://dl-3.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz&lt;br /&gt;
 fetch http://dl-3.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz&lt;br /&gt;
 fetch http://dl-3.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz&lt;br /&gt;
 fetch http://dl-3.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz&lt;br /&gt;
 fetch http://dl-3.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz&lt;br /&gt;
 v3.6.2-191-gf98d79930f [http://dl-3.alpinelinux.org/alpine/v3.6/main]&lt;br /&gt;
 v3.6.2-190-ga5d68c47df [http://dl-3.alpinelinux.org/alpine/v3.6/community]&lt;br /&gt;
 v3.6.0-4618-g0bf77c9821 [http://dl-3.alpinelinux.org/alpine/edge/main]&lt;br /&gt;
 v3.6.0-4605-g85ed51dd83 [http://dl-3.alpinelinux.org/alpine/edge/community]&lt;br /&gt;
 v3.6.0-4624-g11f1b9c8ab [http://dl-3.alpinelinux.org/alpine/edge/testing]&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;
&lt;br /&gt;
To upgrade only &#039;&#039;specific&#039;&#039; packages, use the &#039;&#039;-u&#039;&#039; or &#039;&#039;--upgrade&#039;&#039; option of the &#039;&#039;&#039;add&#039;&#039;&#039; command:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk update&lt;br /&gt;
apk add --upgrade busybox &lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To enable unattended, automatic upgrades of packages, see the {{pkg|apk-autoupdate}} package.&lt;br /&gt;
&lt;br /&gt;
To upgrade to a newer release, refer to the corresponding release notes and [[Upgrading_Alpine]].&lt;br /&gt;
&lt;br /&gt;
=== Upgrading &amp;quot;diskless&amp;quot; and &amp;quot;data&amp;quot; disk mode installs ===&lt;br /&gt;
&lt;br /&gt;
If booting a &amp;quot;diskless&amp;quot; system from a read-only device, or iso image on writable media, it&#039;s not possible to update the boot files (kernel, modules, firmware, ...) that reside on that device.&lt;br /&gt;
&lt;br /&gt;
It becomes possible to update the boot files, though, if using a boot device that is writable and has been prepared with &amp;lt;code&amp;gt;[[Alpine_setup_scripts#setup-bootable|setup-bootable]]&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
However, even then, the kernel, with its modules and firmware files, can still not be updated directly through regular packages updates. Instead, there is the &amp;lt;code&amp;gt;update-kernel&amp;lt;/code&amp;gt; script that can generate initfs images and install them together with upgraded kernels.&lt;br /&gt;
&lt;br /&gt;
Upgrading can be done as follows.&lt;br /&gt;
{{cmd|apk add mkinitfs&lt;br /&gt;
}}&lt;br /&gt;
This package is required for the generation of the initial filesystem used during boot.&lt;br /&gt;
* Additional initfs features that are missing in the default configuration, like the &amp;quot;btrfs&amp;quot; filesystem support (at the time of writing, to allow loading .apkovl configs and package cache during boot), may be enabled in &amp;lt;code&amp;gt;/etc/mkinitfs/mkinitfs.conf&amp;lt;/code&amp;gt;.&lt;br /&gt;
* Available initfs features may be listed with &amp;lt;code&amp;gt;ls /etc/mkinitfs/features.d&amp;lt;/code&amp;gt;&lt;br /&gt;
{{cmd|ls /etc/mkinitfs/features.d&lt;br /&gt;
apk add nano&lt;br /&gt;
nano /etc/mkinitfs/mkinitfs.conf&lt;br /&gt;
lbu commit&lt;br /&gt;
}}&lt;br /&gt;
Finally update the kernel and its boot environment.&lt;br /&gt;
{{cmd|update-kernel /media/sdXY/boot/&lt;br /&gt;
}}&lt;br /&gt;
* An &amp;lt;code&amp;gt;update-kernel&amp;lt;/code&amp;gt; run needs at least 8 GB free ram memory to avoid a broken modloop-image.&lt;br /&gt;
* See &amp;lt;code&amp;gt;update-kernel --help&amp;lt;/code&amp;gt; for options to manually add additional module or firmware packages.&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;
&lt;br /&gt;
= Information on Packages =&lt;br /&gt;
&lt;br /&gt;
== apk info ==&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;http://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;
{{Tip|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}} will display&lt;br /&gt;
&lt;br /&gt;
 /sbin/lbu is owned by alpine-conf-x.x-rx&lt;br /&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;
&amp;lt;pre&amp;gt;apk info&amp;lt;/pre&amp;gt;&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;
&amp;lt;pre&amp;gt;apk -vv info|sort&amp;lt;/pre&amp;gt;&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;#!/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&amp;lt;/pre&amp;gt;&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;
 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;
    http://dl-3.alpinelinux.org/alpine/v3.7/community&lt;br /&gt;
  3.0.0_rc2-r1:&lt;br /&gt;
    @edgecommunity http://dl-3.alpinelinux.org/alpine/edge/community&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Additional apk Commands =&lt;br /&gt;
In progress...&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;
== 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)  &amp;lt;ref&amp;gt;[https://git.alpinelinux.org/apk-tools/commit/?id=693b4bcdb0f22904a521a7c8ac4f13e697dc4d71 Alpine source commit message]&amp;lt;/ref&amp;gt;&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.  For example, most Alpine package repos contain an &amp;quot;edge&amp;quot; branch, which may drop package versions that are not deemed fit to make it into a stable branch.  This means that pinning to a version on the edge branch may stop working after the package version is revoked from the repo.  Always pin to a package version that is intended for your current Alpine Linux version.&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting =&lt;br /&gt;
&lt;br /&gt;
== &amp;quot;apk-tools is old&amp;quot; == &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;
&amp;lt;pre&amp;gt;sudo apk add --upgrade apk-tools@edge&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= =&lt;br /&gt;
* [https://www.cyberciti.biz/faq/10-alpine-linux-apk-command-examples/ 10 Alpine Linux apk Command Examples]  Vivek Gite 2019&lt;br /&gt;
&lt;br /&gt;
[[Category:Package Manager]]&lt;/div&gt;</summary>
		<author><name>Dfen</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Enable_Serial_Console_on_Boot&amp;diff=20396</id>
		<title>Enable Serial Console on Boot</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Enable_Serial_Console_on_Boot&amp;diff=20396"/>
		<updated>2021-12-02T17:11:21Z</updated>

		<summary type="html">&lt;p&gt;Dfen: /* Example /boot/extlinux.conf */ correct metric prefix, cite source, add caveat about zero timeout&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== How to Enable the Serial Console on Boot (1.10.x)==&lt;br /&gt;
&lt;br /&gt;
When using syslinux to boot, you&#039;ll need to modify the syslinux.cfg file in the root directory of the boot device. If using a disk-based Alpine, modify the /boot/extlinux.cfg file.&lt;br /&gt;
&lt;br /&gt;
Add the following:&lt;br /&gt;
* &amp;lt;tt&amp;gt;serial 0 9600&amp;lt;/tt&amp;gt;&lt;br /&gt;
* add &amp;lt;tt&amp;gt;console=ttyS0,9600&amp;lt;/tt&amp;gt; to the &amp;lt;tt&amp;gt;append&amp;lt;/tt&amp;gt; parameter&lt;br /&gt;
* optionally, remove &amp;lt;tt&amp;gt;quiet&amp;lt;/tt&amp;gt; from the &amp;lt;tt&amp;gt;append &amp;lt;/tt&amp;gt; parameter&lt;br /&gt;
&lt;br /&gt;
=== Example syslinux.cfg ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
serial 0 9600&lt;br /&gt;
timeout 20&lt;br /&gt;
prompt 1&lt;br /&gt;
default grsec&lt;br /&gt;
label grsec&lt;br /&gt;
        kernel /boot/grsec&lt;br /&gt;
        append initrd=/boot/grsec.gz alpine_dev=sda1:vfat modules=sd-mod,usb-storage console=ttyS0,9600&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== extlinux.conf (3.0+)==&lt;br /&gt;
&lt;br /&gt;
The /etc/update-extlinux.conf is read by the update-extlinux utility.&lt;br /&gt;
&lt;br /&gt;
To do so, change the default entry:&lt;br /&gt;
&amp;lt;pre&amp;gt;default_kernel_opts=&amp;quot;quiet&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
to read like this:           &lt;br /&gt;
&amp;lt;pre&amp;gt;default_kernel_opts=&amp;quot;console=ttyS0,9600 quiet&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set the serial port and baud rate to match the default_kernel_opts line above:&lt;br /&gt;
&amp;lt;pre&amp;gt;serial_port=0&lt;br /&gt;
serial_baud=9600&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Xen ===&lt;br /&gt;
&lt;br /&gt;
Notice, if you want to use this for a Xen VM,&lt;br /&gt;
you need to configure the speed at &#039;&#039;&#039;115200&#039;&#039;&#039; bps and enable the &lt;br /&gt;
&amp;lt;pre&amp;gt;serial=&amp;quot;pty&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
setting in the VM config file.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Xen can be configured to use and log to a serial console by editing /etc/update-extlinux.conf to include the following lines:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
default_kernel_opts=&amp;quot;console=hvc0 earlyprintk=xen nomodeset&amp;quot;&lt;br /&gt;
xen_opts=&amp;quot;dom0_mem=256M com1=115200,8n1 console=com1&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the [http://wiki.xen.org/wiki/Xen_Serial_Console Xen wiki] for more details.&lt;br /&gt;
&lt;br /&gt;
=== Example /boot/extlinux.conf ===&lt;br /&gt;
&lt;br /&gt;
This is a complete file, written by the update-extlinux command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
DEFAULT menu.c32&lt;br /&gt;
PROMPT 0&lt;br /&gt;
MENU TITLE Alpine/Linux Boot Menu&lt;br /&gt;
MENU AUTOBOOT Alpine will be booted automatically in # seconds.&lt;br /&gt;
SERIAL 0 9600&lt;br /&gt;
TIMEOUT 100&lt;br /&gt;
LABEL grsec&lt;br /&gt;
  MENU DEFAULT&lt;br /&gt;
  MENU LABEL Linux 3.10.33-0-grsec&lt;br /&gt;
  LINUX vmlinuz-3.10.33-0-grsec&lt;br /&gt;
  INITRD initramfs-3.10.33-0-grsec&lt;br /&gt;
  APPEND root=UUID=re-mov-ed-uu-id modules=sd-mod,usb-storage,ext4 console=ttyS0,9600&lt;br /&gt;
&lt;br /&gt;
MENU SEPARATOR&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please: adjust the tty speed to 115200 if needed (Xen!!).&lt;br /&gt;
&lt;br /&gt;
The timeout is given in deciseconds, so this would be a 10 second timeout.[https://wiki.syslinux.org/wiki/index.php?title=Config#TIMEOUT] A timeout of 0 does not boot without delay, but rather waits indefinitely for the user.&lt;br /&gt;
&lt;br /&gt;
If the file is read by pygrub, the same value is interpreted as seconds, resulting in a 100s bootup delay per VM.&lt;br /&gt;
&lt;br /&gt;
== Enabling a login console ==&lt;br /&gt;
&lt;br /&gt;
This is done in /etc/inittab. There is commented entry for ttyS0. Just enable it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Put a getty on the serial port&lt;br /&gt;
ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To start the getty, restart init:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
kill -HUP 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Enabling two consoles during boot ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s possible to output to both the serial and vga console during the system boot.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
append &amp;quot;quiet console=ttyS0,9600 console=tty0&amp;quot;&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Not known how to do the same thing in the extlinux menu. &lt;br /&gt;
You might find a starting point in this thread: http://patchwork.openembedded.org/patch/45175/&lt;br /&gt;
&lt;br /&gt;
== Add your serial console to the trusted local terminal list ==&lt;br /&gt;
If you face the problem that the login prompt always refuses your password when you use serial console, you missed this entry.&lt;br /&gt;
&lt;br /&gt;
Add this to the &amp;lt;tt&amp;gt;/etc/securetty&amp;lt;/tt&amp;gt; file:   &lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
ttyS0&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Booting]]&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Dfen</name></author>
	</entry>
</feed>