<?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=Vixalien</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=Vixalien"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Vixalien"/>
	<updated>2026-05-01T17:51:55Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=User:Vixalien/Clevis&amp;diff=28776</id>
		<title>User:Vixalien/Clevis</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=User:Vixalien/Clevis&amp;diff=28776"/>
		<updated>2025-01-12T22:45:06Z</updated>

		<summary type="html">&lt;p&gt;Vixalien: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://github.com/latchset/clevis/ Clevis] is a tool that allows, among many other things, to automatically decrypt LUKS volume at boot-time automatically using the TPM without requiring the manual input of a password.&lt;br /&gt;
&lt;br /&gt;
{{Warning|If you use Clevis to automatically decrypt your disk at boot, your computer will unlock automatically, and this can be a security issue}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
To use clevis install the {{pkg|clevis}} package.&lt;br /&gt;
&lt;br /&gt;
If you need the TPM functionality, you will also need to install {{pkg|tpm2-tools}} and {{pkg|tpm2-tss-tcti-device}}. See [https://gitlab.alpinelinux.org/alpine/aports/-/issues/15985 See issue]:&lt;br /&gt;
&lt;br /&gt;
 # apk add -t clevis-tpm tpm2-tools clevis tpm2-tss-tcti-device&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
You may wish to encrypt some data using your TPM with clevis:&lt;br /&gt;
&lt;br /&gt;
 # echo &#039;hello, world&#039; | clevis encrypt tpm2 &#039;{}&#039;&lt;br /&gt;
&lt;br /&gt;
 eyJhbGciOiJkaXIiLCJjbGV2aXMiOnsicGluIjoidHBtMiIsInRwbTIiOnsiaGFzaCI6InNoYTI1NiIsImp3a19wcml2IjoiQU80QUlETDZOQlp1dFktZUg2YjdNUUFtazNxNE5MTGRDYWFrM2tJUHBsOWtRUmlxQUJEaFFGSks0MWVWQXMtUElKbmsxUW9MS0hVVnhoQmM5RVlZZ1hfc1MzaS1EYUQ1aXZQdmZybUxSY25TZGxYRWtvSE1qN0lMekFvY29ZQ2FnRGNxczBYcVFCRkhqTkxFaW5PM3NySjAxTlo3QkExX2tnR0t1THVISC1pVUpESGZNQklnUFFsMzUyb3dSeFdPVUhuWnFiRk5rTU9WekVRS1ZTYUlUUlZtMEhnZHEwTWtpYV9HSjB2bGFXYkJtUE45SU1weGZXTTU3dGdGSnBRYXBobkNoZUsyLUkzeHNnY01rb2N3eUNnTzRZUnlZOXcxZGx4aVhxYURoc0xpcnJMV3E3SFFuZkRCVXlvU2hTWC0iLCJqd2tfcHViIjoiQUM0QUNBQUxBQUFFMGdBQUFCQUFJTlBYYkNWd3BNRUVnUkRGVF9VVVZ6c3Flb3dpWW5PSEZiVmZfV3ZHTUFTOCIsImtleSI6ImVjYyJ9fSwiZW5jIjoiQTI1NkdDTSJ9..F117H8zDNXxuOzxr.KCPhBegjQRx3Sv6uFg.yC9EbXhI8twv48oohl3KOw&lt;br /&gt;
&lt;br /&gt;
The result will be a base-64 encoded string encrypted with your computer&#039;s TPM2 key. This means that the message can only be decoded from this current computer (or more precisely, the same TPM2 chip that encoded it).&lt;br /&gt;
&lt;br /&gt;
 # echo &amp;quot;eyJhbGciOiJkaXIiLCJjbGV2aXMiOnsicGluIjoidHBtMiIsInRwbTIiOnsiaGFzaCI6InNoYTI1NiIsImp3a19wcml2IjoiQU80QUlETDZOQlp1dFktZUg2YjdNUUFtazNxNE5MTGRDYWFrM2tJUHBsOWtRUmlxQUJEaFFGSks0MWVWQXMtUElKbmsxUW9MS0hVVnhoQmM5RVlZZ1hfc1MzaS1EYUQ1aXZQdmZybUxSY25TZGxYRWtvSE1qN0lMekFvY29ZQ2FnRGNxczBYcVFCRkhqTkxFaW5PM3NySjAxTlo3QkExX2tnR0t1THVISC1pVUpESGZNQklnUFFsMzUyb3dSeFdPVUhuWnFiRk5rTU9WekVRS1ZTYUlUUlZtMEhnZHEwTWtpYV9HSjB2bGFXYkJtUE45SU1weGZXTTU3dGdGSnBRYXBobkNoZUsyLUkzeHNnY01rb2N3eUNnTzRZUnlZOXcxZGx4aVhxYURoc0xpcnJMV3E3SFFuZkRCVXlvU2hTWC0iLCJqd2tfcHViIjoiQUM0QUNBQUxBQUFFMGdBQUFCQUFJTlBYYkNWd3BNRUVnUkRGVF9VVVZ6c3Flb3dpWW5PSEZiVmZfV3ZHTUFTOCIsImtleSI6ImVjYyJ9fSwiZW5jIjoiQTI1NkdDTSJ9..F117H8zDNXxuOzxr.KCPhBegjQRx3Sv6uFg.yC9EbXhI8twv48oohl3KOw&amp;quot; | clevis decrypt tpm2 &#039;{}&#039;&lt;br /&gt;
&lt;br /&gt;
 hello, world&lt;br /&gt;
&lt;br /&gt;
== Encrypt a LUKS volume ==&lt;br /&gt;
&lt;br /&gt;
{{Warning|Remember to add a backup password in case TPM unlocking fails using:&lt;br /&gt;
&lt;br /&gt;
 # cryptsetup luksAddKey /dev/sda1&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Use the following command to bind a LUKS volume to your TPM:&lt;br /&gt;
&lt;br /&gt;
 # clevis luks bind -d /dev/sda1 tpm2 &#039;{}&#039;&lt;br /&gt;
&lt;br /&gt;
The {{ic|&#039;{}&#039;|}} contains the configuration. For example, you can use the following command to seal the LUKS key against UEFI settings AND the [[Secure Boot]] policy, meaning clevis will be unable to unlock the device if either the UEFI settings changes or the SecureBoot keys are changed, and you&#039;ll need to rebind the volume after inputting your backup password&lt;br /&gt;
&lt;br /&gt;
 &#039;{&amp;quot;pcr_ids&amp;quot;:&amp;quot;1,7&amp;quot;}&#039;&lt;br /&gt;
&lt;br /&gt;
See {{ic|&#039;man 1 clevis-encrypt-tpm2&#039;|}} for all possible configuration options.&lt;br /&gt;
&lt;br /&gt;
== mkinitfs hook ==&lt;br /&gt;
&lt;br /&gt;
After binding your LVM volume to your TPM, you may wish for it to be unlocked automatically when your device boots. Currently, this process is a bit tedious, but will hopefully be improved in the future.&lt;br /&gt;
&lt;br /&gt;
=== mkinitfs feature ===&lt;br /&gt;
&lt;br /&gt;
First, create the following files with the following content. They allow all the kernel modules and files needed to unlock LUKS devices with the TPM to be copied to the initramfs.&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/mkinitfs/features.d/clevis-tpm.modules|kernel/drivers/char/tpm&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/mkinitfs/features.d/clevis-tpm.files|/bin/bash&lt;br /&gt;
/usr/bin/clevis&lt;br /&gt;
/usr/bin/clevis-decrypt&lt;br /&gt;
/usr/bin/clevis-decrypt-tpm2&lt;br /&gt;
/usr/bin/clevis-luks-unlock&lt;br /&gt;
/usr/bin/clevis-luks-common-functions&lt;br /&gt;
/usr/bin/jose&lt;br /&gt;
/usr/bin/tpm2_createprimary&lt;br /&gt;
/usr/bin/tpm2_unseal&lt;br /&gt;
/usr/bin/tpm2_load&lt;br /&gt;
/usr/bin/tpm2_flushcontext&lt;br /&gt;
/usr/lib/libjansson.so.4&lt;br /&gt;
/usr/lib/libjose.so.0&lt;br /&gt;
/usr/lib/libtss2-tcti-device.so.0&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Then, add the &amp;lt;code&amp;gt;clevis-tpm&amp;lt;/code&amp;gt; feature to {{path|/etc/mkinitfs/mkinitfs.conf}}:&lt;br /&gt;
&lt;br /&gt;
 features=&amp;quot;ata base cdrom ext4 keymap kms mmc nvme raid scsi usb virtio &#039;&#039;&#039;clevis-tpm&#039;&#039;&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forgot to regenerate your initramfs&lt;br /&gt;
&lt;br /&gt;
 # apk fix kernel-hooks&lt;br /&gt;
&lt;br /&gt;
=== init script ===&lt;br /&gt;
&lt;br /&gt;
Now, everything that&#039;s needed to unbind the LUKS device with the TPM is now included in the initramfs. All that&#039;s needed is to actually unlock the device in the initramfs. Since [https://gitlab.alpinelinux.org/alpine/mkinitfs/-/issues/18 it&#039;s currently not possible to run custom scripts in the init], you will need to manually edit the init and allow it to decrypt the disk with clevis if possible.&lt;br /&gt;
&lt;br /&gt;
{{Warning|This part of the guide has not been tested yet. You have been warned!}}&lt;br /&gt;
&lt;br /&gt;
Edit the file {{path|/usr/share/mkinitfs/initramfs-init}}, and replace the text:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [ -n &amp;quot;$KOPT_cryptroot&amp;quot; ]; then&lt;br /&gt;
	cryptopts=&amp;quot;-c ${KOPT_cryptroot}&amp;quot;&lt;br /&gt;
	if [ &amp;quot;$KOPT_cryptdiscards&amp;quot; = &amp;quot;yes&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -D&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ -n &amp;quot;$KOPT_cryptdm&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -m ${KOPT_cryptdm}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ -n &amp;quot;$KOPT_cryptheader&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -H ${KOPT_cryptheader}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ -n &amp;quot;$KOPT_cryptoffset&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -o ${KOPT_cryptoffset}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ &amp;quot;$KOPT_cryptkey&amp;quot; = &amp;quot;yes&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -k /crypto_keyfile.bin&amp;quot;&lt;br /&gt;
	elif [ -n &amp;quot;$KOPT_cryptkey&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -k ${KOPT_cryptkey}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And replace it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [ -n &amp;quot;$KOPT_cryptroot&amp;quot; ]; then&lt;br /&gt;
	cryptopts=&amp;quot;-c ${KOPT_cryptroot}&amp;quot;&lt;br /&gt;
	clevisopts=&amp;quot;-d ${KOPT_cryptroot}&amp;quot;&lt;br /&gt;
	if [ &amp;quot;$KOPT_cryptdiscards&amp;quot; = &amp;quot;yes&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -D&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ -n &amp;quot;$KOPT_cryptdm&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -m ${KOPT_cryptdm}&amp;quot;&lt;br /&gt;
		clevisopts=&amp;quot;-n ${KOPT_cryptopts}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ -n &amp;quot;$KOPT_cryptheader&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -H ${KOPT_cryptheader}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ -n &amp;quot;$KOPT_cryptoffset&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -o ${KOPT_cryptoffset}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ &amp;quot;$KOPT_cryptkey&amp;quot; = &amp;quot;yes&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -k /crypto_keyfile.bin&amp;quot;&lt;br /&gt;
	elif [ -n &amp;quot;$KOPT_cryptkey&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -k ${KOPT_cryptkey}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
if [ -n &amp;quot;$clevisopts&amp;quot; ]; then&lt;br /&gt;
  clevis luks unlock $clevisopts&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/latchset/clevis/ Project homepage]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Clevis Clevis on ArchWiki]&lt;br /&gt;
* [https://github.com/latchset/clevis/blob/master/src/initramfs-tools/hooks/clevis.in clevis initramfs-tools hook]&lt;br /&gt;
* [https://github.com/kishorv06/arch-mkinitcpio-clevis-hook mkinitcpio-clevis-hook&#039;s homepage]&lt;/div&gt;</summary>
		<author><name>Vixalien</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=User:Vixalien/Clevis&amp;diff=28775</id>
		<title>User:Vixalien/Clevis</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=User:Vixalien/Clevis&amp;diff=28775"/>
		<updated>2025-01-12T22:26:07Z</updated>

		<summary type="html">&lt;p&gt;Vixalien: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://github.com/latchset/clevis/ Clevis] is a tool that allows, among many other things, to automatically decrypt LUKS volume at boot-time automatically using the TPM without requiring the manual input of a password.&lt;br /&gt;
&lt;br /&gt;
{{Warning|If you use Clevis to automatically decrypt your disk at boot, your computer will unlock automatically, and this can be a security issue}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
To use clevis install the {{pkg|clevis}} package.&lt;br /&gt;
&lt;br /&gt;
If you need the TPM functionality, you will also need to install {{pkg|tpm2-tools}} and {{pkg|tpm2-tss-tcti-device}}. See [https://gitlab.alpinelinux.org/alpine/aports/-/issues/15985 See issue]:&lt;br /&gt;
&lt;br /&gt;
 # apk add -t clevis-tpm clevis tpm2-tss-tcti-device&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
You may wish to encrypt some data using your TPM with clevis:&lt;br /&gt;
&lt;br /&gt;
 # echo &#039;hello, world&#039; | clevis encrypt tpm2 &#039;{}&#039;&lt;br /&gt;
&lt;br /&gt;
 eyJhbGciOiJkaXIiLCJjbGV2aXMiOnsicGluIjoidHBtMiIsInRwbTIiOnsiaGFzaCI6InNoYTI1NiIsImp3a19wcml2IjoiQU80QUlETDZOQlp1dFktZUg2YjdNUUFtazNxNE5MTGRDYWFrM2tJUHBsOWtRUmlxQUJEaFFGSks0MWVWQXMtUElKbmsxUW9MS0hVVnhoQmM5RVlZZ1hfc1MzaS1EYUQ1aXZQdmZybUxSY25TZGxYRWtvSE1qN0lMekFvY29ZQ2FnRGNxczBYcVFCRkhqTkxFaW5PM3NySjAxTlo3QkExX2tnR0t1THVISC1pVUpESGZNQklnUFFsMzUyb3dSeFdPVUhuWnFiRk5rTU9WekVRS1ZTYUlUUlZtMEhnZHEwTWtpYV9HSjB2bGFXYkJtUE45SU1weGZXTTU3dGdGSnBRYXBobkNoZUsyLUkzeHNnY01rb2N3eUNnTzRZUnlZOXcxZGx4aVhxYURoc0xpcnJMV3E3SFFuZkRCVXlvU2hTWC0iLCJqd2tfcHViIjoiQUM0QUNBQUxBQUFFMGdBQUFCQUFJTlBYYkNWd3BNRUVnUkRGVF9VVVZ6c3Flb3dpWW5PSEZiVmZfV3ZHTUFTOCIsImtleSI6ImVjYyJ9fSwiZW5jIjoiQTI1NkdDTSJ9..F117H8zDNXxuOzxr.KCPhBegjQRx3Sv6uFg.yC9EbXhI8twv48oohl3KOw&lt;br /&gt;
&lt;br /&gt;
The result will be a base-64 encoded string encrypted with your computer&#039;s TPM2 key. This means that the message can only be decoded from this current computer (or more precisely, the same TPM2 chip that encoded it).&lt;br /&gt;
&lt;br /&gt;
 # echo &amp;quot;eyJhbGciOiJkaXIiLCJjbGV2aXMiOnsicGluIjoidHBtMiIsInRwbTIiOnsiaGFzaCI6InNoYTI1NiIsImp3a19wcml2IjoiQU80QUlETDZOQlp1dFktZUg2YjdNUUFtazNxNE5MTGRDYWFrM2tJUHBsOWtRUmlxQUJEaFFGSks0MWVWQXMtUElKbmsxUW9MS0hVVnhoQmM5RVlZZ1hfc1MzaS1EYUQ1aXZQdmZybUxSY25TZGxYRWtvSE1qN0lMekFvY29ZQ2FnRGNxczBYcVFCRkhqTkxFaW5PM3NySjAxTlo3QkExX2tnR0t1THVISC1pVUpESGZNQklnUFFsMzUyb3dSeFdPVUhuWnFiRk5rTU9WekVRS1ZTYUlUUlZtMEhnZHEwTWtpYV9HSjB2bGFXYkJtUE45SU1weGZXTTU3dGdGSnBRYXBobkNoZUsyLUkzeHNnY01rb2N3eUNnTzRZUnlZOXcxZGx4aVhxYURoc0xpcnJMV3E3SFFuZkRCVXlvU2hTWC0iLCJqd2tfcHViIjoiQUM0QUNBQUxBQUFFMGdBQUFCQUFJTlBYYkNWd3BNRUVnUkRGVF9VVVZ6c3Flb3dpWW5PSEZiVmZfV3ZHTUFTOCIsImtleSI6ImVjYyJ9fSwiZW5jIjoiQTI1NkdDTSJ9..F117H8zDNXxuOzxr.KCPhBegjQRx3Sv6uFg.yC9EbXhI8twv48oohl3KOw&amp;quot; | clevis decrypt tpm2 &#039;{}&#039;&lt;br /&gt;
&lt;br /&gt;
 hello, world&lt;br /&gt;
&lt;br /&gt;
== Encrypt a LUKS volume ==&lt;br /&gt;
&lt;br /&gt;
{{Warning|Remember to add a backup password in case TPM unlocking fails using:&lt;br /&gt;
&lt;br /&gt;
 # cryptsetup luksAddKey /dev/sda1&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Use the following command to bind a LUKS volume to your TPM:&lt;br /&gt;
&lt;br /&gt;
 # clevis luks bind -d /dev/sda1 tpm2 &#039;{}&#039;&lt;br /&gt;
&lt;br /&gt;
The {{ic|&#039;{}&#039;|}} contains the configuration. For example, you can use the following command to seal the LUKS key against UEFI settings AND the [[Secure Boot]] policy, meaning clevis will be unable to unlock the device if either the UEFI settings changes or the SecureBoot keys are changed, and you&#039;ll need to rebind the volume after inputting your backup password&lt;br /&gt;
&lt;br /&gt;
 &#039;{&amp;quot;pcr_ids&amp;quot;:&amp;quot;1,7&amp;quot;}&#039;&lt;br /&gt;
&lt;br /&gt;
See {{ic|&#039;man 1 clevis-encrypt-tpm2&#039;|}} for all possible configuration options.&lt;br /&gt;
&lt;br /&gt;
== mkinitfs hook ==&lt;br /&gt;
&lt;br /&gt;
After binding your LVM volume to your TPM, you may wish for it to be unlocked automatically when your device boots. Currently, this process is a bit tedious, but will hopefully be improved in the future.&lt;br /&gt;
&lt;br /&gt;
=== mkinitfs feature ===&lt;br /&gt;
&lt;br /&gt;
First, create the following files with the following content. They allow all the kernel modules and files needed to unlock LUKS devices with the TPM to be copied to the initramfs.&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/mkinitfs/features.d/clevis-tpm.modules|kernel/drivers/char/tpm&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/mkinitfs/features.d/clevis-tpm.files|/bin/bash&lt;br /&gt;
/usr/bin/clevis&lt;br /&gt;
/usr/bin/clevis-decrypt&lt;br /&gt;
/usr/bin/clevis-decrypt-tpm2&lt;br /&gt;
/usr/bin/clevis-luks-unlock&lt;br /&gt;
/usr/bin/clevis-luks-common-functions&lt;br /&gt;
/usr/bin/jose&lt;br /&gt;
/usr/bin/tpm2_createprimary&lt;br /&gt;
/usr/bin/tpm2_unseal&lt;br /&gt;
/usr/bin/tpm2_load&lt;br /&gt;
/usr/bin/tpm2_flushcontext&lt;br /&gt;
/usr/lib/libjansson.so.4&lt;br /&gt;
/usr/lib/libjose.so.0&lt;br /&gt;
/usr/lib/libtss2-tcti-device.so.0&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Then, add the &amp;lt;code&amp;gt;clevis-tpm&amp;lt;/code&amp;gt; feature to {{path|/etc/mkinitfs/mkinitfs.conf}}:&lt;br /&gt;
&lt;br /&gt;
 features=&amp;quot;ata base cdrom ext4 keymap kms mmc nvme raid scsi usb virtio &#039;&#039;&#039;clevis-tpm&#039;&#039;&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forgot to regenerate your initramfs&lt;br /&gt;
&lt;br /&gt;
 # apk fix kernel-hooks&lt;br /&gt;
&lt;br /&gt;
=== init script ===&lt;br /&gt;
&lt;br /&gt;
Now, everything that&#039;s needed to unbind the LUKS device with the TPM is now included in the initramfs. All that&#039;s needed is to actually unlock the device in the initramfs. Since [https://gitlab.alpinelinux.org/alpine/mkinitfs/-/issues/18 it&#039;s currently not possible to run custom scripts in the init], you will need to manually edit the init and allow it to decrypt the disk with clevis if possible.&lt;br /&gt;
&lt;br /&gt;
{{Warning|This part of the guide has not been tested yet. You have been warned!}}&lt;br /&gt;
&lt;br /&gt;
Edit the file {{path|/usr/share/mkinitfs/initramfs-init}}, and replace the text:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [ -n &amp;quot;$KOPT_cryptroot&amp;quot; ]; then&lt;br /&gt;
	cryptopts=&amp;quot;-c ${KOPT_cryptroot}&amp;quot;&lt;br /&gt;
	if [ &amp;quot;$KOPT_cryptdiscards&amp;quot; = &amp;quot;yes&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -D&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ -n &amp;quot;$KOPT_cryptdm&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -m ${KOPT_cryptdm}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ -n &amp;quot;$KOPT_cryptheader&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -H ${KOPT_cryptheader}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ -n &amp;quot;$KOPT_cryptoffset&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -o ${KOPT_cryptoffset}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ &amp;quot;$KOPT_cryptkey&amp;quot; = &amp;quot;yes&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -k /crypto_keyfile.bin&amp;quot;&lt;br /&gt;
	elif [ -n &amp;quot;$KOPT_cryptkey&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -k ${KOPT_cryptkey}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And replace it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [ -n &amp;quot;$KOPT_cryptroot&amp;quot; ]; then&lt;br /&gt;
	cryptopts=&amp;quot;-c ${KOPT_cryptroot}&amp;quot;&lt;br /&gt;
	clevisopts=&amp;quot;-d ${KOPT_cryptroot}&amp;quot;&lt;br /&gt;
	if [ &amp;quot;$KOPT_cryptdiscards&amp;quot; = &amp;quot;yes&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -D&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ -n &amp;quot;$KOPT_cryptdm&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -m ${KOPT_cryptdm}&amp;quot;&lt;br /&gt;
		clevisopts=&amp;quot;-n ${KOPT_cryptopts}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ -n &amp;quot;$KOPT_cryptheader&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -H ${KOPT_cryptheader}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ -n &amp;quot;$KOPT_cryptoffset&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -o ${KOPT_cryptoffset}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ &amp;quot;$KOPT_cryptkey&amp;quot; = &amp;quot;yes&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -k /crypto_keyfile.bin&amp;quot;&lt;br /&gt;
	elif [ -n &amp;quot;$KOPT_cryptkey&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -k ${KOPT_cryptkey}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
if [ -n &amp;quot;$clevisopts&amp;quot; ]; then&lt;br /&gt;
  clevis luks unlock $clevisopts&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/latchset/clevis/ Project homepage]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Clevis Clevis on ArchWiki]&lt;br /&gt;
* [https://github.com/latchset/clevis/blob/master/src/initramfs-tools/hooks/clevis.in clevis initramfs-tools hook]&lt;br /&gt;
* [https://github.com/kishorv06/arch-mkinitcpio-clevis-hook mkinitcpio-clevis-hook&#039;s homepage]&lt;/div&gt;</summary>
		<author><name>Vixalien</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=User:Vixalien/Clevis&amp;diff=27841</id>
		<title>User:Vixalien/Clevis</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=User:Vixalien/Clevis&amp;diff=27841"/>
		<updated>2024-11-18T02:14:36Z</updated>

		<summary type="html">&lt;p&gt;Vixalien: Added the Clevis page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://github.com/latchset/clevis/ Clevis] is a tool that allows, among many other things, to automatically decrypt LUKS volume at boot-time automatically using the TPM without requiring the manual input of a password.&lt;br /&gt;
&lt;br /&gt;
{{Warning|If you use Clevis to automatically decrypt your disk at boot, your computer will unlock automatically, and this can be a security issue}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
To use clevis install the {{pkg|clevis}} package.&lt;br /&gt;
&lt;br /&gt;
If you need the TPM functionality, you will also need to install {{pkg|tpm2-tools}} and {{pkg|tpm2-tss-tcti-device}}. See [https://gitlab.alpinelinux.org/alpine/aports/-/issues/15985 See issue]:&lt;br /&gt;
&lt;br /&gt;
 # apk add -t clevis-tpm clevis tpm2-tools tpm2-tss-tcti-device&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
You may wish to encrypt some data using your TPM with clevis:&lt;br /&gt;
&lt;br /&gt;
 # echo &#039;hello, world&#039; | clevis encrypt tpm2 &#039;{}&lt;br /&gt;
&lt;br /&gt;
 eyJhbGciOiJkaXIiLCJjbGV2aXMiOnsicGluIjoidHBtMiIsInRwbTIiOnsiaGFzaCI6InNoYTI1NiIsImp3a19wcml2IjoiQU80QUlETDZOQlp1dFktZUg2YjdNUUFtazNxNE5MTGRDYWFrM2tJUHBsOWtRUmlxQUJEaFFGSks0MWVWQXMtUElKbmsxUW9MS0hVVnhoQmM5RVlZZ1hfc1MzaS1EYUQ1aXZQdmZybUxSY25TZGxYRWtvSE1qN0lMekFvY29ZQ2FnRGNxczBYcVFCRkhqTkxFaW5PM3NySjAxTlo3QkExX2tnR0t1THVISC1pVUpESGZNQklnUFFsMzUyb3dSeFdPVUhuWnFiRk5rTU9WekVRS1ZTYUlUUlZtMEhnZHEwTWtpYV9HSjB2bGFXYkJtUE45SU1weGZXTTU3dGdGSnBRYXBobkNoZUsyLUkzeHNnY01rb2N3eUNnTzRZUnlZOXcxZGx4aVhxYURoc0xpcnJMV3E3SFFuZkRCVXlvU2hTWC0iLCJqd2tfcHViIjoiQUM0QUNBQUxBQUFFMGdBQUFCQUFJTlBYYkNWd3BNRUVnUkRGVF9VVVZ6c3Flb3dpWW5PSEZiVmZfV3ZHTUFTOCIsImtleSI6ImVjYyJ9fSwiZW5jIjoiQTI1NkdDTSJ9..F117H8zDNXxuOzxr.KCPhBegjQRx3Sv6uFg.yC9EbXhI8twv48oohl3KOw&lt;br /&gt;
&lt;br /&gt;
The result will be a base-64 encoded string encrypted with your computer&#039;s TPM2 key. This means that the message can only be decoded from this current computer (or more precisely, the same TPM2 chip that encoded it).&lt;br /&gt;
&lt;br /&gt;
 # echo &amp;quot;eyJhbGciOiJkaXIiLCJjbGV2aXMiOnsicGluIjoidHBtMiIsInRwbTIiOnsiaGFzaCI6InNoYTI1NiIsImp3a19wcml2IjoiQU80QUlETDZOQlp1dFktZUg2YjdNUUFtazNxNE5MTGRDYWFrM2tJUHBsOWtRUmlxQUJEaFFGSks0MWVWQXMtUElKbmsxUW9MS0hVVnhoQmM5RVlZZ1hfc1MzaS1EYUQ1aXZQdmZybUxSY25TZGxYRWtvSE1qN0lMekFvY29ZQ2FnRGNxczBYcVFCRkhqTkxFaW5PM3NySjAxTlo3QkExX2tnR0t1THVISC1pVUpESGZNQklnUFFsMzUyb3dSeFdPVUhuWnFiRk5rTU9WekVRS1ZTYUlUUlZtMEhnZHEwTWtpYV9HSjB2bGFXYkJtUE45SU1weGZXTTU3dGdGSnBRYXBobkNoZUsyLUkzeHNnY01rb2N3eUNnTzRZUnlZOXcxZGx4aVhxYURoc0xpcnJMV3E3SFFuZkRCVXlvU2hTWC0iLCJqd2tfcHViIjoiQUM0QUNBQUxBQUFFMGdBQUFCQUFJTlBYYkNWd3BNRUVnUkRGVF9VVVZ6c3Flb3dpWW5PSEZiVmZfV3ZHTUFTOCIsImtleSI6ImVjYyJ9fSwiZW5jIjoiQTI1NkdDTSJ9..F117H8zDNXxuOzxr.KCPhBegjQRx3Sv6uFg.yC9EbXhI8twv48oohl3KOw&amp;quot; | clevis decrypt tpm2 &#039;{}&#039;&lt;br /&gt;
&lt;br /&gt;
 hello, world&lt;br /&gt;
&lt;br /&gt;
== Encrypt a LUKS volume ==&lt;br /&gt;
&lt;br /&gt;
{{Warning|Remember to add a backup password in case TPM unlocking fails using:&lt;br /&gt;
&lt;br /&gt;
 # cryptsetup luksAddKey /dev/sda1&lt;br /&gt;
&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Use the following command to bind a LUKS volume to your TPM:&lt;br /&gt;
&lt;br /&gt;
 # clevis luks bind -d /dev/sda1 tpm2 &#039;{}&#039;&lt;br /&gt;
&lt;br /&gt;
The {{ic|&#039;{}&#039;|}} contains the configuration. For example, you can use the following command to seal the LUKS key against UEFI settings AND the [[Secure Boot]] policy, meaning clevis will be unable to unlock the device if either the UEFI settings changes or the SecureBoot keys are changed, and you&#039;ll need to rebind the volume after inputting your backup password&lt;br /&gt;
&lt;br /&gt;
 &#039;{&amp;quot;pcr_ids&amp;quot;:&amp;quot;1,7&amp;quot;}&#039;&lt;br /&gt;
&lt;br /&gt;
See {{ic|&#039;man 1 clevis-encrypt-tpm2&#039;|}} for all possible configuration options.&lt;br /&gt;
&lt;br /&gt;
== mkinitfs hook ==&lt;br /&gt;
&lt;br /&gt;
After binding your LVM volume to your TPM, you may wish for it to be unlocked automatically when your device boots. Currently, this process is a bit tedious, but will hopefully be improved in the future.&lt;br /&gt;
&lt;br /&gt;
=== mkinitfs feature ===&lt;br /&gt;
&lt;br /&gt;
First, create the following files with the following content. They allow all the kernel modules and files needed to unlock LUKS devices with the TPM to be copied to the initramfs.&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/mkinitfs/features.d/clevis-tpm.modules|kernel/drivers/char/tpm&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/mkinitfs/features.d/clevis-tpm.files|/bin/bash&lt;br /&gt;
/usr/bin/clevis&lt;br /&gt;
/usr/bin/clevis-decrypt&lt;br /&gt;
/usr/bin/clevis-decrypt-tpm2&lt;br /&gt;
/usr/bin/clevis-luks-unlock&lt;br /&gt;
/usr/bin/clevis-luks-common-functions&lt;br /&gt;
/usr/bin/jose&lt;br /&gt;
/usr/bin/tpm2_createprimary&lt;br /&gt;
/usr/bin/tpm2_unseal&lt;br /&gt;
/usr/bin/tpm2_load&lt;br /&gt;
/usr/bin/tpm2_flushcontext&lt;br /&gt;
/usr/lib/libjansson.so.4&lt;br /&gt;
/usr/lib/libjose.so.0&lt;br /&gt;
/usr/lib/libtss2-tcti-device.so.0&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Then, add the &amp;lt;code&amp;gt;clevis-tpm&amp;lt;/code&amp;gt; feature to {{path|/etc/mkinitfs/mkinitfs.conf}}:&lt;br /&gt;
&lt;br /&gt;
 features=&amp;quot;ata base cdrom ext4 keymap kms mmc nvme raid scsi usb virtio &#039;&#039;&#039;clevis-tpm&#039;&#039;&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forgot to regenerate your initramfs&lt;br /&gt;
&lt;br /&gt;
 # apk fix kernel-hooks&lt;br /&gt;
&lt;br /&gt;
=== init script ===&lt;br /&gt;
&lt;br /&gt;
Now, everything that&#039;s needed to unbind the LUKS device with the TPM is now included in the initramfs. All that&#039;s needed is to actually unlock the device in the initramfs. Since [https://gitlab.alpinelinux.org/alpine/mkinitfs/-/issues/18 it&#039;s currently not possible to run custom scripts in the init], you will need to manually edit the init and allow it to decrypt the disk with clevis if possible.&lt;br /&gt;
&lt;br /&gt;
{{Warning|This part of the guide has not been tested yet. You have been warned!}}&lt;br /&gt;
&lt;br /&gt;
Edit the file {{path|/usr/share/mkinitfs/initramfs-init}}, and replace the text:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [ -n &amp;quot;$KOPT_cryptroot&amp;quot; ]; then&lt;br /&gt;
	cryptopts=&amp;quot;-c ${KOPT_cryptroot}&amp;quot;&lt;br /&gt;
	if [ &amp;quot;$KOPT_cryptdiscards&amp;quot; = &amp;quot;yes&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -D&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ -n &amp;quot;$KOPT_cryptdm&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -m ${KOPT_cryptdm}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ -n &amp;quot;$KOPT_cryptheader&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -H ${KOPT_cryptheader}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ -n &amp;quot;$KOPT_cryptoffset&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -o ${KOPT_cryptoffset}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ &amp;quot;$KOPT_cryptkey&amp;quot; = &amp;quot;yes&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -k /crypto_keyfile.bin&amp;quot;&lt;br /&gt;
	elif [ -n &amp;quot;$KOPT_cryptkey&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -k ${KOPT_cryptkey}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And replace it with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if [ -n &amp;quot;$KOPT_cryptroot&amp;quot; ]; then&lt;br /&gt;
	cryptopts=&amp;quot;-c ${KOPT_cryptroot}&amp;quot;&lt;br /&gt;
	clevisopts=&amp;quot;-d ${KOPT_cryptroot}&amp;quot;&lt;br /&gt;
	if [ &amp;quot;$KOPT_cryptdiscards&amp;quot; = &amp;quot;yes&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -D&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ -n &amp;quot;$KOPT_cryptdm&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -m ${KOPT_cryptdm}&amp;quot;&lt;br /&gt;
		clevisopts=&amp;quot;-n ${KOPT_cryptopts}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ -n &amp;quot;$KOPT_cryptheader&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -H ${KOPT_cryptheader}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ -n &amp;quot;$KOPT_cryptoffset&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -o ${KOPT_cryptoffset}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
	if [ &amp;quot;$KOPT_cryptkey&amp;quot; = &amp;quot;yes&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -k /crypto_keyfile.bin&amp;quot;&lt;br /&gt;
	elif [ -n &amp;quot;$KOPT_cryptkey&amp;quot; ]; then&lt;br /&gt;
		cryptopts=&amp;quot;$cryptopts -k ${KOPT_cryptkey}&amp;quot;&lt;br /&gt;
	fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
if [ -n &amp;quot;$clevisopts&amp;quot; ]; then&lt;br /&gt;
  clevis luks unlock $clevisopts&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/latchset/clevis/ Project homepage]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Clevis Clevis on ArchWiki]&lt;br /&gt;
* [https://github.com/latchset/clevis/blob/master/src/initramfs-tools/hooks/clevis.in clevis initramfs-tools hook]&lt;br /&gt;
* [https://github.com/kishorv06/arch-mkinitcpio-clevis-hook mkinitcpio-clevis-hook&#039;s homepage]&lt;/div&gt;</summary>
		<author><name>Vixalien</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Diskless_Mode&amp;diff=27730</id>
		<title>Diskless Mode</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Diskless_Mode&amp;diff=27730"/>
		<updated>2024-11-05T15:34:52Z</updated>

		<summary type="html">&lt;p&gt;Vixalien: Expanded a bit on diskless mode&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In Diskless mode, the entire operating system with all applications are first loaded into RAM and then only run from there. This is also the method used to boot the Alpine Linux &amp;lt;Code&amp;gt;iso&amp;lt;/Code&amp;gt; installation media. Alpine Linux can be installed and configured so that the system continue to boot like this if &amp;quot;disk=none&amp;quot; is specified while running the &amp;lt;code&amp;gt;[[Alpine_setup_scripts#setup-alpine|setup-alpine]]&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
The mode is extremely fast and can save on unnecessary disk spin-ups, power, and wear and suitable for servers. It is similar to what other linux distributions may call a &amp;quot;frugal&amp;quot; install or boot using a &amp;quot;toram&amp;quot; option.&lt;br /&gt;
&lt;br /&gt;
You can continue using your [[Installation#Preparing_installation_media|installation media]] as a [[#Boot Device|boot device]] without installing alpine to the device&#039;s internal disk, but it is also possible to install Alpine Linux to a device&#039;s internal disk and configure it so that it boots into &amp;quot;diskless mode&amp;quot;  .&lt;br /&gt;
&lt;br /&gt;
== Apkovl ==&lt;br /&gt;
{{Seealso|Alpine local backup}}&lt;br /&gt;
&lt;br /&gt;
When you boot an alpine installation into diskless mode, it will initialize a fresh new root (&amp;lt;Code&amp;gt;/&amp;lt;/Code&amp;gt;) and any customisations you make (such as changing the password, adding users, etc.) will be lost when you reboot. However, any custom configurations may be preserved or &amp;quot;persist&amp;quot; across reboots by using the Alpine Linux tool named &amp;lt;code&amp;gt;[[Alpine_local_backup|Local Backup Utility]](lbu)&amp;lt;/code&amp;gt;. The initial and possibly read-only installation media can remain the only boot device for the &amp;quot;diskless&amp;quot; system by saving the running state to an [[#Apkovl|&amp;lt;Code&amp;gt;.apkovl&amp;lt;/Code&amp;gt;]] file, and have these automatically loaded when booting from the boot device.&lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;Apkovl&#039;&#039;&#039; (APK Overlay file) is a file used for storing local configuration state when running Alpine Linux in [[Diskless Mode]]. It stores all configuration files that have changed from the default ones. The filename is &amp;lt;Code&amp;gt;&amp;lt;hostname&amp;gt;.apkovl.tar.gz&amp;lt;/Code&amp;gt; and is stored in a location whose path is defined in {{Path|/etc/lbu/lbu.conf}}. The contents from the Apkovl file are overlaid on top of the contents of the apks that are loaded on boot.&lt;br /&gt;
&lt;br /&gt;
The backup tool &amp;lt;code&amp;gt;[[Alpine_local_backup|lbu]]&amp;lt;/code&amp;gt; enables committing and reverting local configuration system state by using &#039;&#039;&#039;.apkovl&#039;&#039;&#039; files that are saved to a backup location and loaded when booting. In Diskless mode, for every change made to the running system to persist across reboot, the command &amp;lt;code&amp;gt;[[Alpine_local_backup|lbu commit]]&amp;lt;/code&amp;gt; must be issued before rebooting the system to update the .apkovl file.&lt;br /&gt;
&lt;br /&gt;
== Local Package Cache ==&lt;br /&gt;
&lt;br /&gt;
When Alpine Linux boots in Diskless Mode, the remote repositories will not be available until after networking has started. That means extra packages newer not in your local boot media would not be available after a reboot, unless they were made to persistent [[Alpine_Package_Keeper#Local_Cache|local package cache]] available on a local, writable, storage device. The local package cache can be stored on the same partition as the .apkovl file.&lt;br /&gt;
&lt;br /&gt;
== Installation  ==&lt;br /&gt;
{{Seealso|Create_a_Bootable_Device}}&lt;br /&gt;
&lt;br /&gt;
Alpine Linux setup script &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; uses &amp;lt;code&amp;gt;[[Alpine_setup_scripts#setup-lbu|setup-lbu]]&amp;lt;/code&amp;gt; script to save the config and package cache to any available writable filesystem on any media other than the read-only [[Installation#Preparing_installation_media|installation media]].&lt;br /&gt;
&lt;br /&gt;
Due to Bug: [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/issues/10473 #10473] storing local configs and package cache on &#039;&#039;&#039;internal disks&#039;&#039;&#039; requires manual steps, i.e making an entry in {{Path|/etc/fstab}}, create mountpoint, and mount the partition before running &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
# In this case, boot the target diskless system from the [[Installation#Preparing_installation_media|installation media]] and do not proceed after the [[Installation#Boot_Process|boot process]] stage. &lt;br /&gt;
# If necessary partition(s) are unavailable, manually [[Setting_up_disks_manually#Creating_partitions|create]] a partition using &amp;lt;Code&amp;gt;fdisk&amp;lt;/Code&amp;gt;. In the below steps, we will use /dev/sdXY as partition number. Adjust the partition identifier as per the output of {{Codeline|&amp;lt;Code&amp;gt;blkid&amp;lt;/Code&amp;gt;}}&amp;lt;br&amp;gt;&lt;br /&gt;
#* Due to Bug: {{Issue|11589|The APKOVL loading of diskless setups doesn&#039;t work on btrfs and xfs filesystems, or nvme-based devices}}. So use only ext4 filesystem partitions on classic drives to store diskless mode states.&lt;br /&gt;
#*  mkfs.ext4 creates ext4 filesystem with 64bit feature enabled by default, but extlinux may not be able to boot with that due to Issue {{Issue|14895}}. You may need to add &amp;quot;-O ^64bit&amp;quot; to mkfs.ext4 to circumvent this. The below command creates an ext4 partition with disabled journaling, to reduce write operations and allow the disk to spin down after the .apkovl and the packages have been read from the partition during the boot. Install package {{pkg|&amp;lt;Code&amp;gt;e2fsprogs&amp;lt;/code&amp;gt;}} using command {{Codeline|&amp;lt;Code&amp;gt;apk add e2fsprogs&amp;lt;/Code&amp;gt;}}, if the command &amp;lt;Code&amp;gt;mkfs.ext4&amp;lt;/Code&amp;gt; is not available.&lt;br /&gt;
#: {{Cmd|mkfs.ext4 -O ^has_journal,^64bit /dev/sdXY}}&lt;br /&gt;
# Due to a [https://gitlab.alpinelinux.org/alpine/mkinitfs/-/issues/5 bug], the partition can not be mounted to /boot. Configure the /etc/fstab to mount the writable partition to /media/sdXY instead of /boot i.e. conforming to the hot/cold-plug mountpoints. &lt;br /&gt;
#: {{Cmd|mkdir /media/sdXY}}&lt;br /&gt;
#: {{cmd|echo &amp;quot;/dev/sdXY /media/sdXY ext4 noatime,ro 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab}}&lt;br /&gt;
&amp;lt;!-- Mounting read-only is possible, because the [[Alpine_local_backup|lbu tools]] can temporarily remount it writable for their operation. --&amp;gt;&lt;br /&gt;
# Mount the partitions listed in {{Path|/etc/fstab}}. &lt;br /&gt;
#: {{Cmd|&amp;lt;code&amp;gt;mount -a&amp;lt;/code&amp;gt;}} Look at the output of {{Codeline|&amp;lt;code&amp;gt;mount&amp;lt;/code&amp;gt;}} to verify that the changes have been applied correctly.&amp;lt;br&amp;gt;&lt;br /&gt;
# If &amp;lt;code&amp;gt;Setup-alpine&amp;lt;/code&amp;gt; has not run before, follow the [[Installation#Installation_Step_Details|Installation steps]] to complete the [[Installation#Base_configuration|base configuration]]. The above changes 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.&lt;br /&gt;
# If &amp;lt;code&amp;gt;Setup-alpine&amp;lt;/code&amp;gt; has already been used to configure the diskless system, the storage settings may be modified directly with&lt;br /&gt;
#: {{cmd|setup-lbu sdXY}} &lt;br /&gt;
# [[Alpine_Package_Keeper#Local_Cache|Local package cache]] can be enabled as follows:&lt;br /&gt;
#: {{cmd|mkdir /media/sdXY/cache}} &lt;br /&gt;
#: {{cmd|setup-apkcache /media/sdXY/cache}}&lt;br /&gt;
# If the partition is large enough, it can be useful to edit {{Path|lbu.conf}} to uncomment and set {{Codeline|BACKUP_LIMIT{{=}}3}}. For example, to allow reverting to a previous, working state if needed. &lt;br /&gt;
#: {{cmd|apk add nano}}&lt;br /&gt;
#: {{cmd|nano /etc/lbu/lbu.conf }}&lt;br /&gt;
# Finally, generate the first .apkovl file containing all the previous changes 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;
#: {{cmd|lbu commit}}&lt;br /&gt;
# From now 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;.&lt;br /&gt;
&lt;br /&gt;
== Boot Device == &lt;br /&gt;
&lt;br /&gt;
{{Main|Create a Bootable Device}}&lt;br /&gt;
&lt;br /&gt;
The initial ISO9660 filesystem based read-only [[Installation#Preparing_installation_media|installation media]] may remain the only boot device for the newly configured Alpine Linux &#039;&#039;&#039;Diskless&#039;&#039;&#039; system. &lt;br /&gt;
&lt;br /&gt;
Alpine Linux running Diskless mode can also boot from a partition with a writable filesystem on USB-Stick/CompactFlash/SDCard or SSD/NVMe harddisk. This boot device is known as [[Create_a_Bootable_Device|customizable boot device]] to differentiate against [[Installation#Preparing_installation_media|installation media]]. Local customizations like apkovl files and cached packages can be stored in this customizable boot device, which also allows to upgrade the kernel with its modules and firmware with the &amp;lt;code&amp;gt;update-kernel&amp;lt;/Code&amp;gt; script.&lt;br /&gt;
&lt;br /&gt;
== Loading apkovl from webserver ==&lt;br /&gt;
&lt;br /&gt;
Alpine&#039;s &amp;quot;diskless mode&amp;quot; ISO boot images support boot parameters to load customizations files i.e  [[Alpine_local_backup#Creating_and_saving_an_apkovl_from_a_remote_host|apkovl from a webserver]]. &lt;br /&gt;
&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. 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;
&lt;br /&gt;
== Upgrading a Diskless System ==&lt;br /&gt;
&lt;br /&gt;
When Alping Linux runs in &amp;quot;diskless&amp;quot; or &amp;quot;data&amp;quot; disk mode, Upgrading requires few extra steps in addition to the regular [[Alpine_Package_Keeper#Upgrade_a_Running_System|upgrade steps]].&lt;br /&gt;
&lt;br /&gt;
If booting a &amp;quot;diskless&amp;quot; system from a read-only device, or as an 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;
For [[Create_a_Bootable_Device|customizable boot device]], It is possible to update the boot files. 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 [[Btrfs|btrfs]] 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;
== Kernel Options ==&lt;br /&gt;
&lt;br /&gt;
Documentation about kernel command line options regarding diskless mode will be available after installing the documentation sub-package {{Pkg|mkinitfs-doc}}:  &lt;br /&gt;
&lt;br /&gt;
{{Cmd|man mkinitfs-bootparam}} &amp;lt;Pre&amp;gt;&lt;br /&gt;
       If no root= parameter is given, the initramfs will build a live system&lt;br /&gt;
       in memory from scratch. This is also called diskless mode.&lt;br /&gt;
&lt;br /&gt;
       When booting in diskless mode, the following options are also&lt;br /&gt;
       available:&lt;br /&gt;
&lt;br /&gt;
       alpine_repo=(URL | PATH)&lt;br /&gt;
              If set, /etc/apk/repositories will be filled with this. May be a&lt;br /&gt;
              comma-separated list of URLs.&lt;br /&gt;
&lt;br /&gt;
       apkovl=(URL | [DEVICE[:FS_TYPE]:]PATH)&lt;br /&gt;
              A HTTP, HTTPS or FTP URL to an apkovl.tar.gz file which will be&lt;br /&gt;
              retrieved and applied. Can also be a filesystem path, optionally&lt;br /&gt;
              prepended with the device name without the /dev/ prefix.&lt;br /&gt;
&lt;br /&gt;
       autodetect_serial=no&lt;br /&gt;
              Disable automatic detection and setup of serial console.&lt;br /&gt;
&lt;br /&gt;
       ds=OPTIONS&lt;br /&gt;
              Data source for tiny-cloud. If OPTIONS starts with nocloud,&lt;br /&gt;
              tiny-cloud will be enabled.&lt;br /&gt;
&lt;br /&gt;
       nokeep_apk_new&lt;br /&gt;
              Setup a fresh system, ignore any apkovl.&lt;br /&gt;
&lt;br /&gt;
       pkgs=PACKAGE{,PACKAGE}&lt;br /&gt;
              Comma-separated list of packages to be installed.&lt;br /&gt;
       ssh_key=(URL | SSH_KEY)&lt;br /&gt;
              This setting installs openssh and places the public key given as&lt;br /&gt;
              value in /root/.ssh/authorized_keys.  If the value is an HTTP or&lt;br /&gt;
              FTP url, its fetches the key(s) from there.&lt;br /&gt;
&lt;br /&gt;
       splash Enable splash screen.&lt;br /&gt;
&lt;br /&gt;
       usbdelay=NUMBER&lt;br /&gt;
              Wait NUMBER seconds for USB devices to show up before searching&lt;br /&gt;
              for boot media.&lt;br /&gt;
&lt;br /&gt;
       wireguard=INTERFACE;IP_ADDRESS{,IP_ADDRESS,...}[;WG_CONFIG_FILE]&lt;br /&gt;
              Set up a wireguard interface named INTERFACE with the addresses&lt;br /&gt;
              IP_ADDRESS and use /etc/wireguard/initrd.conf or WG_CONFIG_FILE&lt;br /&gt;
              as a classic wg (not wg-quick) config.&lt;br /&gt;
&lt;br /&gt;
       zfs_force=NUMBER&lt;br /&gt;
              Enable force importing the root zpool on boot, even if it was&lt;br /&gt;
              previously mounted from a different system/OS.&lt;br /&gt;
&amp;lt;/Pre&amp;gt;&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Alpine_local_backup|Alpine Local backup Utility - &#039;&#039;lbu&#039;&#039;&#039;]]&lt;br /&gt;
* [[Alpine_Package_Keeper#Local_Cache|Local package cache]]&lt;br /&gt;
* [[Manually editing a existing apkovl]]&lt;br /&gt;
* [[Back Up a Flash Memory Installation]]&lt;br /&gt;
* [[Upgrading_Alpine#Upgrading_Alpine_Linux_on_other_removable_media_(such_as_CF/USB)|Upgrading Diskless to New Alpine Linux Release]]&lt;br /&gt;
* [[PXE boot#Specifying an apkovl|Diskless PXE Boot]]&lt;br /&gt;
* [[How to make a custom ISO image with mkimage]]&lt;br /&gt;
* [[QEMU#Live_mode|QEMU Diskless example]] &lt;br /&gt;
* [[Alpine local backup#Include special files.2Ffolders to the apkovl|Include special files section]] - To include custom files outside of &amp;lt;code&amp;gt;/etc&amp;lt;/code&amp;gt; in .apkovl file.&lt;br /&gt;
&lt;br /&gt;
[[Category:Diskless]] [[Category:LBU]]&lt;/div&gt;</summary>
		<author><name>Vixalien</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=MDNS&amp;diff=27317</id>
		<title>MDNS</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=MDNS&amp;diff=27317"/>
		<updated>2024-09-13T15:51:24Z</updated>

		<summary type="html">&lt;p&gt;Vixalien: Add setup instructions for NetworkManager and dnsmasq&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:mDNS}}&lt;br /&gt;
[https://en.wikipedia.org/wiki/Multicast_DNS Multicast DNS] is a protocol that is normally used for the discovery of printers. It is implemented by Avahi, but more setup is needed for the regular name resolution to see the results.&lt;br /&gt;
&lt;br /&gt;
== Setup avahi ==&lt;br /&gt;
&lt;br /&gt;
Install, enable and start avahi with:&lt;br /&gt;
&lt;br /&gt;
{{cmd|doas apk add {{pkg|avahi}}&lt;br /&gt;
doas rc-update add avahi-daemon&lt;br /&gt;
doas rc-service avahi-daemon start}}&lt;br /&gt;
&lt;br /&gt;
It should now be possible to browse results. To look for a printer, use:&lt;br /&gt;
&lt;br /&gt;
{{cmd|doas apk add {{pkg|avahi-tools}}&lt;br /&gt;
avahi-browse --resolve --terminate  _ipp._tcp}}&lt;br /&gt;
&lt;br /&gt;
Make note of the hostname, as we will use it afterwards.&lt;br /&gt;
&lt;br /&gt;
== Setup avahi2dns ==&lt;br /&gt;
&lt;br /&gt;
Name resolution is implemented by musl, and it only supports DNS, so we have to map the avahi results to a regular DNS server. This is done by avahi2dns.&lt;br /&gt;
&lt;br /&gt;
{{cmd|doas apk add {{pkg|avahi2dns}}}}&lt;br /&gt;
&lt;br /&gt;
since we will want a full DNS server running at port 53, we need to configure avahi2dns to use another port. This is done by default with {{path|/etc/conf.d/avahi2dns}} containing:&lt;br /&gt;
&lt;br /&gt;
  command_args=&amp;quot;-p 5354&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Enable and start avahi2dns with&lt;br /&gt;
&lt;br /&gt;
{{cmd|doas rc-update add avahi2dns&lt;br /&gt;
doas rc-service avahi2dns start}}&lt;br /&gt;
&lt;br /&gt;
It should now be possible to use DNS to query the address of the printer.&lt;br /&gt;
&lt;br /&gt;
{{cmd|drill -p 5354 @127.0.0.1 &amp;lt;printer_name&amp;gt;.local}}&lt;br /&gt;
&lt;br /&gt;
Where printer_name is the hostname given by avahi-browse.&lt;br /&gt;
&lt;br /&gt;
== Setup Networkmanager ==&lt;br /&gt;
&lt;br /&gt;
If you are already using networkmanager, you can leverage {{pkg|dnsmasq}} as your DNS server which can easily forward mDNS requests to another server.&lt;br /&gt;
&lt;br /&gt;
Install the {{pkg|networkmanager-dnsmasq}} package:&lt;br /&gt;
&lt;br /&gt;
{{cmd|doas apk add {{pkg|networkmanager-dnsmasq}}}}&lt;br /&gt;
&lt;br /&gt;
Configure networkmanager to use dnsmasq as it&#039;s dns server by editing {{path|/etc/NetworkManager/NetworkManager.conf}}&lt;br /&gt;
&lt;br /&gt;
  [main] &lt;br /&gt;
  dhcp=internal&lt;br /&gt;
  dns=dnsmasq&lt;br /&gt;
&lt;br /&gt;
Then we need to tell dnsmasq to forward all mDNS queries to avahidns {{path|/etc/NetworkManager/dnsmasq.d/mdns.conf}}:&lt;br /&gt;
&lt;br /&gt;
  # Forward queries for the &amp;quot;local&amp;quot; domain to 127.0.0.1 port 5354&lt;br /&gt;
  server=/local/127.0.0.1#5354&lt;br /&gt;
&lt;br /&gt;
Restart networkmanager:&lt;br /&gt;
&lt;br /&gt;
{{cmd|doas rc-service networkmanager restart}}&lt;br /&gt;
&lt;br /&gt;
== Without NetworkManager ==&lt;br /&gt;
&lt;br /&gt;
=== Setup DNS resolver ===&lt;br /&gt;
&lt;br /&gt;
If you are not using NetworkManager, you will need to setup a DNS resolver that will forward request of .local domain to avahi2dns and handle other requests normally. There is more than one way to do it, but we document an option that is probably most convenient for a laptop: using the DHCP provided server for the regular DNS requests. We will use unbound as the server and resolvconf to inform unbound about the DHCP results.&lt;br /&gt;
&lt;br /&gt;
Install the programs:&lt;br /&gt;
&lt;br /&gt;
{{cmd|doas apk add {{pkg|openresolv}} {{pkg|unbound}}}}&lt;br /&gt;
&lt;br /&gt;
Create {{path|/etc/resolvconf.conf}}:&lt;br /&gt;
&lt;br /&gt;
  name_servers=127.0.0.1&lt;br /&gt;
  unbound_conf=/etc/unbound/unbound.conf.d/resolvconf.conf&lt;br /&gt;
&lt;br /&gt;
This tells resolveconf to use a local nameserver and pass the DHCP provided DNS server to unbound&lt;br /&gt;
&lt;br /&gt;
Create {{path|/etc/unbound/unbound.conf.d/avahi-local.conf}}:&lt;br /&gt;
&lt;br /&gt;
  forward-zone:&lt;br /&gt;
        name: &amp;quot;local&amp;quot;&lt;br /&gt;
        forward-addr: 127.0.0.1@5354&lt;br /&gt;
  server:&lt;br /&gt;
        do-not-query-localhost: no&lt;br /&gt;
        domain-insecure: &amp;quot;local&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This reads the information provided by resolvconf, but forwards .local requests to avahi2dns. We also need to disable dnssec for .local and tell unbound that it is OK to query localhost.&lt;br /&gt;
&lt;br /&gt;
Enable and start unbound&lt;br /&gt;
&lt;br /&gt;
{{cmd|doas rc-update add unbound&lt;br /&gt;
doas rc-service unbound start}}&lt;br /&gt;
&lt;br /&gt;
=== Setup DHCP client ===&lt;br /&gt;
&lt;br /&gt;
How send the DHCP provided DNS to resolvconf depends on the DHCP client being used.&lt;br /&gt;
&lt;br /&gt;
==== udhcpc ====&lt;br /&gt;
&lt;br /&gt;
This is the DHCP client in busybox, and will work for both wired and wireless interfaces. &lt;br /&gt;
&lt;br /&gt;
Create {{path|/etc/udhcpc/udhcpc.conf}}:&lt;br /&gt;
&lt;br /&gt;
  RESOLV_CONF=&amp;quot;/etc/udhcpc-resolv.conf&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Create {{path|/etc/udhcpc/post-bound/resolvconf}}:&lt;br /&gt;
&lt;br /&gt;
  #!/bin/sh&lt;br /&gt;
  cat /etc/udhcpc-resolv.conf | resolvconf -a $interface&lt;br /&gt;
&lt;br /&gt;
and make it executable&lt;br /&gt;
&lt;br /&gt;
{{cmd|chmod 755 /etc/udhcpc/post-bound/resolvconf}}&lt;br /&gt;
&lt;br /&gt;
An inconvenience of this setup is that udhcpc will not reconfigure the interface when connecting to other wifi networks. For that to happen one has to run&lt;br /&gt;
&lt;br /&gt;
{{cmd|iwctl station wlan0 connect &amp;lt;network_name&amp;gt;&lt;br /&gt;
doas kill -USR2 $(cat  /run/udhcpc.wlan0.pid)&lt;br /&gt;
doas kill -USR1 $(cat  /run/udhcpc.wlan0.pid)}}&lt;br /&gt;
&lt;br /&gt;
==== iwd ====&lt;br /&gt;
&lt;br /&gt;
To avoid having to manually reconfigure the wifi interface, we can configure iwd to use DHCP internally and forward DNS server info to resolveconf. To do that create {{path|/etc/iwd/main.conf}}:&lt;br /&gt;
&lt;br /&gt;
  [General]&lt;br /&gt;
  EnableNetworkConfiguration=True&lt;br /&gt;
&lt;br /&gt;
  [Network]&lt;br /&gt;
  NameResolvingService=resolvconf&lt;br /&gt;
&lt;br /&gt;
== Test the setup ==&lt;br /&gt;
&lt;br /&gt;
You should now be able to query for both the printer address and regular addresses with&lt;br /&gt;
&lt;br /&gt;
{{cmd|drill @127.0.0.1 &amp;lt;printer_name&amp;gt;.local&lt;br /&gt;
drill @127.0.0.1 alpinelinux.org}}&lt;br /&gt;
&lt;br /&gt;
Your {{path|/etc/resolv.conf}} should also contain&lt;br /&gt;
&lt;br /&gt;
  nameserver 127.0.0.1&lt;br /&gt;
&lt;br /&gt;
Printer discovery should now be working.&lt;br /&gt;
&lt;br /&gt;
[[Category:Networking]]&lt;/div&gt;</summary>
		<author><name>Vixalien</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:Flatpak&amp;diff=26457</id>
		<title>Talk:Flatpak</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:Flatpak&amp;diff=26457"/>
		<updated>2024-02-22T21:08:23Z</updated>

		<summary type="html">&lt;p&gt;Vixalien: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Guest09248, why did you delete the link to flatpak&#039;s page on alpine:* [https://flatpak.org/setup/Alpine/ Alpine Quick Setup. Follow these simple steps to start using Flatpak]&lt;br /&gt;
And other links. This information is valid alpine specific info and your edits appear to be vandalism.&lt;br /&gt;
[[User:Alpineuser|Alpineuser]] ([[User talk:Alpineuser|talk]]) 06:08, 8 December 2021 (UTC)&lt;br /&gt;
&lt;br /&gt;
:The page contains important information. Specifically, it also shows the packages to install for GNOME Software and KDE Discover --[[User:Vixalien|Vixalien]] ([[User talk:Vixalien|talk]]) 21:08, 22 February 2024 (UTC)&lt;/div&gt;</summary>
		<author><name>Vixalien</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:Directly_booting_an_ISO_file&amp;diff=26456</id>
		<title>Talk:Directly booting an ISO file</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:Directly_booting_an_ISO_file&amp;diff=26456"/>
		<updated>2024-02-22T03:11:14Z</updated>

		<summary type="html">&lt;p&gt;Vixalien: /* Ventoy */ new section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;::::: I&#039;ve given up. Couldn&#039;t make the intended setup work with my meager Linux knowledge. I did find a page here at the wiki, under the heading &#039;[[Replacing_non-Alpine_Linux_with_Alpine_remotely|Install Alpine cd-rom image on hard disk]]&#039; where a somewhat related solution is provided, but it involves extracting the distro files from the iso, something that [https://unetbootin.sourceforge.net/ unetbootin] does in a rather more easy and straightforward way -- at least, that&#039;s what I used to get Alpine to boot from a USB pendrive (plenty of recipes for that around). However, I still believe a simple &#039;boot from iso&#039; procedure could do wonders for Alpine, so I&#039;m leaving this here for future reference. Should anyone disagree, do feel free to delete. [[User:Pnin|Pnin]] 05:43, 8 February 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Current system is a 2.8 Prescott Pentium IV with 2MB RAM, booting from a 1GB CF plugged into the IDE interface, with an attached 500GB SATA HDD for data. When I tried to install Alpine from the LiveCD to this card, which is listed as a hard drive by the BIOS, it complained of insufficient space. Fair enough. Next I tried to follow [https://www.pendrivelinux.com/boot-multiple-iso-from-usb-via-grub2-using-linux/ this recipe] to boot from Alpine 2.1.4 iso. At the end, you find this tip:&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;Adding an Unlisted ISO: To try ISO Files that are not yet listed, use the existing menu entry examples in /boot/grub/grub.cfg and append any options normally found in the distribution&#039;s syslinux.cfg file on the &amp;quot;append&amp;quot; line, to the &amp;quot;linux&amp;quot; line of the menu entry.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
So I downloaded the latest Alpine iso via wget and modified the relevant &#039;&#039;grub.cfg&#039;&#039; lines to:&lt;br /&gt;
&lt;br /&gt;
 linux (loop)/boot/grsec initrd=/boot/grsec.gz iso-scan/filename=/alpine214.iso alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage quiet&lt;br /&gt;
 initrd (loop)/boot/grsec.gz&lt;br /&gt;
&lt;br /&gt;
All I got when I tried to boot this was the following error:&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;Alpine Init 2.1.2&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;/init: eval: line 1: syntax error: unexpected &amp;quot;(&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;kernel panic - not syncing: attempted to kill init!&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;Pid: 1, comm: init Not tainted 2.6.35.10-grsec #1-Alpine&#039;&#039;&#039;&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
I must say all went well with the Linux Mint 10.10 and the TinyCore isos, into which I&#039;m able to boot with no issues. Anyone care to advise?&lt;br /&gt;
&lt;br /&gt;
[[User:Pnin|Pnin]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hi, that &amp;quot;linux (loop)/boot/....&amp;quot; thing looks funny to me.&lt;br /&gt;
&lt;br /&gt;
According to: https://help.ubuntu.com/community/Grub2&lt;br /&gt;
&lt;br /&gt;
Could you try:&lt;br /&gt;
&lt;br /&gt;
 set root=(loop0)&lt;br /&gt;
 linux /boot/grsec initrd=/boot/grsec.gz iso-scan/filename=/alpine214.iso alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage quiet&lt;br /&gt;
 initrd /boot/grsec.gz&lt;br /&gt;
&lt;br /&gt;
[[User:Nangel|Nangel]] 13:49, 6 February 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hi &amp;amp; thanks, Nangel.&lt;br /&gt;
&lt;br /&gt;
Tried that and got this error:&lt;br /&gt;
&lt;br /&gt;
 error: no such disk.&lt;br /&gt;
 error: you need to load the kernel first.&lt;br /&gt;
 press any key to continue...&lt;br /&gt;
&lt;br /&gt;
Pressing any key returns to the grub menu. Maybe the full &#039;&#039;grub.cfg&#039;&#039; entry should be reported here:&lt;br /&gt;
&lt;br /&gt;
 menuentry &amp;quot;Alpine Linux&amp;quot; {&lt;br /&gt;
 loopback loop /alpine214.iso&lt;br /&gt;
 linux (loop)/boot/grsec initrd=/boot/grsec.gz iso-scan/filename=/alpine214.iso alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage quiet&lt;br /&gt;
 initrd (loop)/boot/grsec.gz&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It should also be noted that the LiveCD used to perform the [https://www.pendrivelinux.com/boot-multiple-iso-from-usb-via-grub2-using-linux/ recipe] was &amp;quot;Linux Mint 9 LXDE&amp;quot;, which caused Grub 1.98-1ubuntu5-1mint2 to be installed, not Grub2. And that (loop) part is present in every other successful menu entry.&lt;br /&gt;
&lt;br /&gt;
[EDIT: Just to add that IMHO coupled with the [[Alpine_local_backup|Alpine Local Backup Utility]] (lbu), booting from iso would be a killer feature for Alpine, making systems really easy to troubleshoot (delete local backup) and upgrade (replace iso).]&lt;br /&gt;
&lt;br /&gt;
[[User:Pnin|Pnin]] 14:34, 6 February 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Suppose alpine-extended-3.14.0-x86_64.iso is stored in directory boot in partition 1 on disk.&lt;br /&gt;
GRUB2 can be caused to load kernel and initramfs by entering:&lt;br /&gt;
&lt;br /&gt;
 grub&amp;gt; loopback lb /boot/alpine-extended-3.14.0-x86_64.iso&lt;br /&gt;
 grub&amp;gt; linux  (lb)/boot/vmlinuz-lts&lt;br /&gt;
 grub&amp;gt; initrd (lb)/boot/initramfs-lts&lt;br /&gt;
 grub&amp;gt; boot&lt;br /&gt;
&lt;br /&gt;
A menu entry for GRUB2 can be created with these statements.&lt;br /&gt;
&lt;br /&gt;
Initialising Alpine will then be aborted with messages:&lt;br /&gt;
&lt;br /&gt;
 Mounting boot media: failed&lt;br /&gt;
 initramfs emergency recovery shell launched. Type &#039;exit&#039; to continue boot&lt;br /&gt;
&lt;br /&gt;
To mount the filesystem where alpine-extended-3.14.0-x86_64.iso is stored, enter:&lt;br /&gt;
&lt;br /&gt;
 # mount /dev/sda1 /media/sda1&lt;br /&gt;
&lt;br /&gt;
To mount the ISO image, enter:&lt;br /&gt;
&lt;br /&gt;
 # mount -o loop -t iso9660 /media/sda1/boot/alpine-extended-3.14.0-x86_64.iso /media/cdrom&lt;br /&gt;
&lt;br /&gt;
Continue initialisation with:&lt;br /&gt;
&lt;br /&gt;
 # exit&lt;br /&gt;
&lt;br /&gt;
At last these messages will be displayed:&lt;br /&gt;
&lt;br /&gt;
 /lib/rc/sh/openrc-run.sh: eval: line 1: syntax error: unexpected &amp;quot;(&amp;quot;&lt;br /&gt;
 * ERROR: firstboot failed to start&lt;br /&gt;
&lt;br /&gt;
but login root works and Alpine can be configured using&lt;br /&gt;
&lt;br /&gt;
 # alpine-setup&lt;br /&gt;
&lt;br /&gt;
[[User:HGT|HGT]] 2021-07-08&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Ventoy ==&lt;br /&gt;
&lt;br /&gt;
This is now possible and easy using [https://wiki.archlinux.org/title/Ventoy Ventoy] --[[User:Vixalien|Vixalien]] ([[User talk:Vixalien|talk]]) 03:11, 22 February 2024 (UTC)&lt;/div&gt;</summary>
		<author><name>Vixalien</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:Directly_booting_an_ISO_file&amp;diff=26455</id>
		<title>Talk:Directly booting an ISO file</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:Directly_booting_an_ISO_file&amp;diff=26455"/>
		<updated>2024-02-22T03:10:31Z</updated>

		<summary type="html">&lt;p&gt;Vixalien: Undo revision 26454 by Vixalien (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;::::: I&#039;ve given up. Couldn&#039;t make the intended setup work with my meager Linux knowledge. I did find a page here at the wiki, under the heading &#039;[[Replacing_non-Alpine_Linux_with_Alpine_remotely|Install Alpine cd-rom image on hard disk]]&#039; where a somewhat related solution is provided, but it involves extracting the distro files from the iso, something that [https://unetbootin.sourceforge.net/ unetbootin] does in a rather more easy and straightforward way -- at least, that&#039;s what I used to get Alpine to boot from a USB pendrive (plenty of recipes for that around). However, I still believe a simple &#039;boot from iso&#039; procedure could do wonders for Alpine, so I&#039;m leaving this here for future reference. Should anyone disagree, do feel free to delete. [[User:Pnin|Pnin]] 05:43, 8 February 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Current system is a 2.8 Prescott Pentium IV with 2MB RAM, booting from a 1GB CF plugged into the IDE interface, with an attached 500GB SATA HDD for data. When I tried to install Alpine from the LiveCD to this card, which is listed as a hard drive by the BIOS, it complained of insufficient space. Fair enough. Next I tried to follow [https://www.pendrivelinux.com/boot-multiple-iso-from-usb-via-grub2-using-linux/ this recipe] to boot from Alpine 2.1.4 iso. At the end, you find this tip:&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;Adding an Unlisted ISO: To try ISO Files that are not yet listed, use the existing menu entry examples in /boot/grub/grub.cfg and append any options normally found in the distribution&#039;s syslinux.cfg file on the &amp;quot;append&amp;quot; line, to the &amp;quot;linux&amp;quot; line of the menu entry.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
So I downloaded the latest Alpine iso via wget and modified the relevant &#039;&#039;grub.cfg&#039;&#039; lines to:&lt;br /&gt;
&lt;br /&gt;
 linux (loop)/boot/grsec initrd=/boot/grsec.gz iso-scan/filename=/alpine214.iso alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage quiet&lt;br /&gt;
 initrd (loop)/boot/grsec.gz&lt;br /&gt;
&lt;br /&gt;
All I got when I tried to boot this was the following error:&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;Alpine Init 2.1.2&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;/init: eval: line 1: syntax error: unexpected &amp;quot;(&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;kernel panic - not syncing: attempted to kill init!&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;Pid: 1, comm: init Not tainted 2.6.35.10-grsec #1-Alpine&#039;&#039;&#039;&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
I must say all went well with the Linux Mint 10.10 and the TinyCore isos, into which I&#039;m able to boot with no issues. Anyone care to advise?&lt;br /&gt;
&lt;br /&gt;
[[User:Pnin|Pnin]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hi, that &amp;quot;linux (loop)/boot/....&amp;quot; thing looks funny to me.&lt;br /&gt;
&lt;br /&gt;
According to: https://help.ubuntu.com/community/Grub2&lt;br /&gt;
&lt;br /&gt;
Could you try:&lt;br /&gt;
&lt;br /&gt;
 set root=(loop0)&lt;br /&gt;
 linux /boot/grsec initrd=/boot/grsec.gz iso-scan/filename=/alpine214.iso alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage quiet&lt;br /&gt;
 initrd /boot/grsec.gz&lt;br /&gt;
&lt;br /&gt;
[[User:Nangel|Nangel]] 13:49, 6 February 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hi &amp;amp; thanks, Nangel.&lt;br /&gt;
&lt;br /&gt;
Tried that and got this error:&lt;br /&gt;
&lt;br /&gt;
 error: no such disk.&lt;br /&gt;
 error: you need to load the kernel first.&lt;br /&gt;
 press any key to continue...&lt;br /&gt;
&lt;br /&gt;
Pressing any key returns to the grub menu. Maybe the full &#039;&#039;grub.cfg&#039;&#039; entry should be reported here:&lt;br /&gt;
&lt;br /&gt;
 menuentry &amp;quot;Alpine Linux&amp;quot; {&lt;br /&gt;
 loopback loop /alpine214.iso&lt;br /&gt;
 linux (loop)/boot/grsec initrd=/boot/grsec.gz iso-scan/filename=/alpine214.iso alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage quiet&lt;br /&gt;
 initrd (loop)/boot/grsec.gz&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It should also be noted that the LiveCD used to perform the [https://www.pendrivelinux.com/boot-multiple-iso-from-usb-via-grub2-using-linux/ recipe] was &amp;quot;Linux Mint 9 LXDE&amp;quot;, which caused Grub 1.98-1ubuntu5-1mint2 to be installed, not Grub2. And that (loop) part is present in every other successful menu entry.&lt;br /&gt;
&lt;br /&gt;
[EDIT: Just to add that IMHO coupled with the [[Alpine_local_backup|Alpine Local Backup Utility]] (lbu), booting from iso would be a killer feature for Alpine, making systems really easy to troubleshoot (delete local backup) and upgrade (replace iso).]&lt;br /&gt;
&lt;br /&gt;
[[User:Pnin|Pnin]] 14:34, 6 February 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Suppose alpine-extended-3.14.0-x86_64.iso is stored in directory boot in partition 1 on disk.&lt;br /&gt;
GRUB2 can be caused to load kernel and initramfs by entering:&lt;br /&gt;
&lt;br /&gt;
 grub&amp;gt; loopback lb /boot/alpine-extended-3.14.0-x86_64.iso&lt;br /&gt;
 grub&amp;gt; linux  (lb)/boot/vmlinuz-lts&lt;br /&gt;
 grub&amp;gt; initrd (lb)/boot/initramfs-lts&lt;br /&gt;
 grub&amp;gt; boot&lt;br /&gt;
&lt;br /&gt;
A menu entry for GRUB2 can be created with these statements.&lt;br /&gt;
&lt;br /&gt;
Initialising Alpine will then be aborted with messages:&lt;br /&gt;
&lt;br /&gt;
 Mounting boot media: failed&lt;br /&gt;
 initramfs emergency recovery shell launched. Type &#039;exit&#039; to continue boot&lt;br /&gt;
&lt;br /&gt;
To mount the filesystem where alpine-extended-3.14.0-x86_64.iso is stored, enter:&lt;br /&gt;
&lt;br /&gt;
 # mount /dev/sda1 /media/sda1&lt;br /&gt;
&lt;br /&gt;
To mount the ISO image, enter:&lt;br /&gt;
&lt;br /&gt;
 # mount -o loop -t iso9660 /media/sda1/boot/alpine-extended-3.14.0-x86_64.iso /media/cdrom&lt;br /&gt;
&lt;br /&gt;
Continue initialisation with:&lt;br /&gt;
&lt;br /&gt;
 # exit&lt;br /&gt;
&lt;br /&gt;
At last these messages will be displayed:&lt;br /&gt;
&lt;br /&gt;
 /lib/rc/sh/openrc-run.sh: eval: line 1: syntax error: unexpected &amp;quot;(&amp;quot;&lt;br /&gt;
 * ERROR: firstboot failed to start&lt;br /&gt;
&lt;br /&gt;
but login root works and Alpine can be configured using&lt;br /&gt;
&lt;br /&gt;
 # alpine-setup&lt;br /&gt;
&lt;br /&gt;
[[User:HGT|HGT]] 2021-07-08&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Vixalien</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:Directly_booting_an_ISO_file&amp;diff=26454</id>
		<title>Talk:Directly booting an ISO file</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:Directly_booting_an_ISO_file&amp;diff=26454"/>
		<updated>2024-02-22T03:04:26Z</updated>

		<summary type="html">&lt;p&gt;Vixalien: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is now easily possible with [https://wiki.archlinux.org/title/Ventoy Ventoy]. I use it all the time!&lt;br /&gt;
&lt;br /&gt;
[[User:Vixalien|Vixalien]] 05:02, 22 February 2023 (GMT+2)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
::::: I&#039;ve given up. Couldn&#039;t make the intended setup work with my meager Linux knowledge. I did find a page here at the wiki, under the heading &#039;[[Replacing_non-Alpine_Linux_with_Alpine_remotely|Install Alpine cd-rom image on hard disk]]&#039; where a somewhat related solution is provided, but it involves extracting the distro files from the iso, something that [https://unetbootin.sourceforge.net/ unetbootin] does in a rather more easy and straightforward way -- at least, that&#039;s what I used to get Alpine to boot from a USB pendrive (plenty of recipes for that around). However, I still believe a simple &#039;boot from iso&#039; procedure could do wonders for Alpine, so I&#039;m leaving this here for future reference. Should anyone disagree, do feel free to delete. [[User:Pnin|Pnin]] 05:43, 8 February 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Current system is a 2.8 Prescott Pentium IV with 2MB RAM, booting from a 1GB CF plugged into the IDE interface, with an attached 500GB SATA HDD for data. When I tried to install Alpine from the LiveCD to this card, which is listed as a hard drive by the BIOS, it complained of insufficient space. Fair enough. Next I tried to follow [https://www.pendrivelinux.com/boot-multiple-iso-from-usb-via-grub2-using-linux/ this recipe] to boot from Alpine 2.1.4 iso. At the end, you find this tip:&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;Adding an Unlisted ISO: To try ISO Files that are not yet listed, use the existing menu entry examples in /boot/grub/grub.cfg and append any options normally found in the distribution&#039;s syslinux.cfg file on the &amp;quot;append&amp;quot; line, to the &amp;quot;linux&amp;quot; line of the menu entry.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
So I downloaded the latest Alpine iso via wget and modified the relevant &#039;&#039;grub.cfg&#039;&#039; lines to:&lt;br /&gt;
&lt;br /&gt;
 linux (loop)/boot/grsec initrd=/boot/grsec.gz iso-scan/filename=/alpine214.iso alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage quiet&lt;br /&gt;
 initrd (loop)/boot/grsec.gz&lt;br /&gt;
&lt;br /&gt;
All I got when I tried to boot this was the following error:&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;Alpine Init 2.1.2&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;/init: eval: line 1: syntax error: unexpected &amp;quot;(&amp;quot;&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;kernel panic - not syncing: attempted to kill init!&#039;&#039;&#039;&lt;br /&gt;
 &#039;&#039;&#039;Pid: 1, comm: init Not tainted 2.6.35.10-grsec #1-Alpine&#039;&#039;&#039;&lt;br /&gt;
 [...]&lt;br /&gt;
&lt;br /&gt;
I must say all went well with the Linux Mint 10.10 and the TinyCore isos, into which I&#039;m able to boot with no issues. Anyone care to advise?&lt;br /&gt;
&lt;br /&gt;
[[User:Pnin|Pnin]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hi, that &amp;quot;linux (loop)/boot/....&amp;quot; thing looks funny to me.&lt;br /&gt;
&lt;br /&gt;
According to: https://help.ubuntu.com/community/Grub2&lt;br /&gt;
&lt;br /&gt;
Could you try:&lt;br /&gt;
&lt;br /&gt;
 set root=(loop0)&lt;br /&gt;
 linux /boot/grsec initrd=/boot/grsec.gz iso-scan/filename=/alpine214.iso alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage quiet&lt;br /&gt;
 initrd /boot/grsec.gz&lt;br /&gt;
&lt;br /&gt;
[[User:Nangel|Nangel]] 13:49, 6 February 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hi &amp;amp; thanks, Nangel.&lt;br /&gt;
&lt;br /&gt;
Tried that and got this error:&lt;br /&gt;
&lt;br /&gt;
 error: no such disk.&lt;br /&gt;
 error: you need to load the kernel first.&lt;br /&gt;
 press any key to continue...&lt;br /&gt;
&lt;br /&gt;
Pressing any key returns to the grub menu. Maybe the full &#039;&#039;grub.cfg&#039;&#039; entry should be reported here:&lt;br /&gt;
&lt;br /&gt;
 menuentry &amp;quot;Alpine Linux&amp;quot; {&lt;br /&gt;
 loopback loop /alpine214.iso&lt;br /&gt;
 linux (loop)/boot/grsec initrd=/boot/grsec.gz iso-scan/filename=/alpine214.iso alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage quiet&lt;br /&gt;
 initrd (loop)/boot/grsec.gz&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It should also be noted that the LiveCD used to perform the [https://www.pendrivelinux.com/boot-multiple-iso-from-usb-via-grub2-using-linux/ recipe] was &amp;quot;Linux Mint 9 LXDE&amp;quot;, which caused Grub 1.98-1ubuntu5-1mint2 to be installed, not Grub2. And that (loop) part is present in every other successful menu entry.&lt;br /&gt;
&lt;br /&gt;
[EDIT: Just to add that IMHO coupled with the [[Alpine_local_backup|Alpine Local Backup Utility]] (lbu), booting from iso would be a killer feature for Alpine, making systems really easy to troubleshoot (delete local backup) and upgrade (replace iso).]&lt;br /&gt;
&lt;br /&gt;
[[User:Pnin|Pnin]] 14:34, 6 February 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Suppose alpine-extended-3.14.0-x86_64.iso is stored in directory boot in partition 1 on disk.&lt;br /&gt;
GRUB2 can be caused to load kernel and initramfs by entering:&lt;br /&gt;
&lt;br /&gt;
 grub&amp;gt; loopback lb /boot/alpine-extended-3.14.0-x86_64.iso&lt;br /&gt;
 grub&amp;gt; linux  (lb)/boot/vmlinuz-lts&lt;br /&gt;
 grub&amp;gt; initrd (lb)/boot/initramfs-lts&lt;br /&gt;
 grub&amp;gt; boot&lt;br /&gt;
&lt;br /&gt;
A menu entry for GRUB2 can be created with these statements.&lt;br /&gt;
&lt;br /&gt;
Initialising Alpine will then be aborted with messages:&lt;br /&gt;
&lt;br /&gt;
 Mounting boot media: failed&lt;br /&gt;
 initramfs emergency recovery shell launched. Type &#039;exit&#039; to continue boot&lt;br /&gt;
&lt;br /&gt;
To mount the filesystem where alpine-extended-3.14.0-x86_64.iso is stored, enter:&lt;br /&gt;
&lt;br /&gt;
 # mount /dev/sda1 /media/sda1&lt;br /&gt;
&lt;br /&gt;
To mount the ISO image, enter:&lt;br /&gt;
&lt;br /&gt;
 # mount -o loop -t iso9660 /media/sda1/boot/alpine-extended-3.14.0-x86_64.iso /media/cdrom&lt;br /&gt;
&lt;br /&gt;
Continue initialisation with:&lt;br /&gt;
&lt;br /&gt;
 # exit&lt;br /&gt;
&lt;br /&gt;
At last these messages will be displayed:&lt;br /&gt;
&lt;br /&gt;
 /lib/rc/sh/openrc-run.sh: eval: line 1: syntax error: unexpected &amp;quot;(&amp;quot;&lt;br /&gt;
 * ERROR: firstboot failed to start&lt;br /&gt;
&lt;br /&gt;
but login root works and Alpine can be configured using&lt;br /&gt;
&lt;br /&gt;
 # alpine-setup&lt;br /&gt;
&lt;br /&gt;
[[User:HGT|HGT]] 2021-07-08&lt;br /&gt;
&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>Vixalien</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:Full_disk_encryption_secure_boot&amp;diff=26420</id>
		<title>Talk:Full disk encryption secure boot</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:Full_disk_encryption_secure_boot&amp;diff=26420"/>
		<updated>2024-02-18T00:13:56Z</updated>

		<summary type="html">&lt;p&gt;Vixalien: Created page with &amp;quot;&amp;gt; Using luks2 (unsupported by GRUB at the moment):  luks2 is now partially supported by GRUB.  &amp;gt; cryptsetup -v -c aes-xts-plain64 -s 512 --hash sha512 --pbkdf pbkdf2 --iter-time 1000 --use-random luksFormat /dev/nvme0n1p2  The options are too many and confusing, and most of them have been made default in cryptsetup 2.4.0, according to https://wiki.archlinux.org/title/Dm-crypt/Device_encryption#Encryption_options_for_LUKS_mode.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;gt; Using luks2 (unsupported by GRUB at the moment):&lt;br /&gt;
&lt;br /&gt;
luks2 is now partially supported by GRUB.&lt;br /&gt;
&lt;br /&gt;
&amp;gt; cryptsetup -v -c aes-xts-plain64 -s 512 --hash sha512 --pbkdf pbkdf2 --iter-time 1000 --use-random luksFormat /dev/nvme0n1p2&lt;br /&gt;
&lt;br /&gt;
The options are too many and confusing, and most of them have been made default in cryptsetup 2.4.0, according to https://wiki.archlinux.org/title/Dm-crypt/Device_encryption#Encryption_options_for_LUKS_mode.&lt;/div&gt;</summary>
		<author><name>Vixalien</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Release_Notes_for_Alpine_3.16.0&amp;diff=26390</id>
		<title>Release Notes for Alpine 3.16.0</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Release_Notes_for_Alpine_3.16.0&amp;diff=26390"/>
		<updated>2024-02-15T02:36:45Z</updated>

		<summary type="html">&lt;p&gt;Vixalien: Fix broadband typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Important changes ==&lt;br /&gt;
&lt;br /&gt;
=== Python 2 has been removed ===&lt;br /&gt;
&lt;br /&gt;
Stable alpine releases do not have python 2 anymore.&lt;br /&gt;
&lt;br /&gt;
=== /tmp mounted as tmpfs ===&lt;br /&gt;
&lt;br /&gt;
Previously &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; was part of the root filesystem and was cleaned on boot via the bootmisc openrc service script. In v3.16, new installations will mount &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; as tmpfs.  &lt;br /&gt;
&lt;br /&gt;
The bootmisc script no longer wipes /tmp on boot. If you want the previous behaviour, set &amp;lt;code&amp;gt;wipe_tmp&amp;lt;/code&amp;gt; to YES in /etc/conf.d/bootmisc&lt;br /&gt;
&lt;br /&gt;
=== ICU data split ===&lt;br /&gt;
&lt;br /&gt;
The icu package has been split into:&lt;br /&gt;
&lt;br /&gt;
* {{pkg|icu-data-en}} (2.6 MiB) - Stripped down ICU data with only en_US/GB locale and no legacy charset converters.&lt;br /&gt;
* {{pkg|icu-data-full}} (29 MiB) - Full ICU data.&lt;br /&gt;
&lt;br /&gt;
{{pkg|icu-libs}} only installs icu-data-en. If additional language support is required, {{pkg|icu-data-full}} needs to be installed manually.&lt;br /&gt;
&lt;br /&gt;
{{pkg|nodejs}} is now compiled with system ICU.&lt;br /&gt;
&lt;br /&gt;
=== NetworkManager plugins === &lt;br /&gt;
&lt;br /&gt;
NetworkManager plugins (e.g. WiFi or ADSL support) have been moved into subpackages and are not installed by default. If you use some of them, install the corresponding packages:&lt;br /&gt;
&lt;br /&gt;
* WiFi: {{pkg|networkmanager-wifi}}&lt;br /&gt;
* ADSL: {{pkg|networkmanager-adsl}}&lt;br /&gt;
* Mobile broadband: {{pkg|networkmanager-wwan}}&lt;br /&gt;
* BlueTooth: {{pkg|networkmanager-bluetooth}}&lt;br /&gt;
* PPP: {{pkg|networkmanager-ppp}}&lt;br /&gt;
* Open vSwitch: {{pkg|networkmanager-ovs}}&lt;br /&gt;
&lt;br /&gt;
=== xen-qemu split ===&lt;br /&gt;
&lt;br /&gt;
The qemu components of xen were split into a new subpackage, {{pkg|xen-qemu}}. If you were using the qemu- xen binaries or the xenqemu service or firmware such as qemu/bios.bin / edk2-* files, you might need to install this.&lt;br /&gt;
&lt;br /&gt;
=== Nextcloud 24 ===&lt;br /&gt;
&lt;br /&gt;
Nextcloud can only be upgraded one major version at a time. However, in Alpine 3.15 the version was 22, and in 3.16 it is 24. To upgrade between them, make use of the {{pkg|nextcloud23}} package to satisfy this limitation.&lt;br /&gt;
&lt;br /&gt;
== New features and noteworthy new packages ==&lt;br /&gt;
&lt;br /&gt;
=== Fixed not showing boot output using consoles with drivers compiled as modules ===&lt;br /&gt;
&lt;br /&gt;
OpenRC output is now shown on VirtIO serial consoles.&lt;br /&gt;
&lt;br /&gt;
=== SDL 1.2 migrated to SDL 1.2 compat ===&lt;br /&gt;
&lt;br /&gt;
The old sdl package (SDL 1.2) has been moved from community to testing and as such won&#039;t be part of Alpine 3.16. Applications that use sdl instead use sdl12-compat, which is based on the much more well-maintained sdl2 (SDL 2.0). This results in various improvements such as support for Wayland, PipeWire, and more gamepads.&lt;br /&gt;
&lt;br /&gt;
=== utmp ===&lt;br /&gt;
&lt;br /&gt;
The following packages are built with [https://skarnet.org/software/utmps/ utmps]:&lt;br /&gt;
&lt;br /&gt;
* busybox&lt;br /&gt;
* dropbear&lt;br /&gt;
* mingetty&lt;br /&gt;
* openssh&lt;br /&gt;
* util-linux&lt;br /&gt;
&lt;br /&gt;
=== login-utils ===&lt;br /&gt;
&lt;br /&gt;
{{pkg|util-linux-login}} has been added as a provider of the &amp;lt;code&amp;gt;login&amp;lt;/code&amp;gt; command. If &amp;lt;code&amp;gt;cmd:login&amp;lt;/code&amp;gt; has been added to world, then the util-linux implementation will be preferred over the shadow implementation. If the shadow implementation is required, then {{pkg|shadow-login}} must be manually selected.&lt;br /&gt;
&lt;br /&gt;
=== Zsh - modular zshrc and plugins support ===&lt;br /&gt;
&lt;br /&gt;
=== doas-sudo-shim ===&lt;br /&gt;
&lt;br /&gt;
If you are hesitant to switch to {{pkg|doas}} because you have &amp;lt;code&amp;gt;sudo&amp;lt;/code&amp;gt; too deep in your muscle memory, hesitant no more! Just install {{pkg|doas-sudo-shim}} and you can continue to use the &amp;lt;code&amp;gt;sudo&amp;lt;/code&amp;gt; command, but without its security issues and bloat.&lt;br /&gt;
&lt;br /&gt;
== Significant updates ==&lt;br /&gt;
&lt;br /&gt;
* GNOME 42&lt;br /&gt;
* LLVM 13&lt;br /&gt;
* PHP 8.0 and 8.1 both shipped&lt;br /&gt;
* Python 3.10&lt;br /&gt;
* QEMU 7&lt;br /&gt;
* R 4.2&lt;br /&gt;
* Ruby 3.1&lt;br /&gt;
* Rust 1.60&lt;br /&gt;
* Sway 1.7&lt;br /&gt;
* Xen 4.16.1&lt;br /&gt;
&lt;br /&gt;
=== KDE ===&lt;br /&gt;
&lt;br /&gt;
Plasma has been upgraded from 5.23 to 5.24.&lt;br /&gt;
&lt;br /&gt;
KDE applications (the release service) have been upgraded from 21.08 to 22.04 and KDE Frameworks have been upgraded from 5.88 to 5.93.&lt;br /&gt;
&lt;br /&gt;
Plasma Mobile Gear have been upgraded from 21.12 to 22.04.&lt;br /&gt;
&lt;br /&gt;
=== Python upgraded to 3.10 ===&lt;br /&gt;
&lt;br /&gt;
Python has been upgraded to version 3.10, and all modules have been rebuilt against python 3.10. Manually-installed Python modules must be recompiled against 3.10.&lt;br /&gt;
&lt;br /&gt;
== Deprecations / Removals ==&lt;br /&gt;
&lt;br /&gt;
=== php7 moved to testing ===&lt;br /&gt;
&lt;br /&gt;
The {{pkg|php7}} package has been moved to testing, as no more packages in community depend on it and php 7.4 will be EOL soon. {{pkg|php8}} has taken it&#039;s place, which is php 8.0. Additionally 8.1 is shipped via community&lt;br /&gt;
&lt;br /&gt;
[[Category:News]]&lt;/div&gt;</summary>
		<author><name>Vixalien</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Creating_an_Alpine_package&amp;diff=26389</id>
		<title>Creating an Alpine package</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Creating_an_Alpine_package&amp;diff=26389"/>
		<updated>2024-02-15T02:21:06Z</updated>

		<summary type="html">&lt;p&gt;Vixalien: Add links to alpine&amp;#039;s gitlab instance and setting up the aports build environment&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
This is a brief list of the steps to add a new package. Details are below, but a NB can miss a few steps.&lt;br /&gt;
&lt;br /&gt;
# Create an account on https://gitlab.alpinelinux.org&lt;br /&gt;
# [[Abuild_and_Helpers#Setting_up_the_build_environment|Setup the build environment for aports]].&lt;br /&gt;
# Fork the [https://gitlab.alpinelinux.org/alpine/aports aports repository]. &lt;br /&gt;
# Clone your new fork.&lt;br /&gt;
# Set git pull.rebase=true, set your username and email.&lt;br /&gt;
# Create and switch to a new branch (don&#039;t use master).&lt;br /&gt;
# Add a new directory under testing that is your new package name.&lt;br /&gt;
# Add your APKBUILD file.&lt;br /&gt;
# Run abuild checksum&lt;br /&gt;
# Make sure you run the apkbuild-lint and aport -r and there are no warnings.&lt;br /&gt;
# Commit your APKBUILD with the commit message: &#039;testing/packagename: new aport&#039;&lt;br /&gt;
# Push your changes to your fork on https://gitlab.alpinelinux.org/alpine.&lt;br /&gt;
# Create a merge request.&lt;br /&gt;
&lt;br /&gt;
Please see the rest of this wiki for details on the steps above.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
To build a package for Alpine Linux you need an Alpine Linux installation. Check the [[Installation]] page to see all available installation options.&lt;br /&gt;
&lt;br /&gt;
== Setup your system and account  ==&lt;br /&gt;
{{:Setup_your_system_and_account_for_building_packages}}&lt;br /&gt;
&lt;br /&gt;
== Getting some help ==&lt;br /&gt;
&lt;br /&gt;
It might be wise to start by checking what the [[Abuild and Helpers|abuild]] program can/cannot do.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|abuild -h}}&lt;br /&gt;
&lt;br /&gt;
For real help, you can also go on #alpine-devel on [[IRC]].&lt;br /&gt;
&lt;br /&gt;
A reference for APKBUILD files is available as [[APKBUILD Reference]] wiki page or a man page in the &#039;abuild-doc&#039; package:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|man APKBUILD}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Creating an APKBUILD file  ==&lt;br /&gt;
&lt;br /&gt;
=== Use a template APKBUILD ===&lt;br /&gt;
&lt;br /&gt;
To create the actual APKBUILD file {{Pkg|newapkbuild}} can serve you a template to start with. It will create a directory with the given package name, place an example/template APKBUILD file to the given directory, and fill some variables if those are provided. Please check the [[Package_policies| package policies]] page about naming details.&lt;br /&gt;
&lt;br /&gt;
If you doubt to which repository your package belongs to you can safely use &#039;&#039;&#039;testing&#039;&#039;&#039;. Building package in your aports/testing directory is not mandatory but this way the package is already at the right place.&lt;br /&gt;
&lt;br /&gt;
{{:Abuild and Helpers}}&lt;br /&gt;
&lt;br /&gt;
{{Note|On older Alpine systems, abuild -c -n &#039;&#039;packagename&#039;&#039; was the way to create APKBUILD files. The &#039;packagename&#039; was a parameter to the -n option so order of -c and -n matters. }}&lt;br /&gt;
&lt;br /&gt;
[[Abuild_and_Helpers#apkbuild-cpan|apkbuild-cpan]] simplifies the creation of perl packages from CPAN and [[Abuild_and_Helpers#apkbuild-pypi|apkbuild-pypi]] ease the generation of APKBUILD files for python packages from PyPi.  &lt;br /&gt;
&lt;br /&gt;
If you are creating a daemon package which needs initd scripts you can add the -c making it: &lt;br /&gt;
&lt;br /&gt;
{{Cmd|newapkbuild -c &#039;&#039;packagename&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
This will copy the sample initd and confd files to the build directory.&amp;lt;BR&amp;gt;&lt;br /&gt;
A third file sample.install file will be copied as well (we will discuss this later on).&lt;br /&gt;
&lt;br /&gt;
=== Modify your APKBUILD ===&lt;br /&gt;
Edit APKBUILD and fill in the needed info (especially pkgname, pkgver, pkgdesc, url, license, depends and source). &lt;br /&gt;
&lt;br /&gt;
If you are going to use any of the variables for directories like $pkgdir, always make sure they are double quoted like: &lt;br /&gt;
&lt;br /&gt;
 &amp;quot;$pkgdir&amp;quot;/somedir&lt;br /&gt;
&lt;br /&gt;
This will prevent issues with spaces/special characters in the future. &lt;br /&gt;
&lt;br /&gt;
{{Note|If you like syntax highlighting we suggest you to install vim. We have setup vim to recognize the APKBUILD file as a bash scripts so its easier to read them.}}&lt;br /&gt;
&lt;br /&gt;
=== APKBUILD variables/functions  ===&lt;br /&gt;
&lt;br /&gt;
==== source  ====&lt;br /&gt;
&lt;br /&gt;
The source variable is not only used to list the remote source files to fetch, it is also used to list the local files that abuild will need in order to build the apk. Examples of such local files include: init.d files, conf.d files, install files (see [[Creating an Alpine package#install|install variable]]), patches, and all other necessary files.&lt;br /&gt;
&lt;br /&gt;
Here are few things to note:&lt;br /&gt;
&lt;br /&gt;
* When you are finished adding local and/or remote files to &#039;&#039;source&#039;&#039;, you can execute the following command to add their checksums to the APKBUILD file:&lt;br /&gt;
: {{cmd|abuild checksum}}&lt;br /&gt;
: {{Note|When later updating the content of &#039;&#039;source&#039;&#039;, or updating a file that is listed in &#039;&#039;source&#039;&#039;, you must also update their checksums again with the same command.}}&lt;br /&gt;
&lt;br /&gt;
* When the remote file is hosted at SourceForge, it&#039;s best to specify the special mirrors link used by SourceForge:&lt;br /&gt;
: &amp;lt;pre&amp;gt;http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz&amp;lt;/pre&amp;gt;&lt;br /&gt;
: (or similar depending on the package).&lt;br /&gt;
&lt;br /&gt;
* When the remote filename is not specified in the URI (ie, does not end in &#039;/software-1.0.tar.gz&#039;), such as:&lt;br /&gt;
: &amp;lt;pre&amp;gt;http://oss.example.org/?get=software&amp;amp;ver=1.0&amp;lt;/pre&amp;gt;&lt;br /&gt;
: You must prepend &#039;${pkgname}-${pkgver}.tar.gz::&#039; to the protocol, like so:&lt;br /&gt;
: &amp;lt;pre&amp;gt;source=&amp;quot;${pkgname}-${pkgver}.tar.gz::http://oss.example.org/?get=software&amp;amp;ver=1.0&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
: This causes the file to be saved as &#039;&#039;software-1.0.tar.gz&#039;&#039; where abuild can use it, instead of &#039;&#039;?get=software&amp;amp;ver=1.0&#039;&#039;, where abuild cannot use it.&lt;br /&gt;
&lt;br /&gt;
* Some projects didn&#039;t provide a release tarball. Beware that some git services (gitweg, cgit, …?) doesn’t provide &#039;&#039;stable&#039;&#039; tarballs, so when you point source to an tarball like &amp;lt;tt&amp;gt;https://repo.or.cz/w/gitstats.git/snapshot/ad7efbb9399e60cee6cb217c6b47e604174a8093.tar.gz&amp;lt;/tt&amp;gt;, then you will run into issues because the checksum changes when downloading on the build system. This is not a problem on GitHub, GitLab and other decent services provides, they provide &#039;&#039;stable&#039;&#039; tarballs.&lt;br /&gt;
&lt;br /&gt;
* abuild currently supports the following protocols for remote file retrieval:&lt;br /&gt;
** http&lt;br /&gt;
** https&lt;br /&gt;
** ftp&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--: {{Note|If the you want to download from https, you need GNU wget installed on your system.}}--&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
* abuild currently supports the following archive types/archive file extensions:&lt;br /&gt;
** .tar&lt;br /&gt;
** .tar.gz / .tgz&lt;br /&gt;
** .tar.bz2&lt;br /&gt;
** .tar.lz (only in Alpine &amp;gt;=3.7)&lt;br /&gt;
** .tar.lzma&lt;br /&gt;
** .tar.xz&lt;br /&gt;
** .zip&lt;br /&gt;
&lt;br /&gt;
==== depends &amp;amp;amp; makedepends  ====&lt;br /&gt;
&lt;br /&gt;
Depends are the actual running dependencies that a package would need when it is running. Makedepends are only needed when you are building a package. If you set a package in depends, you do not need to add it to makedepends as well. The best way to find out what the depends and makedepends of a package are is to [https://en.wikipedia.org/wiki/Rtfm RTFM]. &lt;br /&gt;
&lt;br /&gt;
No kidding, lots of important information can be found in the package INSTALL and README files (or the likes). Another good way is the run &amp;lt;code&amp;gt;./configure --help&amp;lt;/code&amp;gt; from the source directory to see which options are needed for configure to finish without errors. If you do not yet have a source directory you can create one with the command: &lt;br /&gt;
&lt;br /&gt;
{{Cmd|abuild unpack}}&lt;br /&gt;
&lt;br /&gt;
Running &amp;lt;code&amp;gt;configure&amp;lt;/code&amp;gt; will also show you how you can disable a specific option for this package. For instance, a good example is &amp;quot;--disable-nls&amp;quot; which will disable native language support and thus does not depend on gettext (libiconv, glib, ...). &lt;br /&gt;
&lt;br /&gt;
Alpine likes to keep things small, so we try to disable as much as possible without losing too many features. The exact disable/enable options are decided by the package builder but please try to follow Alpine&#039;s design concept as much as possible.&lt;br /&gt;
&lt;br /&gt;
An easy way of quickly finding out the build info for a package is to check Arch Linux (Alpine package management and build scripts are similar) or Gentoo Linux ebuilds (previous versions of Alpine were based on Gentoo).&lt;br /&gt;
&lt;br /&gt;
* [https://gitweb.gentoo.org/repo/gentoo.git/tree/ Gentoo Ebuilds] &lt;br /&gt;
* [https://archlinux.org/packages/?q=search Arch Linux packages] [https://aur.archlinux.org/ Arch Linux User Repository]&lt;br /&gt;
&lt;br /&gt;
==== license  ====&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;license&#039;&#039;&#039; tag must reflect the license of the source code. Please check the source tarball for COPYING, LICENSE, or other files with names that indicates that it contains licensing information. Beside the license file most developer include headers in the source code files with licensing details.&lt;br /&gt;
&lt;br /&gt;
If the license is on the [https://spdx.org/licenses/ SPDX License List] or [https://spdx.org/licenses/exceptions-index.html SPDX License Exceptions], use the identifier specified by SPDX.&lt;br /&gt;
&lt;br /&gt;
Note that some licenses have additional requirements that should be adhered to. The &amp;lt;code&amp;gt;MIT&amp;lt;/code&amp;gt; license for example has the requirement:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This means that we need to include the license as shipped with the project.&lt;br /&gt;
&lt;br /&gt;
If a package has a special/custom license or is not listed as [https://opensource.org/licenses/alphabetical OSI approved], use the identifier &amp;quot;custom&amp;quot;. In that case we need to provide the license file with the package as well.&lt;br /&gt;
&lt;br /&gt;
Because we want to save space and don&#039;t like to have licenses all over our system we have decided to include the license in the doc subpackage. Please follow the following guidelines to add a proper license. Locate the license file inside the source package. Add the doc subpackage to the $subpackages variable as follows: &lt;br /&gt;
&lt;br /&gt;
 subpackages=&amp;quot;$pkgname-doc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Add a similar line to the following to your package() function, depending on the license description file: &lt;br /&gt;
&lt;br /&gt;
{{Cmd|install -Dm644 COPYING &amp;quot;$pkgdir&amp;quot;/usr/share/licenses/$pkgname/COPYING}}&lt;br /&gt;
&lt;br /&gt;
If you follow these steps then abuild will automatically add the license to the package-doc apk for you.&lt;br /&gt;
&lt;br /&gt;
{{Warning|It is not acceptable to package software with &amp;quot;unknown&amp;quot; license! If you can&#039;t find the license of the source code, please contact the author and ask them to specify the license. }}&lt;br /&gt;
&lt;br /&gt;
==== arch ====&lt;br /&gt;
&lt;br /&gt;
The package architecture(s) to build for.  This can be one of: &#039;&#039;x86, x86_64, all,&#039;&#039; or &#039;&#039;noarch&#039;&#039;, where &#039;&#039;all&#039;&#039; means all architectures, and &#039;&#039;noarch&#039;&#039; means it&#039;s architecture-independent (e.g., a pure-python package).&lt;br /&gt;
{{Tip|To determine if your APKBUILD can use &#039;&#039;noarch&#039;&#039;, build the package for your architecture and then run &amp;quot;scanelf -R pkg&amp;quot; from the directory that the APKBUILD resides in, in order to scan for ELF files in the &#039;&#039;./pkg&#039;&#039; directory.  If you do NOT get output from this, then &#039;&#039;noarch&#039;&#039; can be used.}}&lt;br /&gt;
&lt;br /&gt;
==== url  ====&lt;br /&gt;
&lt;br /&gt;
Website address for the program. This is useful later on when either finding documentation or other information about the package.&lt;br /&gt;
&lt;br /&gt;
==== pkgdesc  ====&lt;br /&gt;
&lt;br /&gt;
A brief, one line, description of what the package does. Useful for the package management system. It should start with a capital letter and does &#039;&#039;&#039;not&#039;&#039;&#039; end with a period.&lt;br /&gt;
&lt;br /&gt;
Here is an example from apk_info for the OpenSSH client package:&lt;br /&gt;
&lt;br /&gt;
 pkgdesc=&amp;quot;Port of OpenBSD&#039;s free SSH release - client&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== pkgver  ====&lt;br /&gt;
&lt;br /&gt;
Provide the release number of the package you are building.&lt;br /&gt;
&lt;br /&gt;
==== pkgrel  ====&lt;br /&gt;
&lt;br /&gt;
The $pkgrel versioning is made so that if you change something in your APKBUILD file without changing the actual $pkgver, you can increment pkgrel so apk tools will detect it as an update. For instance, if you forget to add a dependency, you can add it afterward and you can +1 pkgver so apk finds this update and adds the missing dependency. When there&#039;s an upstream version change, we reset the pkgrel to 0.&lt;br /&gt;
&lt;br /&gt;
==== pkgname  ====&lt;br /&gt;
&lt;br /&gt;
The base name of the package you are creating.  For Freeswitch 1.0.6, you would use &amp;quot;freeswitch&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== install  ====&lt;br /&gt;
&lt;br /&gt;
There are 6 different kinds of install scripts. Each script is called with the $pkgname.&#039;&#039;&amp;lt;action&amp;gt;&#039;&#039; where &#039;&#039;&amp;lt;action&amp;gt;&#039;&#039; is one of the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dl&amp;gt;&lt;br /&gt;
&amp;lt;dt&amp;gt;$pkgname.pre-install&lt;br /&gt;
&amp;lt;dd&amp;gt;This script is executed before package is installed. Typical use is when package needs a group and a user to be created. For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
&lt;br /&gt;
addgroup -S clamav 2&amp;gt;/dev/null&lt;br /&gt;
adduser -S -D -H -s /bin/false -G clamav -g clamav clamav 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
exit 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Note the &#039;&#039;exit 0&#039;&#039; at the end. If the script exits with failure (if the user already exist), the package will not be installed and &amp;lt;code&amp;gt;apk add&amp;lt;/code&amp;gt; will exit with failure.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dt&amp;gt;$pkgname.post-install&lt;br /&gt;
&amp;lt;dd&amp;gt;This script is executed after the package is installed.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dt&amp;gt;$pkgname.pre-upgrade&lt;br /&gt;
&amp;lt;dd&amp;gt;Same as pre-install but is executed before upgrading/downgrading/reinstalling an already installed package. Note that exiting with failure will not cause apk to exit with failure, but will mark the package as broken.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dt&amp;gt;$pkgname.post-upgrade&lt;br /&gt;
&amp;lt;dd&amp;gt;Same as post-install but is executed after upgrading/downgrading/reinstalling an already installed package. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;dt&amp;gt;$pkgname.pre-deinstall&lt;br /&gt;
&amp;lt;dd&amp;gt;This script is executed before uninstalling a package. If script exits with failure apk will not uninstall the package.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;dt&amp;gt;$pkgname.post-deinstall&lt;br /&gt;
&amp;lt;dd&amp;gt;This script is executed after a package have been uninstalled. For example, can be used to restore busybox links:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
busybox --install -s&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/dl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the package has a pre-install and post-install script the APKBUILD should have the &#039;&#039;install&#039;&#039; variable defined:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
install=&amp;quot;$pkgname.pre-install $pkgname.post-install&amp;quot;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== subpackages  ====&lt;br /&gt;
&lt;br /&gt;
$subpackages are made to split up the normal &amp;quot;make install&amp;quot; into separate packages. The most common subpackages we use are doc and dev. Because we like to keep our target system small we move documentation and development files (only needed when building packages) into separate packages. To use the specific program a user only need to install the base apk without package-doc or package-dev, but if he wants to read the manual he will need to install package-doc. &lt;br /&gt;
&lt;br /&gt;
The easiest way to find out if you need to use -dev and -doc is to first build the package without these options set and wait until the build finishes. When its finished you should have a pkg directory which is the fake root directory. Inside this directory you will see the structure as how it would be installed in / on the target system. &lt;br /&gt;
&lt;br /&gt;
To see if you need the -dev package you can run the following cmd: &lt;br /&gt;
&lt;br /&gt;
{{Cmd|find pkg/usr/ -name &#039;*.[acho]&#039; -o -name &#039;*.la&#039;}}&lt;br /&gt;
&lt;br /&gt;
If this returns any files you need to include the -dev package. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt; To see if you need the -doc package you can run the following cmd: &lt;br /&gt;
&lt;br /&gt;
{{Cmd|find pkg/usr/share -name doc -o -name man -o -name info -o -name html -o -name sgml -o -name licenses}}&lt;br /&gt;
&lt;br /&gt;
If this returns any directories you need to include the -doc package. &lt;br /&gt;
&lt;br /&gt;
===== Custom subpackages  =====&lt;br /&gt;
&lt;br /&gt;
Some software additionally has non-essential files that do not qualify as either documentation or development content. These files should be placed in their own, specialized subpackage(s). Some packages include large test suites which are only needed in specific circumstances or binaries which have depends which we prefer not to install. To handle those we create our own package/function. In the APKBUILD below the build() function we create another function: &lt;br /&gt;
&lt;br /&gt;
 test() {&lt;br /&gt;
        mkdir -p &amp;quot;$subpkgdir&amp;quot;/usr&lt;br /&gt;
        mv &amp;quot;$pkgdir&amp;quot;/usr/package-test &amp;quot;$subpkgdir&amp;quot;/usr/&lt;br /&gt;
        # or amove usr/package-test&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
We also need to add the package info to $subpackages variable: &lt;br /&gt;
&lt;br /&gt;
 subpackages=&amp;quot;$pkgname-doc $pkgname-dev $pkgname-test&amp;quot;&lt;br /&gt;
&lt;br /&gt;
After we finish building the package you should see another apk called packagename-test.apk which includes the files which we moved to the $subpkgdir dir. &lt;br /&gt;
&lt;br /&gt;
The above mentioned variables can also be used in our custom function. If we want for instance to build the test() function with perl support we would add: &lt;br /&gt;
&lt;br /&gt;
 depends=&amp;quot;perl&amp;quot;&lt;br /&gt;
 makedepends=&amp;quot;perl-dev&amp;quot;&lt;br /&gt;
&lt;br /&gt;
If we would install the base package it would not install perl, but if we install the package-test package it would.&lt;br /&gt;
&lt;br /&gt;
==== Patches  ====&lt;br /&gt;
&lt;br /&gt;
Please make sure you always submit human readable patches. Ways to create them are: &lt;br /&gt;
&lt;br /&gt;
directory compare: &lt;br /&gt;
&lt;br /&gt;
{{Cmd|diff -Nurp original_directory new_directory &amp;amp;gt; filename.patch}}&lt;br /&gt;
&lt;br /&gt;
file compare: &lt;br /&gt;
&lt;br /&gt;
{{Cmd|diff -up original.file new.file &amp;amp;gt; filename.patch}}&lt;br /&gt;
&lt;br /&gt;
If a patch contains a completely new file but not *.rej or *.orig file, you need to add -N option to diff, but you may need to add exclusions with &amp;lt;code&amp;gt;--exclude PATTERN&amp;lt;/code&amp;gt; so that you do not inadvertently add files.  You may need to manually delete unwanted files inside the patch file.&lt;br /&gt;
&lt;br /&gt;
Because multiple patches can patch the same file, they can change the offsets required by subsequent patches. To make sure we always patch in a specific way, we should number the patches as follows: &lt;br /&gt;
&lt;br /&gt;
 10-patch1.patch 20-patch2.patch 30-patch3.patch&lt;br /&gt;
&lt;br /&gt;
This way we are always sure that patch 1 is applied first, and if we want to add additional patches between them we can use appropriate indexes (e.g. 11, 12, 21, 22).&lt;br /&gt;
&lt;br /&gt;
Add the names of the patch files to the &#039;&#039;source&#039;&#039; variable. If you haven&#039;t declared a custom &#039;&#039;prepare&#039;&#039; function, no further action is necessary. Otherwise, be sure to call &#039;&#039;default_prepare&#039;&#039; in your &#039;&#039;prepare&#039;&#039; function. For example:&lt;br /&gt;
&lt;br /&gt;
 prepare() {&lt;br /&gt;
 	default_prepare&lt;br /&gt;
 &lt;br /&gt;
 	# do your stuff&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Note: Some older packages contain a &#039;&#039;for&#039;&#039; loop in the &#039;&#039;prepare&#039;&#039; function to apply patches. This is not needed anymore, as patches are handled by &#039;&#039;default_prepare&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In Alpine &amp;gt;=3.4 you can define patch_args to supply the patch level.  This only works if all the patches have the same patch level.  If there are a lot of patches from different sources, there is a good chance that you may need to edit them, as discussed below.&lt;br /&gt;
&lt;br /&gt;
To automatically patch the package (available only in Alpine &amp;gt;=3.4) if it uses a patch level (-pX) other than the default (-p1), you need to carefully modify the patch.  First, you&#039;ll need a text editor that does not automatically convert  between Windows and Unix new lines (or, disable this feature) so that it preserves the old code.  The next thing you&#039;ll need to do is modify the paths on &amp;quot;+++&amp;quot; and &amp;quot;---&amp;quot; lines in the .patch file.  You can begin the path with a/ and b/ like shown below.  Next, you need to adjust the paths so that the relative base path is from inside $builddir.  Anything to the left of $builddir, including $builddir itself, needs to be removed from the path.  So, if $builddir is /home/USER/aports/community/chromium/src/chromium-65, you need to erase it on the &amp;quot;+++&amp;quot; and &amp;quot;---&amp;quot; lines.  Inside the chromium-65 folder you can see a src folder that has 3rdparty as a descendant.  If a patch originally has a deeper patch level, you may need to fill in the missing portion of the path.  For example, use the &amp;lt;code&amp;gt;find . -name &amp;quot;Assertions.cpp&amp;quot;&amp;lt;/code&amp;gt; command to find the full path to the file relative to the base.&lt;br /&gt;
&lt;br /&gt;
{{Cat|example.patch|&amp;lt;nowiki&amp;gt;&lt;br /&gt;
Author: John Doe &amp;lt;johndoe@mail.com&amp;gt;&lt;br /&gt;
URL: http://.....&lt;br /&gt;
Summary: Fixes musl compatibility&lt;br /&gt;
----&lt;br /&gt;
--- a/src/3rdparty/chromium/third_party/WebKit/Source/wtf/Assertions.cpp.orig&lt;br /&gt;
+++ b/src/3rdparty/chromium/third_party/WebKit/Source/wtf/Assertions.cpp&lt;br /&gt;
@@ -142,7 +142,7 @@&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 FrameToNameScope::FrameToNameScope(void* addr) : m_name(0), m_cxaDemangled(0) {&lt;br /&gt;
-#if OS(MACOSX) || (OS(LINUX) &amp;amp;&amp;amp; !defined(__UCLIBC__))&lt;br /&gt;
+#if OS(MACOSX) || (OS(LINUX) &amp;amp;&amp;amp; defined(__GLIBC__))&lt;br /&gt;
   Dl_info info;&lt;br /&gt;
   if (!dladdr(addr, &amp;amp;info) || !info.dli_sname)&lt;br /&gt;
return;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Portions of the patch may be outdated, removed completely as in the source code file completely removed, or moved or renamed files.  You need to delete that section of the patch or find where that section of code changed and re-diff it.&lt;br /&gt;
&lt;br /&gt;
It is good etiquette to give credit at the top and the location of where you originally found them with notes.&lt;br /&gt;
&lt;br /&gt;
Excluding patches with global variable resembling patch_opts is not available on Alpine.  To exclude patches you need to create your own custom prepare().&lt;br /&gt;
&lt;br /&gt;
If you have a monolithic patch where there are a bunch of patches in one big patch, you could use filterdiff which is available in the patchutils package.&lt;br /&gt;
&lt;br /&gt;
Just do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
makedepends=&amp;quot;patchutils&amp;quot;&lt;br /&gt;
&lt;br /&gt;
prepare() {&lt;br /&gt;
  ...&lt;br /&gt;
  cd &amp;quot;$builddir&amp;quot;&lt;br /&gt;
  filterdiff -x &#039;*drivers/video/logo*&#039; &amp;quot;$srcdir&amp;quot;/original.patch &amp;gt; &amp;quot;$builddir&amp;quot;/modified.patch&lt;br /&gt;
  patch -p1 -i &amp;quot;$builddir&amp;quot;/modified.patch&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You need to put the wildcard pattern in single quotes for it to work.&lt;br /&gt;
&lt;br /&gt;
==== Configure options  ====&lt;br /&gt;
&lt;br /&gt;
Alpine has some default configure options we set by default. We use /usr for prefix to make sure everything is installed with /usr in front of it. If you notice that anything is installed in the wrong directory please run {{Cmd|./configure --help}} and see if you can set the correct location. &lt;br /&gt;
&lt;br /&gt;
We are not covering the depend switches here we have discussed this already in the depend section.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Make options  ====&lt;br /&gt;
&lt;br /&gt;
If you notice weird problems when compiling or installing the package with make/make install you could try to disable [https://www.gnu.org/software/make/manual/make.html#Parallel parallel] building/installing. A normal make line would be: &lt;br /&gt;
&lt;br /&gt;
{{Cmd|make}}&lt;br /&gt;
&lt;br /&gt;
To disable parallel we use: &lt;br /&gt;
&lt;br /&gt;
{{Cmd|make -j1}}&lt;br /&gt;
&lt;br /&gt;
We can use the same for make install. &lt;br /&gt;
&lt;br /&gt;
Because we do not want to install the package in our build environment but we want to install it in a fake root directory we need to tell &#039;make install&#039; to use another destination directory instead of &#039;/&#039;. We do this by setting a variable when we execute make install as followed: &lt;br /&gt;
&lt;br /&gt;
{{Cmd|make DESTDIR{{=}}&amp;quot;$pkgdir&amp;quot; install}}&lt;br /&gt;
&lt;br /&gt;
Please note that some Makefiles do not support this variable and will always install software in &#039;/&#039;. To make sure you do not mess up your build system NEVER run your build system as root but always use a custom user and doas when needed. If by accident the Makefile does not support DESTDIR variable it will fail to install in our build system system directories.&lt;br /&gt;
&lt;br /&gt;
==== builddir ====&lt;br /&gt;
If you used &amp;lt;tt&amp;gt;newapkbuild&amp;lt;/tt&amp;gt; to create your APKBUILD file, you must specify the path to your unpacked sources. Inside the sections during the prepare/build/install process &#039;&#039;builddir&#039;&#039; is used. Most of the time a combination of &#039;&#039;$srcdir&#039;&#039; and &#039;&#039;$pkgname-$pkgver&#039;&#039; will work. When not, check the /src directory or the source tarball for the right string. Especially when you are working with automatically generated tarballs (like from github and gitorious), this needs to be adjusted.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
builddir=&amp;quot;$srcdir&amp;quot;/$pkgname-$pkgver&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Additional files  ====&lt;br /&gt;
&lt;br /&gt;
If you want/need to install additional files not mentioned above you can use the following cmd (this is an example of a conf file): &lt;br /&gt;
&lt;br /&gt;
{{Cmd|install -Dm644 doc/$pkgname.conf &amp;quot;$pkgdir&amp;quot;/etc/$pkgname.conf}}&lt;br /&gt;
&lt;br /&gt;
== Build the package  ==&lt;br /&gt;
&lt;br /&gt;
If you did not already create the checksums as mentioned above you can do so now: &lt;br /&gt;
&lt;br /&gt;
{{Cmd|cd $pkgname&lt;br /&gt;
abuild checksum}}&lt;br /&gt;
&lt;br /&gt;
It&#039;s about time we build our package. Because a build system should never have all the package installed to prevent linking to packages we don&#039;t want it to link we use a abuild recursively with the &#039;&#039;&#039;-r&#039;&#039;&#039; switch. It will install all dependencies from your repository and builds it, afterwards it will uninstall all those depending packages again.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|abuild -r}}&lt;br /&gt;
&lt;br /&gt;
See also [[Abuild_and_Helpers|Abuild and Helpers]].&lt;br /&gt;
&lt;br /&gt;
== Testing the package locally ==&lt;br /&gt;
&lt;br /&gt;
When it completes, your package will be found in a subfolder of &amp;lt;code&amp;gt;~/packages&amp;lt;/code&amp;gt;.  You may want to test it on your machine but only if the package is not a critical system package like musl or apk-tools package.  To avoid borking your system (as in making it impossible to use &amp;lt;code&amp;gt;apk add&amp;lt;/code&amp;gt; or to restore back the system and the compiler toolchain) for a critical system package, you should test on a chroot first before using it live.&lt;br /&gt;
&lt;br /&gt;
The best way to test a package locally is to modify your &amp;lt;code&amp;gt;/etc/apk/repositories&amp;lt;/code&amp;gt; so that it includes the indexes to your locally built packages - the directories that contain &amp;lt;code&amp;gt;ARCH/APKINDEX.tar.gz&amp;lt;/code&amp;gt;. For example the &amp;lt;code&amp;gt;/etc/apk/repositories&amp;lt;/code&amp;gt; below includes locally built packages in testing, community and main. To use this example change &amp;lt;code&amp;gt;USER&amp;lt;/code&amp;gt; to your login name.&lt;br /&gt;
&lt;br /&gt;
{{Cat|/etc/apk/repositories|/home/USER/packages/testing/&lt;br /&gt;
/home/USER/packages/main/&lt;br /&gt;
/home/USER/packages/community/&lt;br /&gt;
https://dl-cdn.alpinelinux.org/alpine/edge/main&lt;br /&gt;
https://dl-cdn.alpinelinux.org/alpine/edge/community&lt;br /&gt;
https://dl-cdn.alpinelinux.org/alpine/edge/testing&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
If you prefer to test a package without changing any other configuration you can use the &amp;lt;code&amp;gt;-X, --repository&amp;lt;/code&amp;gt; option to &amp;lt;code&amp;gt;apk&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|doas apk add --repository /home/USER/packages/testing $pkgname}}&lt;br /&gt;
&lt;br /&gt;
== Code review ==&lt;br /&gt;
&lt;br /&gt;
To successfully have your package pass through code reviewers (as of Feb 18, 2018 are nmeum and jirutka on GitHub) and possible increased acceptance, the following conventions need to be followed:&lt;br /&gt;
&lt;br /&gt;
# Custom global variables should be prefixed with underscore (_).&lt;br /&gt;
# Compact code as in merged commands, removed unused variables, removal of functions that do the same thing that are automatically handled by abuild.&lt;br /&gt;
# Versioning is done properly.  For details see [[APKBUILD_Reference#pkgver]].&lt;br /&gt;
# Licensing is done properly. Remove unnecessary copying of licensing that is already OSI approved.&lt;br /&gt;
# Naming conventions rules for unofficial variables as in _gitrev is preferred over commit.&lt;br /&gt;
# Indent with tabs not spaces.&lt;br /&gt;
# Removal of explicit return 1.  (They are still found the old APKBUILD files if you are learning but are now strongly discouraged.)&lt;br /&gt;
# Disabling check() requires either (1) a comment (#) stating next to options=&amp;quot;!check&amp;quot; that there is no test suite/unit tests or (2) functioning working check() function.&lt;br /&gt;
# Explicit call to subpackages=&amp;quot;$pkgname-doc&amp;quot; must be used instead of explicit gzip man page compression.&lt;br /&gt;
# Ideally, lines should be no more than 80 columns wide&lt;br /&gt;
&lt;br /&gt;
Additionally, make sure to run the linter on your package:&lt;br /&gt;
{{Cmd|doas apk add atools&lt;br /&gt;
apkbuild-lint APKBUILD}}&lt;br /&gt;
&lt;br /&gt;
For more information see [[Development using git:Quality assurance]] and [[Package_policies]].&lt;br /&gt;
Also check out [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/COMMITSTYLE.md?ref_type=heads aports/COMMITSTYLE.md] and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/CODINGSTYLE.md?ref_type=heads aports/CODINGSTYLE.md]&lt;br /&gt;
&lt;br /&gt;
== Commit your work  ==&lt;br /&gt;
&lt;br /&gt;
After you successfully build your package and properly followed the conventions and requirements in the code review section, you can submit your APKBUILD to Alpine&#039;s git repository. &lt;br /&gt;
&lt;br /&gt;
Update your git repo, before adding new files: &lt;br /&gt;
&lt;br /&gt;
{{Cmd|cd $aportsdir&lt;br /&gt;
git pull}}&lt;br /&gt;
&lt;br /&gt;
This should pull all the changes made by others into your local git repo.&lt;br /&gt;
&lt;br /&gt;
When you think you are ready you can add your files to git: &lt;br /&gt;
&lt;br /&gt;
NOTE: when using our Gitlab instance, you can create MR&#039;s for each package. Please squash all commits related to the same package into a single one per MR.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|cd $aportsdir&lt;br /&gt;
git add testing/$pkgdir (include any other files needed for the build; $pkgname.install...)&lt;br /&gt;
git commit}}&lt;br /&gt;
&lt;br /&gt;
Use the following commit message template for new aports (without the comments):&lt;br /&gt;
&lt;br /&gt;
{{Cat|template|testing/$pkgname: new aport   # this will be the subject line&lt;br /&gt;
                              # a blank line&lt;br /&gt;
$url                          # project homepage&lt;br /&gt;
$pkgdesc                      # one line description}}&lt;br /&gt;
&lt;br /&gt;
Or you could add the following and &amp;lt;code&amp;gt;chmod +x ports/.git/hooks/prepare-commit-msg&amp;lt;/code&amp;gt; to automatically generate commit message which the default aports/.githooks/ does not:&lt;br /&gt;
&lt;br /&gt;
{{Cat|aports/.git/hooks/prepare-commit-msg|&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
case &amp;quot;$2,$3&amp;quot; in&lt;br /&gt;
  ,|template,)&lt;br /&gt;
    if git diff-index --diff-filter=A --name-only --cached HEAD \&lt;br /&gt;
        | grep -q &#039;/APKBUILD$&#039;; then&lt;br /&gt;
      meta() { git diff --staged | grep &amp;quot;^+$1&amp;quot; | sed &#039;s/.*=&amp;quot;\?//;s/&amp;quot;$//&#039;;}&lt;br /&gt;
      printf &#039;testing/%s: new aport\n\n%s\n%s\n&#039; &amp;quot;$(meta pkgname)&amp;quot; \&lt;br /&gt;
        &amp;quot;$(meta url)&amp;quot; &amp;quot;$(meta pkgdesc)&amp;quot; &amp;quot;$(cat $1)&amp;quot; &amp;gt; &amp;quot;$1&amp;quot;&lt;br /&gt;
    else&lt;br /&gt;
      printf &#039;%s\n\n%s&#039; `git diff-index --name-only --cached HEAD \&lt;br /&gt;
        | sed -n &#039;s/\/APKBUILD$//p;q&#039;` &amp;quot;$(cat $1)&amp;quot; &amp;gt; &amp;quot;$1&amp;quot;&lt;br /&gt;
    fi;;&lt;br /&gt;
esac&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Now your changes are only available locally in your repository.&lt;br /&gt;
&lt;br /&gt;
Because you do not have push rights to the Alpine aports repository you need to create a merge request to [https://gitlab.alpinelinux.org/alpine/aports Alpine&#039;s GitLab instance].&lt;br /&gt;
&lt;br /&gt;
Alternatively you can also create a diff (patch) of the changes you made and send this patch to the &lt;br /&gt;
[https://lists.alpinelinux.org/~alpine/aports  alpine-aports mailinglist].&lt;br /&gt;
&lt;br /&gt;
To create a diff patch:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|git format-patch HEAD^}}&lt;br /&gt;
&lt;br /&gt;
or if you have sprunge, you can create a link to your patch for convenience&lt;br /&gt;
&lt;br /&gt;
{{Cmd|git format-patch HEAD^ --stdout &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; sprunge}}&lt;br /&gt;
&lt;br /&gt;
== Automated flagging of outdated ports ==&lt;br /&gt;
Consider adding your port to [https://release-monitoring.org/ Anitya], so it will be flagged as outdated&lt;br /&gt;
as soon as a new stable version is released by upstream.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[APKBUILD Reference]]&lt;br /&gt;
* [[APKBUILD examples]]&lt;br /&gt;
* [[Development using git]]&lt;br /&gt;
* [[Development using git:Quality assurance]]&lt;br /&gt;
&lt;br /&gt;
[[category: Package Manager]]&lt;/div&gt;</summary>
		<author><name>Vixalien</name></author>
	</entry>
</feed>