Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
LUKS and LVM: Initramfs necessary?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Noose
n00b
n00b


Joined: 22 Aug 2015
Posts: 4

PostPosted: Tue Aug 25, 2015 7:20 pm    Post subject: LUKS and LVM: Initramfs necessary? Reply with quote

So I'm right now configuring a kernel from gentoo-sources and I'm checking all the boxes for the encryption I'm using, for my file systems as well as for LVM. I set these as [*] and not as modules.

The Wiki says I need an initramfs to proceed, even though my /boot is ext2 which contains the kernel. Will the kernel not load before / is loaded, or how does it work? Can I get this done without the initramfs?

Basically I've got an ext2 /boot and then a LUKS partition with LVM on top, containing swap, / and /home.
Back to top
View user's profile Send private message
frostschutz
Advocate
Advocate


Joined: 22 Feb 2005
Posts: 2970
Location: Germany

PostPosted: Tue Aug 25, 2015 7:49 pm    Post subject: Reply with quote

kernel is stoopid

if your root partition is encrypted or on lvm or raid, it needs initramfs to help set things up

If you have a regular root partition (unencrypted etc.) and use LUKS/LVM for other things (data only) you can get away without initramfs, otherwise you'll need it.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7133
Location: almost Mile High in the USA

PostPosted: Tue Aug 25, 2015 7:50 pm    Post subject: Reply with quote

Chances are, no. The whole point of initramfs is to set up your root partition so that the kernel can use it.

Basically you just need to think of it this way: how many steps do you need to do before you can use a root partition after all the drivers are loaded?

If the answer is more than 1, initramfs is needed.

Examples:
Mount regular root partition from a hard disk... 1, done. No initramfs needed

mount root on autoscanned mdraid 0.9 superblock partition ... 1, done. No initramfs needed

mount encrypted root filesystem after setting up decryption key... 2. Problem! Need initramfs.

mount encrypted filesystem root on lvm after setting up encryption key... 3. Problem! Need initramfs.

mount encrypted filesystem root on lvm over mdraid 1.2 superblock after setting up encryption key... 4. Problem! Need initramfs.

mount root on lvm... 2. Problem! need initramfs.

Well, hopefully this is clear enough... or maybe not because things change.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43198
Location: 56N 3W

PostPosted: Tue Aug 25, 2015 8:18 pm    Post subject: Reply with quote

Noose,

If you need to run any userspace tools to mount root, they go in the initrd.

Your bootloader makes its own arrangements for reading the kernel into RAM and optionally, an initrd.
The bootloader cannot use the kernel to load the kernel ...

The initrd is a root filesfstem in a file. Provided it does not contain any kernel modules, think of it an firmware,
It should never need to be updated. I made my initrd in 2009.

You need to run at least vgchange, to make your logical volumes visable. Thats a userspace tool.
As you have LVM on top of LUKS, you need to open the LUKS volume first. Thats another userspace tool.

The kernel can't help you yet because it can't get to root no LVM on LUKS until it has the userspace tools that aro on the root filesystem.

The kernel mounts the initrd as a temporary root filesystem and runs a script to access, then mount the real root filesystem.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Tue Aug 25, 2015 8:26 pm    Post subject: Reply with quote

just use genkernel to create an initramfs only with lvm and lunks support.

Everything explained there with several opinions https://forums.gentoo.org/viewtopic-t-1027276-highlight-.html
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo 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