<?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=Coolreader18</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=Coolreader18"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Coolreader18"/>
	<updated>2026-04-05T17:17:04Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=UEFI_Secure_Boot&amp;diff=32260</id>
		<title>UEFI Secure Boot</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=UEFI_Secure_Boot&amp;diff=32260"/>
		<updated>2026-03-30T19:23:06Z</updated>

		<summary type="html">&lt;p&gt;Coolreader18: Add note on osslsigncode&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page documents the procedure to enable [[UEFI]] Secure Boot after Alpine Linux is installed. To install Alpine Linux, secure boot needs to be disabled in [[UEFI]] firmware.&lt;br /&gt;
&lt;br /&gt;
== Mounting ESP ==&lt;br /&gt;
&lt;br /&gt;
Prepare mount point for UEFI partition (ESP) at {{path|/boot/efi}}:  {{cmd|# install -d -m 000 /boot/efi}}&lt;br /&gt;
&lt;br /&gt;
Add the following line to {{path|/etc/fstab}} as follows: {{Cat|/etc/fstab|...&lt;br /&gt;
UUID{{=}}&amp;lt;first-partition-uuid&amp;gt;  /boot/efi  vfat  rw,noatime,fmask{{=}}0022,dmask{{=}}0022,codepage{{=}}437,iocharset{{=}}ascii,shortname{{=}}mixed,utf8,errors{{=}}remount-ro 0 2}}&lt;br /&gt;
&lt;br /&gt;
Mount it: {{cmd|# mount /boot/efi}}&lt;br /&gt;
&lt;br /&gt;
== Generating own UEFI keys ==&lt;br /&gt;
&lt;br /&gt;
Install package {{pkg|efi-mkkeys}}: {{cmd|# apk add efi-mkkeys}}&lt;br /&gt;
&lt;br /&gt;
Before creating new keys and modifying EFI variables, it is advisable to backup the current variables, so that they may be restored in case of error:&lt;br /&gt;
&lt;br /&gt;
{{cmd|# mkdir -p /etc/uefi-keys/vendor&lt;br /&gt;
&amp;amp;#35; cd /etc/uefi-keys/vendor&lt;br /&gt;
&amp;amp;#35; for i in PK KEK db dbx; do efi-readvar -v $i -o $i.esl; done }}&lt;br /&gt;
&lt;br /&gt;
Generate your self-signed PK, KEK and db key, including .esl and .auth files: {{cmd|# efi-mkkeys -s &amp;quot;Your Name&amp;quot; -o /etc/uefi-keys}}&lt;br /&gt;
&lt;br /&gt;
Now you can uninstall {{pkg|efi-mkkeys}} if you want: {{cmd|# apk del efi-mkkeys}}&lt;br /&gt;
&lt;br /&gt;
== Generating Unified Kernel Image ==&lt;br /&gt;
&lt;br /&gt;
Install package {{pkg|secureboot-hook}}, {{pkg|systemd-efistub}} (Alpine v3.22+) or {{pkg|gummiboot-efistub}} (prior v3.22), and {{pkg|efibootmgr}}:&lt;br /&gt;
&lt;br /&gt;
{{cmd|# apk add secureboot-hook systemd-efistub efibootmgr}}&lt;br /&gt;
&lt;br /&gt;
{{Note|From Alpine Linux v3.22, {{pkg|gummiboot-efistub}} doesn’t work. {{pkg|systemd-efistub}} only provides EFI stub binaries, and it doesn’t depend on any systemd components.}}&lt;br /&gt;
&lt;br /&gt;
Adjust parameter &amp;lt;code&amp;gt;cmdline&amp;lt;/code&amp;gt; in {{path|/etc/kernel-hooks.d/secureboot.conf}}. It should &#039;&#039;&#039;not&#039;&#039;&#039; contain an &amp;lt;code&amp;gt;initrd=&amp;lt;/code&amp;gt; parameter! Example of a valid &amp;lt;code&amp;gt;cmdline&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cmdline=&amp;quot;root=UUID=&amp;lt;uuid-of-your-root-fs&amp;gt; modules=ext4&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run kernel hooks: {{cmd|# apk fix kernel-hooks}}&lt;br /&gt;
&lt;br /&gt;
Disable {{pkg|mkinitfs}} trigger: {{cmd|# echo &#039;disable_trigger{{=}}yes&#039; &amp;gt;&amp;gt; /etc/mkinitfs/mkinitfs.conf}}&lt;br /&gt;
&lt;br /&gt;
Add boot entry: {{cmd|# efibootmgr --disk &amp;lt;dev&amp;gt; --part 1 --create --label &#039;Alpine Linux&#039; --load /Alpine/linux-lts.efi --verbose}}&lt;br /&gt;
&lt;br /&gt;
Note: This procedure only needs to be done once; after that the Unified Kernel Image will be generated automatically every time the kernel is upgraded.&lt;br /&gt;
&lt;br /&gt;
== Enrolling UEFI keys ==&lt;br /&gt;
&lt;br /&gt;
Copy all *.esl, *.auth files from {{path|/etc/uefi-keys}} to a FAT formatted file system (you can use EFI system partition).&lt;br /&gt;
&lt;br /&gt;
Launch firmware setup utility and enrol db, KEK and PK certificates (in this order!). Firmwares have various different interfaces; the following steps for ThinkPad T14s are just an example.&lt;br /&gt;
&lt;br /&gt;
# Reboot system and enter ThinkPad Setup (F1).&lt;br /&gt;
# Go to &#039;&#039;&#039;Security&#039;&#039;&#039; &amp;gt; &#039;&#039;&#039;Secure Boot&#039;&#039;&#039;&lt;br /&gt;
# Change &#039;&#039;&#039;Secure Boot&#039;&#039;&#039; to &#039;&#039;&#039;Enabled&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Reset to Setup Mode&#039;&#039;&#039;&lt;br /&gt;
# Go to &#039;&#039;&#039;Key Management&#039;&#039;&#039;&lt;br /&gt;
# &#039;&#039;&#039;Authorized Signature Database (DB)&#039;&#039;&#039;&lt;br /&gt;
#* &#039;&#039;&#039;Enroll DB&#039;&#039;&#039; &amp;gt; select your Flash Drive &amp;gt; select &#039;&#039;&#039;db.auth&#039;&#039;&#039;&lt;br /&gt;
#* &#039;&#039;&#039;Delete DB&#039;&#039;&#039; &amp;gt; delete Microsoft certificates (optional)&lt;br /&gt;
# &#039;&#039;&#039;Key Exchange Key (KEK)&#039;&#039;&#039;&lt;br /&gt;
#* &#039;&#039;&#039;Enroll KEK&#039;&#039;&#039; &amp;gt; select your Flash Drive &amp;gt; select &#039;&#039;&#039;KEK.auth&#039;&#039;&#039;&lt;br /&gt;
#* &#039;&#039;&#039;Delete KEK&#039;&#039;&#039; &amp;gt; delete Microsoft certificates (optional)&lt;br /&gt;
# &#039;&#039;&#039;Platform Key (PK)&#039;&#039;&#039; &amp;gt; &#039;&#039;&#039;Enroll PK&#039;&#039;&#039; &amp;gt; select your Flash Drive &amp;gt; select &#039;&#039;&#039;PK.auth&#039;&#039;&#039; (this MUST be the last!)&lt;br /&gt;
# Go to top, &#039;&#039;&#039;Restart&#039;&#039;&#039; &amp;gt; &#039;&#039;&#039;Exit Saving Changes&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Some devices, such as HP Pavilion laptops, cannot enroll keys through the interface. Instead, you must follow the following steps (steps 1-5 and 9-12 may vary depending on the computer, they are for HP Pavilion laptops as an example):&lt;br /&gt;
# Reboot system and enter HP Bios Setup Utility (F10).&lt;br /&gt;
# Go to &#039;&#039;&#039;System Configuration&#039;&#039;&#039;&lt;br /&gt;
# Change &#039;&#039;&#039;Secure Boot&#039;&#039;&#039; to &#039;&#039;&#039;Disabled&#039;&#039;&#039;&lt;br /&gt;
# Select &#039;&#039;&#039;Clear All Secure Boot Keys&#039;&#039;&#039;&lt;br /&gt;
# Press F10 to save settings&lt;br /&gt;
# Reboot system and enter Alpine Linux&lt;br /&gt;
# Enable the [[Repositories|Community Repository]]&lt;br /&gt;
# Run the following commands: &lt;br /&gt;
{{cmd|# apk update&lt;br /&gt;
&amp;amp;#35; apk add sbctl&lt;br /&gt;
&amp;amp;#35; sbctl create-keys&lt;br /&gt;
&amp;amp;#35; sbctl sign /boot/efi/Alpine/linux-lts.efi&lt;br /&gt;
&amp;amp;#35; sbctl enroll-keys -m  }}&lt;br /&gt;
# &amp;lt;li value=&amp;quot;9&amp;quot;&amp;gt; Reboot system and enter HP Bios Setup Utility (F10).&lt;br /&gt;
# Go to &#039;&#039;&#039;System Configuration&#039;&#039;&#039;&lt;br /&gt;
# Change &#039;&#039;&#039;Secure Boot&#039;&#039;&#039; to &#039;&#039;&#039;Enabled&#039;&#039;&#039;&lt;br /&gt;
# Press F10 to save settings&lt;br /&gt;
&lt;br /&gt;
Note: If you needed to use sbctl, you will have to run &amp;lt;code&amp;gt;sbctl sign /boot/efi/Alpine/linux-lts.efi&amp;lt;/code&amp;gt; every time you upgrade the kernel. You should &#039;&#039;&#039;not&#039;&#039;&#039; need to disable secure boot, so long as you sign the new Unified Kernel Image before you reboot.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
In some cases on some older motherboards, the firmware will reject UEFI executables signed by sbsign. In that case, [https://github.com/mtrojnar/osslsigncode osslsigncode] may work instead.&amp;lt;sup&amp;gt;[https://superuser.com/a/1560609]&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Initramfs init]]&lt;br /&gt;
* &amp;lt;code&amp;gt;mkinitfs-bootparam(7)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [https://wiki.gentoo.org/wiki/User:Sakaki/Sakaki%27s_EFI_Install_Guide/Configuring_Secure_Boot Sakaki&#039;s EFI Install Guide/Configuring Secure Boot - Gentoo Wiki]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot Unified Extensible Firmware Interface/Secure Boot - ArchWiki]&lt;br /&gt;
* [https://github.com/jirutka/efi-mkuki efi-mkuki: EFI Unified Kernel Image Maker] (used by the {{pkg|secureboot-hook}} package)&lt;br /&gt;
&lt;br /&gt;
[[Category:Booting]] [[Category:UEFI]]&lt;/div&gt;</summary>
		<author><name>Coolreader18</name></author>
	</entry>
</feed>