Gentoo Install with Sytemd-boot + Ugrd/Luks

This is the second Gentoo install guide on this site. This guide focuses much on syetmd-boot with Ugrd with full disk encryption with lvm. You can check the first guide in case you missed out.

Gentoo linux installation encrypted btrfs openrc EFI stub boot secure boot tpm
Gentoo is one of my best Linux distro as compared to Arch which used to be my daily driver for quite some time. The great thing about gentoo for me is Portage; which is the package manager. This guide will take you through the many hurdles most people encounter during

Now lets get started!

Set up your UEFI Standard partition layout

cfdisk /dev/nvme0n1

Device          Start       End         Sectors    Size   Type
/dev/nvme0n1p1  882423808   884520959   2097152    1G     EFI System
/dev/nvme0n1p2  34816       629198847   629164032  300G   Linux filesystem

Create encrypted LUKS volume

cryptsetup luksFormat /dev/nvme0n1p2

Open LUKS volume

cryptsetup luksOpen /dev/nvme0n1p2 crypt

Create LVM volume group

vgcreate volg /dev/mapper/crypt
lvcreate --name root -L 100G volg
lvcreate --name swap -L 18G volg
lvcreate --name home -l 100%free volg

Format the filesystems

mkfs.vfat /dev/nvme0n1p1
mkfs.xfs /dev/volg/root
mkfs.xfs /dev/volg/home
mkswap /dev/volg/swap
swapon /dev/volg/swap

Mount paritions

mount /dev/volg/root /mnt/gentoo
mkdir /mnt/gentoo/{home,boot}
mount /dev/nvme0n1p1 /mnt/gentoo/boot
mount /dev/volg/home /mnt/gentoo/home

Stage 3 and chroot

cd /mnt/gentoo
wget https://distfiles.gentoo.org/releases/amd64/autobuilds/20250115T221822Z/stage3-amd64-systemd-20250115T221822Z.tar.xz
tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner -C /mnt/gentoo

Contine with system setup

Fetch repo data & keys

emerge-webrsync && getuto

LVM & cryptsetup


nano /etc/portage/package.use/system
sys-fs/lvm2 lvm
emerge --ask sys-fs/lvm2 sys-fs/cryptsetup
rc-update add lvm boot

Kernel install

nano /etc/portage/package.use/system

sys-kernel/installkernel ugrd systemd-boot systemd uki ukify
sys-apps/systemd-utils kernel-install boot ukify
emerge --ask --oneshot installkernel

systemd-boot

nano /etc/ugrd/config.toml

modules = [                                                                                                                                                                                                                                                                                                                                                     
  "ugrd.fs.fakeudev",                                                                                                                                                                           
]

Install

bootctl install

fstab

nano /etc/fstab

UUID=of boot_drive eg vda1 /boot vfat umask=0077 0 2

/dev/volg/root /     xfs defaults,noatime 0 1
/dev/volg/home /home xfs defaults,noatime 0 2

/dev/volg/swap none swap sw 0 0

Kernel

touch /etc/kernel/cmdline
emerge --ask gentoo-kernel-bin

Continue installaltion from the Wiki

configure the network, and set up SSH if possible.

The great thing about these setups are all everything related to initramfs are generated automatically during kernel upgrades with no manual intervention from the user.