Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] LUKS + LVM + LILO = No Work
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
arantius
n00b
n00b


Joined: 03 Jan 2004
Posts: 59

PostPosted: Mon Dec 14, 2009 1:12 am    Post subject: [SOLVED] LUKS + LVM + LILO = No Work Reply with quote

I'm setting up a new machine with Gentoo. I've done this a number of times and am very comfortable with it. I've decided this time, however, to add disk encryption into the mix, and am having terrible trouble. At this point I have the disk set up, and Gentoo installed, by virtue of the LiveCD, but am unable to boot this disk. From the LiveCD, I can do:

Code:
# fdisk -l /dev/sda

Disk /dev/sda: 640.1 GB, 640135028736 bytes
255 heads, 63 sectors/track, 77825 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x83e6d949

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1          34      273073+  83  Linux
/dev/sda2              35       77825   624856207+  8e  Linux LVM
# cryptsetup luksOpen /dev/sda2 root
Enter LUKS passphrase:
key slot 0 unlocked.
Command successful.
# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "vg" using metadata type lvm2
# vgchange -ay
  5 logical volume(s) in volume group "vg" now active
# ls -l /dev/mapper/
total 0
lrwxrwxrwx 1 root root     16 Dec 13 19:25 control -> ../device-mapper
brw-rw---- 1 root disk 253, 0 Dec 13 19:29 root
brw-rw---- 1 root disk 253, 5 Dec 13 19:29 vg-home
brw-rw---- 1 root disk 253, 2 Dec 13 19:29 vg-root
brw-rw---- 1 root disk 253, 1 Dec 13 19:29 vg-swap
brw-rw---- 1 root disk 253, 3 Dec 13 19:29 vg-tmp
brw-rw---- 1 root disk 253, 4 Dec 13 19:29 vg-var
# mount /dev/mapper/vg-root /mnt/gentoo
# mount /dev/sda1           /mnt/gentoo/boot
# mount /dev/mapper/vg-home /mnt/gentoo/home
# mount /dev/mapper/vg-tmp  /mnt/gentoo/tmp
# mount /dev/mapper/vg-var  /mnt/gentoo/var
# mount -t proc none /mnt/gentoo/proc
# mount -o bind /dev /mnt/gentoo/dev
# chroot /mnt/gentoo/ /bin/bash


And I'm in and set up, the system is working -- from the LiveCD only. At this point I need to get it booting on its own. Something about the system doesn't work with grub. It detects 0k of upper mem, and will not run _any_ command. So I am trying LILO. I built a kernel and initrd, statically linking device mapper, crypt target, and AES ciphers, during the menuconfig step, and set up LILO:

Code:
# genkernel --menuconfig --install --symlink --lvm --luks all
# genkernel --menuconfig --install --symlink --lvm --luks --makeopts=-j11 all   * Gentoo Linux Genkernel; Version 3.4.10.904
* Running with options: --menuconfig --install --symlink --lvm --luks --makeopts=-j11 all

* Linux Kernel 2.6.28-hardened-r9 for x86...
* kernel: >> Running mrproper...
* config: Using config from /etc/kernels/kernel-config-x86-2.6.28-hardened-r9
*         Previous config backed up to .config.bak
*         >> Running oldconfig...
* kernel: >> Cleaning...
* config: >> Invoking menuconfig...


*** End of Linux kernel configuration.
*** Execute 'make' to build the kernel or try 'make help'.

*         >> Compiling 2.6.28-hardened-r9 bzImage...
*         >> Compiling 2.6.28-hardened-r9 modules...
* Copying config for successful build to /etc/kernels/kernel-config-x86-2.6.28-hardened-r9
* busybox: >> Using cache
* initramfs: >> Initializing...
*         >> Appending base_layout cpio data...
*         >> Appending auxilary cpio data...
*         >> Appending busybox cpio data...
*         >> Appending lvm cpio data...
*               LVM: Adding support (compiling binaries)...
*         >> Appending luks cpio data...
* Including LUKS support
*         >> Appending modules cpio data...
*
* Kernel compiled successfully!
*
* Required Kernel Parameters:
*     real_root=/dev/$ROOT
*
*     Where $ROOT is the device node for your root partition as the
*     one specified in /etc/fstab
*
* If you require Genkernel's hardware detection features; you MUST
* tell your bootloader to use the provided INITRAMFS file. Otherwise;
* substitute the root argument for the real_root argument if you are
* not planning to use the initramfs...

* WARNING... WARNING... WARNING...
* Additional kernel cmdline arguments that *may* be required to boot properly...
* add "dolvm" for lvm support

* Do NOT report kernel bugs as genkernel bugs unless your bug
* is about the default genkernel configuration...
*
* Make sure you have the latest genkernel before reporting bugs.
# cat /etc/lilo.conf
append="init=/linuxrc ramdisk=8192 dolvm crypt_root=/dev/sda2 real_root=/dev/mapper/vg-root splash=silent,theme:emerge-world console=tty1 quiet"
boot=/dev/sda
compact
default=gentoo
lba32
prompt
read-write
root=/dev/ram0
timeout=50
vga=791

image=/boot/kernel
  initrd=/boot/initramfs
  label=gentoo

image=/boot/kernel.old
  initrd=/boot/initramfs.old
  label=backup
  optional
# /sbin/lilo
Added gentoo *
Added backup


Now, if I reboot, I see the LILO boot menu, then (very briefly, so paraphrased), "loading gentoo" and something about a successful BIOS check. Then a black screen that never goes away. No progress messages, no error messages, nothing. And I can't figure out what's wrong.


Last edited by arantius on Sun Dec 20, 2009 4:08 pm; edited 1 time in total
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8831

PostPosted: Tue Dec 15, 2009 3:26 am    Post subject: Reply with quote

If you need to debug the boot process, you should probably turn off features that play games with early boot display and let the kernel stick to straight text mode. Remove your splash support and the quiet option. Check that you have enabled x86 verbose boot messages. Then retry to see if you can get better diagnostic output.
Back to top
View user's profile Send private message
arantius
n00b
n00b


Joined: 03 Jan 2004
Posts: 59

PostPosted: Wed Dec 16, 2009 1:10 am    Post subject: Reply with quote

Quite right. I recompiled the kernel to be sure, but verbose x86 debugging was already selected. I changed lilo.conf's append line to

Code:
append="init=/linuxrc ramdisk=8192 dolvm crypt_root=/dev/sda2 real_root=/dev/mapper/vg-root"


And tried again. Exact same symptoms.
Back to top
View user's profile Send private message
arantius
n00b
n00b


Joined: 03 Jan 2004
Posts: 59

PostPosted: Sun Dec 20, 2009 4:08 pm    Post subject: Reply with quote

I believe it was the "vga=" line. I have no idea why it wouldn't work, but with that removed, I'm booted!
Back to top
View user's profile Send private message
knifeyspoony
n00b
n00b


Joined: 01 Jun 2005
Posts: 70

PostPosted: Sat Jan 02, 2010 5:44 pm    Post subject: Reply with quote

The blog post arantius wrote with your help constitutes the only complete, succinct guide to encrypted root I've ever seen.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security 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