View previous topic :: View next topic |
Author |
Message |
Noose n00b
Joined: 22 Aug 2015 Posts: 4
|
Posted: Tue Aug 25, 2015 7:20 pm Post subject: LUKS and LVM: Initramfs necessary? |
|
|
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 |
|
|
frostschutz Advocate
Joined: 22 Feb 2005 Posts: 2977 Location: Germany
|
Posted: Tue Aug 25, 2015 7:49 pm Post subject: |
|
|
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 |
|
|
eccerr0r Watchman
Joined: 01 Jul 2004 Posts: 9679 Location: almost Mile High in the USA
|
Posted: Tue Aug 25, 2015 7:50 pm Post subject: |
|
|
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/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching? |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54236 Location: 56N 3W
|
Posted: Tue Aug 25, 2015 8:18 pm Post subject: |
|
|
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 |
|
|
Roman_Gruber Advocate
Joined: 03 Oct 2006 Posts: 3846 Location: Austro Bavaria
|
|
Back to top |
|
|
|