<?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=Juan</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=Juan"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Juan"/>
	<updated>2026-05-05T03:34:12Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Setting_up_encrypted_volumes_with_LUKS&amp;diff=29235</id>
		<title>Setting up encrypted volumes with LUKS</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Setting_up_encrypted_volumes_with_LUKS&amp;diff=29235"/>
		<updated>2025-03-11T22:08:56Z</updated>

		<summary type="html">&lt;p&gt;Juan: Add note about how to decrypt a volume before mounting via fstab&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://en.wikipedia.org/wiki/Linux%20Unified%20Key%20Setup LUKS] allows encrypting a partition and mapping it as a virtual block device, which can then be used as a normal partition. Guides for other Linux distributions should serve as a general references for installing Alpine onto a LUKS encrypted disk.&lt;br /&gt;
&lt;br /&gt;
The installer has built-in support for encryption. The default installer will not encrypt the swap partition and the boot partition. To setup Alpine Linux with an encrypted swap partition, refer to [[LVM on LUKS]]. The GRUB bootloader supports BIOS and EFI boot with an encrypted boot partition.&lt;br /&gt;
&lt;br /&gt;
== Decrypting non-root volumes during boot ==&lt;br /&gt;
&lt;br /&gt;
Differently to other Linux distributions, Alpine does not use the file &amp;lt;code&amp;gt;/etc/crypttab&amp;lt;/code&amp;gt;. Instead, to have an encrypted volume be decrypted prior to automatically mounting it somewhere via &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;, you must configure &amp;lt;code&amp;gt;dmcrypt&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;/etc/conf.d/dmcrypt&amp;lt;/code&amp;gt;. The comments inside that file should guide you, but as a simple example, here&#039;s what you should include in that file to decrypt and map a partition to some volume named, say, “&amp;lt;code&amp;gt;myvolume&amp;lt;/code&amp;gt;”, given its UUID (here represented using a series of &amp;lt;code&amp;gt;X&amp;lt;/code&amp;gt;s), using a passphrase:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
target=myvolume&lt;br /&gt;
source=UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;, then, you would include the following line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/dev/mapper/myvolume	&amp;lt;path&amp;gt;	&amp;lt;fstype&amp;gt;	&amp;lt;options&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
substituting in the proper parameters.&lt;br /&gt;
&lt;br /&gt;
== mkinitfs and LUKS ==&lt;br /&gt;
&lt;br /&gt;
For those familiar with setting up FDE on other Linux distributions, this section contains only Alpine-specific knowledge required is understanding [[mkinitfs]].&lt;br /&gt;
&lt;br /&gt;
First of all, the &amp;lt;code&amp;gt;cryptsetup&amp;lt;/code&amp;gt; feature needs to be added to {{path|/etc/mkinitfs/mkinitfs.conf}}. Additionally, the following kernel parameters are required:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;cryptroot&amp;lt;/code&amp;gt; kernel parameter should point to the encrypted block device. &lt;br /&gt;
* &amp;lt;code&amp;gt;cryptdm&amp;lt;/code&amp;gt;: the name that will be given to the device.&lt;br /&gt;
* &amp;lt;code&amp;gt;root&amp;lt;/code&amp;gt; kernel parameter should point to the mapped block device: &amp;lt;code&amp;gt;/dev/mapper/&amp;lt;name used in cryptdm&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;code&amp;gt;rootfstype&amp;lt;/code&amp;gt;: the filesystem type of the root partition (e.g.: &amp;lt;code&amp;gt;btrfs&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For example if you use grub with GPT partition table, no LVM and ext4 you will have in {{path|/etc/default/grub}}:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
GRUB_TIMEOUT=2&lt;br /&gt;
GRUB_DISABLE_SUBMENU=y&lt;br /&gt;
GRUB_DISABLE_RECOVERY=true&lt;br /&gt;
GRUB_CMDLINE_LINUX_DEFAULT=&amp;quot;modules=sd-mod,usb-storage,ext4 quiet rootfstype=ext4 cryptroot=UUID=a7dc90c4-6746-417e-b25b-cb8769ee6334 cryptdm=alpine-rootfs  root=/dev/mapper/alpine-rootfs&amp;quot;&lt;br /&gt;
GRUB_PRELOAD_MODULES=&amp;quot;luks cryptodisk part_gpt&amp;quot;&lt;br /&gt;
GRUB_ENABLE_CRYPTODISK=y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[LVM on LUKS]]&lt;br /&gt;
* [[mkinitfs|Initramfs init]]&lt;br /&gt;
* [[Full disk encryption secure boot]]&lt;br /&gt;
* [https://wiki.archlinux.org/index.php/Dm-crypt dm-crypt on ArchWiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Storage]]&lt;br /&gt;
[[Category:Security]]&lt;/div&gt;</summary>
		<author><name>Juan</name></author>
	</entry>
</feed>