Enable LUKS2 and Argon2 Support for Packages - Gentoo Configuration Guide: Full Disk LUKS2 with GRUB and systemd (2024)

Because the LUKS partition uses LUKS2 and Argon2id, support for these LUKSconfigurations must be enabled for all software packages that unlock the LUKSpartition.

Set USE Flags

The following USE settings need to be added to /etc/portage/package.use:

sys-apps/systemd cryptsetupsys-boot/grub device-mappersys-fs/cryptsetup argon2 -static-libs

The detailed instructions to do this are available in theHandbook.

The USE flag settings for sys-fs/cryptsetup above should not change anythingas they are the same as the package’s default USE flag settings, so they do notneed to be explicitly declared; rather, they are included for completeness.The argon2 USE flag must be enabled for Argon2id support. The static-libsUSE flag must be disabled so cryptsetup can be built into the initramfs bydracut, or else the LUKS partition could not be unlocked during boot.

Add Patches for GRUB

Neither GRUB 2.12 nor GRUB 2.06 supports the Argon2id PBKDF; GRUB 2.06 even hasmore limitations on LUKS2 support. Therefore, both GRUB 2.12 and GRUB 2.06need some patches for LUKS2 with Argon2id support.

GRUB 2.12

GRUB 2.12 only needs one patch grub-2.12-luks2-argon2-v4.patch to getsupport for LUKS2 with Argon2. This patch was originally submitted to thegrub-devel mailing list and targeted GRUB 2.06; I portedit to GRUB 2.12, and it still works.

This patch has not been merged into GRUB, nor is it likely to be merged in thefuture. The patch’s author commented that, after the patchhad been created, one dependency of GRUB gained Argon2 support, so the best wayto add Argon2 support to GRUB became upgrading that dependency in GRUB’s sourcetree. What the patch does instead is adding the Argon2 referenceimplementation to GRUB, which has become redundant after the said dependency’snew version would also add Argon2 support.

To apply this patch to Gentoo’s GRUB package – sys-boot/grub, add it as aPortage user patch to/etc/portage/patches/sys-boot/grub-2.12. Patches at this location areapplied to all Gentoo revisions of GRUB 2.12 (-r1, -r2, etc.). Thefollowing commands may be used to do this:

# mkdir -p /etc/portage/patches/sys-boot/grub-2.12# cd /etc/portage/patches/sys-boot/grub-2.12# curl -O https://leo3418.github.io/res/collections/gentoo-config-luks2-grub-systemd/grub-2.12-luks2-argon2-v4.patch

Readers who are interested in learning more about Portage’s user patch featureare welcome to read another article on this websitethat discusses it in depth.

Because this patch modifies the file grub-core/Makefile.core.def, accordingto the sys-boot/grub ebuild, the GRUB_AUTOGEN andGRUB_AUTORECONF environment variables must be set. Otherwise, any buildsof the package with the patch applied would fail. The environment variablecan be set exclusively for all Gentoo revisions of sys-boot/grub-2.12 in file/etc/portage/env/sys-boot/grub-2.12:

# mkdir -p /etc/portage/env/sys-boot# echo -e 'GRUB_AUTOGEN=1\nGRUB_AUTORECONF=1' >> /etc/portage/env/sys-boot/grub-2.12

GRUB 2.06

GRUB 2.06’s support for LUKS2 is more limited.Although code implementing partial LUKS2 support exists in this version, thebootloader files installed using the default procedure do not support LUKS2.

Luckily, after applying the following patches to GRUB 2.06, LUKS2 support canbe added to the installed bootloader files automatically, and Argon2id issupported too.

  • 4500-grub-2.06-runtime-memregion-alloc.patch: A patch set that allows GRUB to allocate newconsecutive and large memory chunks, which is a prerequisite for Argon2support in GRUB. Argon2 enhances the security of LUKS by increasing the sizeof memory required for unlocking computations, so GRUB must be able toallocate more memory when needed. This patch set was cherry-picked fromGRUB 2.12.

  • 5000-grub-2.06-luks2-argon2-v4.patch: The patch set that adds Argon2 supportit*elf to GRUB. This patch is equivalent to the only patch needed for GRUB2.12 mentioned above.

  • 9500-grub-AUR-improved-luks2.patch: A patch included inthe grub-improved-luks2-git package on theAUR, which is what the Arch Wiki’s GRUB article recommends for users seekinggreat LUKS2 support in GRUB. This patch allows GRUB 2.06’s grub-installcommand to automatically install bootloader files with LUKS2 support.

The numbers in front of the patches’ file names are there only to control theorder in which they are applied (patches with a smaller ordinal are appliedfirst). As long as the order is maintained, these numbers’ values arearbitrary.

Similar to the case of GRUB 2.12, add these patches as Portage user patches to/etc/portage/patches/sys-boot/grub-2.06:

# mkdir -p /etc/portage/patches/sys-boot/grub-2.06# cd /etc/portage/patches/sys-boot/grub-2.06# curl -O https://leo3418.github.io/res/collections/gentoo-config-luks2-grub-systemd/4500-grub-2.06-runtime-memregion-alloc.patch# curl -O https://leo3418.github.io/res/collections/gentoo-config-luks2-grub-systemd/5000-grub-2.06-luks2-argon2-v4.patch# curl -O https://leo3418.github.io/res/collections/gentoo-config-luks2-grub-systemd/9500-grub-AUR-improved-luks2.patch

Then, add the required environment variables to/etc/portage/env/sys-boot/grub-2.06:

# mkdir -p /etc/portage/env/sys-boot# echo -e 'GRUB_AUTOGEN=1\nGRUB_AUTORECONF=1' >> /etc/portage/env/sys-boot/grub-2.06

New Installation Only: Initialize Portage

If a new Gentoo installation is being performed, then please follow theinstructions in the following Handbook sections under the Configuring Portagechapter:

  1. Installing a Gentoo ebuild repository snapshot from the web
  2. Optional: Updating the Gentoo ebuild repository
  3. Reading news items
  4. Choosing the right profile

Rebuild Packages

First, build sys-boot/grub with the patches applied. Before starting thebuild, please make sure that in the output of emerge,GRUB_PLATFORMS="efi-64" is enabled for sys-boot/grub. In other words,please check that efi-64 is listed without a minus sign (-) in front ofit under GRUB_PLATFORMS. If this is not true, the Handbook has relatedinstructions to fix it.

# emerge --ask --verbose sys-boot/grubThese are the packages that would be merged, in order:Calculating dependencies... done![ebuild N ] sys-boot/grub-2.06-r2:2/2.06-r2::gentoo USE="device-mapper fonts nls themes -doc -efiemu -libzfs -mount -sdl (-test) -truetype" GRUB_PLATFORMS="efi-64 pc -coreboot -efi-32 -emu -ieee1275 (-loongson) -multiboot -qemu (-qemu-mips) -uboot -xen -xen-32 -xen-pvh" 8171 KiBTotal: 1 package (1 new), Size of downloads: 8171 KiBWould you like to merge these packages? [Yes/No]

Next, update the system’s world set to apply the USE flag changes:

# emerge --ask --verbose --update --deep --newuse @world
Enable LUKS2 and Argon2 Support for Packages - Gentoo Configuration Guide: Full Disk LUKS2 with GRUB and systemd (2024)
Top Articles
Knowledge Base
WALLIX - CYBERSECURITY SIMPLIFIED
Spectrum Gdvr-2007
Patreon, reimagined — a better future for creators and fans
Inducement Small Bribe
Access-A-Ride – ACCESS NYC
How To Do A Springboard Attack In Wwe 2K22
Identifont Upload
Toyota Campers For Sale Craigslist
Comforting Nectar Bee Swarm
Lost Ark Thar Rapport Unlock
Zitobox 5000 Free Coins 2023
Is Csl Plasma Open On 4Th Of July
Craigslist - Pets for Sale or Adoption in Zeeland, MI
Flat Twist Near Me
Apnetv.con
Violent Night Showtimes Near Amc Fashion Valley 18
Mndot Road Closures
Jesus Revolution Showtimes Near Chisholm Trail 8
Strange World Showtimes Near Amc Braintree 10
Clairememory Scam
Select Truck Greensboro
Mlb Ballpark Pal
Miss America Voy Forum
Best Fare Finder Avanti
Uky Linkblue Login
Costco Gas Foster City
Divina Rapsing
Craigslist Southern Oregon Coast
Puretalkusa.com/Amac
Xfinity Outage Map Fredericksburg Va
Aliciabibs
Nottingham Forest News Now
Maths Open Ref
Mawal Gameroom Download
Lawrence Ks Police Scanner
Ucm Black Board
Quality Tire Denver City Texas
In Branch Chase Atm Near Me
The Wichita Beacon from Wichita, Kansas
Watchdocumentaries Gun Mayhem 2
Pensacola Cars Craigslist
Craigslist Tulsa Ok Farm And Garden
Www.craigslist.com Waco
If You're Getting Your Nails Done, You Absolutely Need to Tip—Here's How Much
Emily Browning Fansite
Wilson Tire And Auto Service Gambrills Photos
Sherwin Source Intranet
2000 Ford F-150 for sale - Scottsdale, AZ - craigslist
786 Area Code -Get a Local Phone Number For Miami, Florida
Leslie's Pool Supply Redding California
Latest Posts
Article information

Author: Dean Jakubowski Ret

Last Updated:

Views: 5612

Rating: 5 / 5 (50 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Dean Jakubowski Ret

Birthday: 1996-05-10

Address: Apt. 425 4346 Santiago Islands, Shariside, AK 38830-1874

Phone: +96313309894162

Job: Legacy Sales Designer

Hobby: Baseball, Wood carving, Candle making, Jigsaw puzzles, Lacemaking, Parkour, Drawing

Introduction: My name is Dean Jakubowski Ret, I am a enthusiastic, friendly, homely, handsome, zealous, brainy, elegant person who loves writing and wants to share my knowledge and understanding with you.