LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Slackware 12.2 + RAID-1 + LVM + LUKS encrypted root (http://www.linuxquestions.org/questions/slackware-14/slackware-12-2-raid-1-lvm-luks-encrypted-root-691282/)

gargamel 12-17-2008 01:14 PM

Slackware 12.2 + RAID-1 + LVM + LUKS encrypted root
 
Dear all,

after some very busy months I am back with something that appears to be a challenge. For me, at least, that is.

I am trying to get Slackware 12.2 running on a system with two identical harddiscs using RAID-1, LVM and LUKS.

/dev/md0 is unencrypted /boot
/dev/md1 is for everything else and LUKS encrypted

Here is what I get:
Code:

[...]
Freeing unused kernel memory: 424k freed
Failed to execute /init
Kernel panic - not syncing: No init found.  Try passing init= option to kernel.

For details of my setup, please refer to this thread:
luks+lvm+raid
(And here I want to apologise for not delivering the promised mini-HOWTO; I was fully occupied with partially unplanned tasks, so sorry. I'll try my very best to deliver, this time, once my current problems with 12.2 are understood and solved...)

The system is still the same, however, the results of upgrading or installing 12.2 are different. The system refuses to boot. The screen messages during boot seem to suggest, that the RAID system is "seen" by the system, but the encrypted filesystem is not.

I can boot with the installation DVD, however, and
Code:

chroot
into the system, switch kernels, change /etc/lilo.conf, create a new initrd and so on. Therefore I guess that I am only missing a bit. But I'm clueless.

Thanks for any hints!

gargamel

mostlyharmless 12-17-2008 01:21 PM

Is this your 12.1 system that you upgraded, or is it a new system? I assume that if it's an upgrade that you followed the instructions meticulously (like the rc.udev part that seems to get overlooked) and that you made a new initrd.gz and that it all seemed to go without error.

I've been thinking about upgrading, but I've been nervous that the complexity of the setup (luks+lvm+raid etc) and the numerous little gotchas that seem to have occurred with 12.2 would make a lot of work...

gargamel 12-17-2008 01:34 PM

For your convenience, here is what I did.

1. Boot with the installation DVD, login as root

2. Start RAID-1
Code:

# mdadm -Es > /etc/mdadm.conf
# mdadm -As
mdadm: /dev/md0 has been started with 2 drives
mdadm: /dev/md1 has been started with 2 drives

3. Open LUKS device (well, not sure what the correct terminology here is, so correct me, if this is not the right term)
Code:

# cryptsetup luksOpen /dev/md1 slackluks
Enter LUKS passphrase: <YeahSure>
key slot 0 unlocked.
Command successful.

4. Activate logical volumes
Code:

# vgscan --mknodes
  Reading all physical volumes.  This may take a while....
  [...]some messages referring to the install dvd, not relevant here[...]
  Found volume group "cryptvg" using metadata type lvm2
# vgchange -ay
  2 logical volume(s) in volume group "cryptvg" now active

5. Install system
Code:

# setup
Add swap partitions, then select
/dev/cryptvg/root as root (/)
/dev/md0 as /boot and
/dev/cryptvg/home as /home.
I chose "Quick format" for root and /boot, but no formatting for /home.
Install full system from DVD.
Configure system, mainly LILO: Trying "simple" install to MBR with UTF-8 console support. After a few more clicks, EXIT the setup procedure.
Code:

Installation of Slackware Linux is complete.
Please remove the installation disc and press ctrl-alt-delete to reboot.

But I do not reboot immediately. Instead I check a couple of things. First, let's see what setup has mounted.
Code:

# mount
/proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
/dev/mapper/cryptvg-root on /mnt type ext3 (rw)
/dev/mapper/cryptvg-home on /mnt/home type ext3 (rw)
/dev/md0 on /mnt/boot type ext2 (rw)

6. Check LILO and initrd
Code:

# chroot /mnt
Then I check /etc/lilo.conf:
Code:

append=" vt.default_utf8=1"
boot = /dev/hda
[...]
image = /boot/vmlinuz
  root = /dev/cryptvg/root
  label = Linux
  read-only

No initrd, but root is correct. Not sure, if boot = /dev/hda will work...
Code:

# cd /boot
vmlinuz is a symlink pointing to vmlinuz-huge-smp-2.6.27.7-smp. To my understanding the "huge" kernels support everything, so no need to setup an initrd, for the moment.

7. Reboot!
I get these messages during boot time.
Code:

[...]
md: running: <hdb1><hda1>
raid1: raid set md0 active with 2 out of 2 mirrors
md: ... autorun DONE.
VFS: Cannot open root device "fd01" or unknown-block(253,1)
Please append a correct "root=" boot option; here are the available partitions:
  <list of partitions/>
0900  128384 md0 (driver?)
0901 75923072 md1 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(253,1)

8. Start over
Repeat steps 1 through 4.

9. Switch to generic SMP kernel
Code:

# mount /dev/cryptvg/root /mnt
# mount /dev/md0 /mnt/boot
# mount -o bind /proc /mnt/proc
# mount -o bind /sys /mnt/sys
# chroot /mnt
### Not sure, but AFAIK the next two commands need to be issued
from within the change root environment, although they already have
been issued before outside (as far as I know) ###
# vgscan --mknodes
# vgchange -ay
# cd /boot
# rm vmlinuz System.map config
# ln -sf vmlinuz-generic-smp-2.6.27.7-smp vmlinuz
# ln -sf System.map-generic-smp-2.6.27.7-smp System.map
# ln -sf config-generic-smp-2.6.27.7-smp config

At this point I like to verify, if the right modules are associated with the kernel:
Code:

# ls -l /etc/rc.d/rc.modules
/etc/rc.d/rc.modules -> rc.modules-2.6.27.7-smp

So this seems correct.

10. Create initrd
It's time to create the initrd. The mkinitrd command tends to get lengthy in complex environments. It is easier to edit
Code:

/etc/mkinitrd.conf
:
Code:

SOURCE_TREE="/boot/initrd-tree"
CLEAR_TREE="0"
OUTPUT_IMAGE="/boot/initrd.gz"
KERNEL_VERSION="2.6.27.7-smp"
KEYMAP="de-latin1-nodeadkeys"
MODULE_LIST="pata_acpi:ata_generic:pata_via:uhci-hcd:usbhid:mbcache:jbd:ext3"
LUKSDEV="/dev/md1"
ROOTDEV="/dev/cryptvg/root"
ROOTFS="ext3"
RESUMEDEV="/dev/hdb2"
RAID="1"
LVM="1"
WAIT="1"

This is based on the output of the mostful mkinitrd_command_generator.sh script by Eric Hameleers'.

Code:

# mkinitrd -F
6801 blocks

No error message, and in fact an intrd-tree and an initrd.gz have been created.

11. Configure LILO
Edit /etc/lilo.conf to read:
Code:

append=" vt.default_utf8=1"
boot = /dev/md0
[...]
vga = 773
[...]
image = /boot/vmlinuz
  initrd = /boot/initrd.gz
  root = /dev/cryptvg/root
  label = Linux
  read-only

Then install the new boot loader to the MBR.
Code:

# lilo
Warning: LBA32 addressing assumed
Warning: '/proc/partition' does not match '/dev' directory structure.
    Name change: '/dev/dm-0' -> '/dev/mapper/slackluks'
Warning: Name change: '/dev/dm-1' -> '/dev/cryptvg/root'
Warning: Name change: '/dev/dm-2' -> '/dev/cryptvg/home'
Warning: Unable to determine video adapter in use in the present system.
Warning: Video adapter does not support VESA BIOS extensions needed for display of 256 colors.  Boot loader will fall back to TEXT only operation.
Added Linux *
The boot record of  /dev/md0  has been updated.
6 warnings were issued.

Not sure, but I'd not be surprised if the video adapter warnings had to do with UTF-8, but they are warnings only, so I ignore them.

12. Reboot
Repeat step 7. With exactly the same result... :mad:



(to be continued) ;)

gargamel 12-17-2008 01:36 PM

Quote:

Originally Posted by mostlyharmless (Post 3378922)
Is this your 12.1 system that you upgraded, or is it a new system? I assume that if it's an upgrade that you followed the instructions meticulously (like the rc.udev part that seems to get overlooked) and that you made a new initrd.gz and that it all seemed to go without error.

I've been thinking about upgrading, but I've been nervous that the complexity of the setup (luks+lvm+raid etc) and the numerous little gotchas that seem to have occurred with 12.2 would make a lot of work...

My first attempt was to upgrade, and I may have overlooked the udev thing, indeed. But since then I am trying a fresh install, so far without the desired result, unfortunately.

gargamel

mostlyharmless 12-17-2008 02:23 PM

few ideas
 
I'm betting that it is something in the initrd.gz, just like the last time. That message:

Quote:

Failed to execute /init
Kernel panic - not syncing: No init found. Try passing init= option to kernel
sounds familiar. Try looking at /boot/initrd-tree and verifying that the rootfs and rootdev and init files are what you think they're supposed to be and that the RAID activation comes before the LVM/LUKS activation. (That was a 12.1 patch that resulted from the last go around according to your old thread, but I'd check to make sure that it didn't get left behind.)

The other thing I did when trying to fix this sort of problem was inserting a number of "sh" commands in my /boot/initrd-tree init file so that I could inspect the status of the boot process before the kernel hang. (and don't forget to re-run mkinitrd without any options to remake the initrd.gz after you edit "init") Of course, if you never get the busybox shell, then you have another problem entirely, as that would mean the initrd doesn't get used.

If it's a lilo issue, I'll be at a loss, as I use grub. Just make sure you rerun lilo every time you change the initrd!

gargamel 12-17-2008 03:37 PM

Quote:

Originally Posted by mostlyharmless (Post 3379002)
I'm betting that it is something in the initrd.gz, just like the last time. That message:



sounds familiar. Try looking at /boot/initrd-tree and verifying that the rootfs and rootdev and init files are what you think they're supposed to be and that the RAID activation comes before the LVM/LUKS activation. (That was a 12.1 patch that resulted from the last go around according to your old thread, but I'd check to make sure that it didn't get left behind.)

For step 1 through 7 I tried the "huge" kernel installed by default during installation. My understanding was that this doesn't require an initrd, and therefore I didn't generate one, up to this point.
Also, with other attempts, I have checked the init script in initrd-tree. It is no authored by Pat V. (used to be Eric Hameleers, who found the solution to my original problem with 12.1 and created that great patch), but seems to contain the patch: RAID is initiated before LVM and LUKS. However, my thinking was that for step 1 through 7 this shouldn't be relevant, at all. Of course, I'll watch out for this with one of my next attempts, when I try to get a generic SMP kernel with an initrd.
:cool:
Quote:

The other thing I did when trying to fix this sort of problem was inserting a number of "sh" commands in my /boot/initrd-tree init file so that I could inspect the status of the boot process before the kernel hang. (and don't forget to re-run mkinitrd without any options to remake the initrd.gz after you edit "init") Of course, if you never get the busybox shell, then you have another problem entirely, as that would mean the initrd doesn't get used.
I'll try that sh trick and report back the result, thanks for this good idea!

Quote:

If it's a lilo issue, I'll be at a loss, as I use grub. Just make sure you rerun lilo every time you change the initrd!
Yes, of course! :cool:

mostlyharmless 12-17-2008 04:15 PM

I agree that the huge kernel wil get you to where you got, but to mount the root fs, which is where it looks like it hangs, you need lvm, and for that you need the initrd....

Alien Bob 12-17-2008 04:20 PM

Do not use the huge kernel. And do try to read and follow the README_CRYPT.TXT ...

Eric

gargamel 12-17-2008 05:26 PM

Quote:

Originally Posted by Alien Bob (Post 3379143)
Do not use the huge kernel. And do try to read and follow the README_CRYPT.TXT ...

Eric

YES to both, but it doesn't work either way (ie with/without huge kernel/generic kernel plus initrd), currently, here.


gargamel

gargamel 12-17-2008 05:43 PM

Additional information.

/etc/fstab
Code:

[...]
/dev/cryptvg/root    /      ext3    defaults    1    1
[...]

/etc/mkinitrd.conf
Code:

[...]
LUKSDEV="/dev/md1"
ROOTDEV="/dev/cryptvg/root"
[...]

And the man page for mkinitrd.conf says:
Code:

[...]
LUKSDEV
... For example, if your actual root device name in /etc/fstab is:
/dev/mapper/cryptroot on /dev/sda2

Then you'll need to set:
LUKSDEV="/dev/sda2"
ROOTDEV="cryptroot"

Does this mean, that I have to specify ROOTDEV="cryptvg-root" instead of ROOTDEV="/dev/cryptvg/root"?
Well, in Slackware 12.1 ROOTDEV="/dev/cryptvg/root" was ok, so I guess that here the man page is a little confusing.

gargamel

gargamel 12-17-2008 06:16 PM

Next attempt.

Up to now I only issued the commands for activation the logical volumes (LVM)
only once. But probably it makes sense to issue them also right after chroot-ing:
Code:

# chroot /mnt
# vgscan --mknodes
# vgchange -ay

With everything else unchanged I created a new initrd and ran lilo. When I boot,
the system writes the number "99" on half the screen... Whatever that means!

gargamel

mostlyharmless 12-17-2008 06:22 PM

Means you have to use your boot CD, chroot in and redo LILO ;)

gargamel 12-17-2008 06:28 PM

Redoing lilo is what I did. Doing it again would therefore most likely
produce the same result.

1 Which means that I most likely will get the very samy result.
2 Therefore I will have to redo lilo.
3 GOTO 1.

Seems to be a "dynamic halt"... (synonym for "infinite loop")

gargamel

tmerriam 12-18-2008 04:32 PM

Similar setup, same problem
 
I have a very similar setup, just without the RAID, and I get the same problem on boot. I did a clean install of Slackware 12.2. I've done a clean install of Slackware 12.1 and had this working, which is also where I'm getting my settings from.

I've done some searching around the net for information on this no init issue. Sadly, there isn't much out there that's very useful. Some said that the initrd was missing a module for the root device, or that the root device was wrong, or that the memory was bad. I ran a memtest from the Ubuntu disc and it came back clean, so I'm not considering this anymore. The settings I'm using for the bootloader (lilo, soon to be grub as soon as I can get this booted) and for the initrd all came from my prior 12.1 install. I also updated the BIOS, but this did not have any affect either.

I've used Knoppix 5.3.1 and the Slackware install disc in attempts to repair correct this issue, but nothing I've tried has worked. I've tried changing the append line in lilo to point to init or ash/sh explicity, but THIS DOES NOT WORK:

Code:

[...]
append=" vt.default_utf8=0 init=/sbin/init"

My lilo.conf file now looks like this, with the unimportant sections omitted:

Code:

[...]
boot = /dev/sda
append=" vt.default_utf8=0"
[...]
image = /boot/vmlinuz-generic-smp-2.6.27.7-smp
initrd = /boot/initrd.gz
root = /dev/cryptvg/root
[...]

The command I used to make the initrd was:

Code:

mkinitrd -c -k 2.6.27.7-smp ext3:usbhid:ehci_hcd:uhci_hcd -f ext3 -r /dev/cryptvg/root -C /dev/sda2 -L
I included both of the hcd modules because I don't know which one is needed. I didn't see the ata_generic modules in /lib/modules, and I have a hunch it is built into the kernel. Perhaps including a more specific controller would help? In my case I think it is pata_jmicron....

My setup follows the instructions in the LUKS+LVM section of README_CRYPTO almost exactly. The only changes I made were to the sizes of the LVM volumes.

....This my be entirely specific to my hardware, but during the installation (near the end of the package installation), the kernel OOPS!ed... dmesg showed a trace through the ata layer, and the hard drives were restarted. Part of it was cut off, and I'm not sure if this causes the issue... Did anyone else notice or see this? Type dmesg | less right after the install ejects the disc. This *could* cause a problem, but I don't see how it causes *this* problem.

GazL 12-18-2008 07:22 PM

Quote:

Originally Posted by tmerriam (Post 3380453)

The command I used to make the initrd was:

Code:

mkinitrd -c -k 2.6.27.7-smp ext3:usbhid:ehci_hcd:uhci_hcd -f ext3 -r /dev/cryptvg/root -C /dev/sda2 -L

You might have just left it off in the copy/paste or I may just be barking up the wrong tree, but shouldn't there be a -m before the modules list?

Code:

mkinitrd -c -k 2.6.27.7-smp -m ext3:usbhid:ehci_hcd:uhci_hcd -f ext3 -r /dev/cryptvg/root -C /dev/sda2 -L
I'm running a luks/lvm setup on mine with very similar mkinitrd command with the exception of the modules and it works fine, though mine is a really old pc with standard pata drives so I don't have to specify any modules other than jfs.


All times are GMT -5. The time now is 11:16 AM.