Custom kernel problems after encrypting disk
Hi all,
I followed the excellent guide to encrypting my laptop hard drive at http://slackware.osuosl.org/slackware/README_CRYPT.TXT on Slack 12.1. Everything went well, until I came to install my own 2.6.25.4 kernel. I followed (Bruce Hill's I think) kernel compile guide, which in short consisted of the following: Code:
Extract source Code:
image = /boot/vmlinuz-2.6.25.4 Code:
image = /boot/vmlinuz-generic-smp-2.6.24.5-smp Code:
CONFIG_EXT3=y Code:
VFS: Cannot open root device "fd02" or unknown-block(253,2) What have I missed? Do I have to create a separate initrd.gz for each kernel, for instance: Code:
2.6.24.5-smp-initrd.gz Mark. |
Did you correctly generate initrd.gz file and initrd-tree subdir in /boot ?
That should be done after placing your new modules in /lib/modules/ and kernel image file in /boot. I used the following command to do it (kernel generic 2.6.24.7-smp from Patrick V.) while succesfully upgrading to current kernel: mkinitrd -c -k 2.6.24.7-smp -m ext3 -f ext3 -r /dev/cryptvg/root -C /dev/sda3 -L Try to compare your kernel settings with settings applied by Patrick V. My first reboot attempt failed due to my faulty /dev/sda2 definition in the mkinitrd command sequence but I was able to correct that: http://www.linuxquestions.org/questi...ukslvm-669700/ |
Hi,
Not at first - and this is where I think I went wrong. The newer 2.6.25.4 wouldn't boot. So I did the following: Code:
mv /boot/initrd.gz initrd-old.gz Code:
mv initrd.gz initrd-didntwork.gz So now I have two kernels and neither boot. I'm pretty much resigned to the fact I'll have to do a complete rebuild, as I don't know how to get back into my encrypted drive. Any ideas? M. |
Mark,
No need to "do a complete rebuild." When you use -c with mkinitrd, it does this: Code:
mingdao@silas:~$ man mkinitrd and everything under /boot/initrd-tree, cease to exist. Therefore, the subsequent copying of the old stuff was futile. You don't need to add -L to your mkinitrd comand unless you created a LVM. Before I write "HOW-TO recover your system", can you tell me: 1 - if you've already reinstalled 2 - if you also created a LVM (and it's parameters if you did) |
Hi Bruce,
Thanks for the info on initrd. I guess simply copying the files wasn't enough. I have not rebuilt my system yet. I am using LVM, and I used the following commands to create my volumes: Code:
pvcreate /dev/mapper/slackluks Thanks, M. |
Okay, here's what you need to do to get back in to that Slackware system.
First, boot with Slackware CD1 of the DVD. Second, at the boot prompt just hit enter. Then: Code:
- Unlock the LUKS encrypted LVM: then you can start to fix it. First, I'd recreate the initrd image for the Slackware default kernel, then we can find out what's wrong with your custom kernel, once we have a working Slackware system. If you're in, then issue: Code:
cd /boot "9607 blocks" and nothing more (your blocks won't be the same). When you issue "lilo" it should output something like: Code:
root@slackware:/# lilo Now that should boot you back into your Slackware system. If so, then we can fix the custom kernel. First, let's just get the default to boot, so we can always have it to fall back on. Next time we make that initrd, we will drop the -c switch, to keep our existing modules in the initrd.gz. |
Hi Bruce,
Thanks for this info... although something weird has stopped me. I can get in, create the device nodes and mount the filesystems okay. However, if I cd to /boot, there are no files in there. I definitely set /dev/hda1 to /boot. When I run: Code:
mount Code:
/dev/mapper/cryptvg-root on / type ext3 (rw) Why would /boot show up as empty? I definitely haven't wiped it! M. |
Okay. I got in, and now I have a rescued 2.6.24.5-smp default kernel... yay!
Now I have to work out why my new custom kernel won't boot :-( How do I create a new initrd for my custom kernel with blowing away the 2.6.24.5-smp one? Thanks for your help so far... it's saved me a lot of time. M. |
Quote:
If you want to use a single initrd.gz for multiple kernels, you just omit the "-c" parameter to mkinitrd. The "-c" stands for "create" - it wipes your current /etc/initrd-tree directory (out of which your initrd.gz is created) before re-adding the requested stuff. So, the correct way to proceed is Code:
mkinitrd -k 2.6.25.4 -m ext3 -f ext3 -r /dev/cryptvg/root/ -C /dev/hda2 -L Never forget to run Code:
lilo |
Cheers Eric,
I omitted the -c but my custom kernel still didn't boot. There's obviously something still missing from it which I need to look into. M. |
What are the errors you get when your custom kernel won't boot?
|
I'm getting a bunch of warnings such as:
Code:
Using /lib/modules/2.6.24.5-smp/kernel/fs/mbcache.ko After correctly entering it in, I get: Code:
mount: mounting /dev/crypt/root/ on /mnt failed: Not a directory I'm guessing that those first errors are giving me the more serious one about not mounting my root volume. Would I be about right? M. |
Quote:
But these errors are harmless (though annoying). It is not even required to use /boot/initrd-tree/load_kernel_modules by making it executable - it is there to help you if you have to go through hoops to load your modules properly (for instance when you have to pass parameters to the modules). The other stuff you posted indicates that your initrd may have forgotten to load the driver for your ext3 filesystem. Did you really add these modules (mkinitrd -m ext3)? If so, I can only guess that you edited B]/boot/initrd-tree/load_kernel_modules[/B] (forgetting to add the modules for your new kernel) and made it executable. Eric |
As for the non-loading custom kernel, you're possibly missing something
in your .config. You need certain crypto cipher modules for DM_CRYPT to work. For sure you need SHA256, AES, and CBC. Please post your 2.6.25.4 .config file somewhere for us to see. Also would not hurt to see: ls -l /boot cat /etc/lilo.conf |
Maybe it would be easier only to upgrade your kernel/Slackware packages to PV's current state (for example 2.6.24.7-smp) as a 1st step.
That way you'll see if the procedure works. If so, then compile your own kernel. |
All times are GMT -5. The time now is 12:02 PM. |