Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Partition type UUID for LUKS encrypted RootFS
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
nagmat84
Apprentice
Apprentice


Joined: 27 Mar 2007
Posts: 219

PostPosted: Fri May 03, 2024 12:15 pm    Post subject: [SOLVED] Partition type UUID for LUKS encrypted RootFS Reply with quote

I want a LUKS-encrypted RootFS and I am following Gentoo Wiki: RootFS Encryption. I am partioning my disk with gdisk and I am wondering which of the following partitions types is more appropriate:
  • Linux x86-64 root (/), Gdisk code 8304, UUID 4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709
  • Linux LUKS, Gdisk code 8309, UUID CA7D7CCB-63ED-4C53-861C-1742536059CC
According to the Wiki guide it seems to be 8304. But this leaves the question when should 8309 be used?


Last edited by nagmat84 on Sat May 04, 2024 6:17 am; edited 1 time in total
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 21726

PostPosted: Fri May 03, 2024 12:37 pm    Post subject: Reply with quote

What tools will you be using that read and respect the type code? If this is only for display to humans, then likely you are the only one who will ever see it, so you can pick whatever you like. Personally, I would go with 8309 on the basis that I interpret 8304 to be an unencrypted and directly usable root partition. A root partition wrapped in LUKS is not directly usable; it must first be unlocked, and the resulting mapper device is a usable root filesystem.
Back to top
View user's profile Send private message
nagmat84
Apprentice
Apprentice


Joined: 27 Mar 2007
Posts: 219

PostPosted: Fri May 03, 2024 12:57 pm    Post subject: Reply with quote

I am using the normal Gentoo tools, nothing unusual. rEFInd as my boot manager, SystemD as my init system, Dracut to build initramfs, etc. I don't know if any of those tools actually use the partition type UUID for some auto-mapping or similar magic stuff. That is part of the question.

If you say that none of those tools actually evaluate the partition type UUID, I probably go with "Linux LUKS" as you suggested.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 21726

PostPosted: Fri May 03, 2024 2:06 pm    Post subject: Reply with quote

I am not aware of any of those tools using the partition type field. I doubt systemd would need to care, since it only runs after you boot. I could believe rEFInd or dracut inspecting it to automate informing the kernel of the root partition, but if they do, they likely would expect that the partition is directly usable as a root filesystem. When it has LUKS wrapping, it is not directly usable, so even if they do inspect it, they would likely be misled by giving it type 8304.
Back to top
View user's profile Send private message
nagmat84
Apprentice
Apprentice


Joined: 27 Mar 2007
Posts: 219

PostPosted: Sat May 04, 2024 6:15 am    Post subject: Reply with quote

I correct my previous answer. Linux x86-64 root (/) (Gdisk type code 8304) is the correct partition type even for LUKS encrypted partitions. The same Wiki article Gentoo Wiki: RootFS Encryption states
Quote:
[...], the volume is opened and mapped to /dev/mapper/root, as suggested by the Discoverable Partitions Specification
and the linked article UAPI Group: Discoverable Partitions Specificationsays
Quote:
On systems with matching architecture, the first partition with this type UUID on the disk containing the active EFI ESP is automatically mounted to the root directory /. If the partition is encrypted with LUKS or has dm-verity integrity data (see below), the device mapper file will be named /dev/mapper/root.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum