I managed to work around the problem following the suggestion of another user: Deploying servers with full disk encryption + TPM2 key storage (with fips support)
The problem seems to be the mount order (/ then all the rest) and the missing UUIDs on disk, partition, crypt and format blocks. The final result is the following (working for both Ubuntu 22 and 24):
storage:
config:
- grub_device: true
id: sda
name: sda
ptable: gpt
type: disk
wipe: superblock
path: /dev/nvme0n1
# Partitioning
- device: sda
flag: boot
id: boot-part
name: boot-part
number: 1
offset: 4194304B
size: 998244352B
type: partition
wipe: superblock
uuid: 11111111-1111-1111-0000-000000000101
- device: sda
id: efi-part
name: efi-part
number: 2
size: 5G
type: partition
wipe: superblock
uuid: 11111111-1111-1111-0000-000000000102
- device: sda
id: lvm-part
name: lvm-part
number: 3
size: 40G
type: partition
wipe: superblock
uuid: 11111111-1111-1111-0000-000000000103
# Crypt
- id: lvm-part_crypt
type: dm_crypt
dm_name: lvm-part_crypt
volume: lvm-part
key: 123123123
keysize: '512'
uuid: 11111111-1111-1111-0002-000000000001
# LVM block
- id: vg0
name: volgroup0
type: lvm_volgroup
devices: [lvm-part_crypt]
- id: lv-root
type: lvm_partition
volgroup: vg0
name: lv_root
size: 20G
- id: fs-root
type: format
volume: lv-root
fstype: ext4
label: ''
uuid: 11111111-1111-1111-0003-000000000201
- id: mount-root
type: mount
device: fs-root
path: /
- id: lv-var
type: lvm_partition
volgroup: vg0
name: lv_var
size: 10G
- id: fs-var
type: format
volume: lv-var
fstype: ext4
label: ''
uuid: 11111111-1111-1111-0003-000000000202
- id: mount-var
type: mount
device: fs-var
path: /var
# EFI-boot block
- fstype: ext4
id: efi-part-format
label: ''
type: format
volume: efi-part
uuid: 11111111-1111-1111-0003-000000000000
- device: efi-part-format
id: efi-part-mount
options: ''
path: /boot
type: mount
- fstype: fat32
id: boot-part_format
label: efi
type: format
volume: boot-part
- device: boot-part_format
id: boot-part_mount
options: ''
path: /boot/efi
type: mount