From: GangGreene on
I am having trouble with booting using grub

the error returned is mount failing to mount /dev/mapper/root /mnt
then I get dropped to a command prompt waiting for me to fix something.

I don't ever get the prompt for the luks encrypted partition.

Why is it trying to mount the root filesystem at /mnt and not /?

Here is how I created the initrd.gz

booted to the install cd
mdadm -Es > /etc/mdadm.conf
mdadm -As
cryptsetup luksOpen /dev/md3 root
swapon -a /dev/md1
mount /dev/mapper/root /mnt
mount /dev/md0 /mnt/boot
mount -vt tmpfs shm /mnt/dev/shm
mount -vt proc proc /mnt/proc
mount -vt sysfs sysfs /mnt/sys
chroot /mnt
mount <- at this point shows nothing mounted
cd /boot/Slack-x86-crypt
mkinitrd -F

This is my /etc/mkinitrd.conf

SOURCE_TREE="/Slack-x86-crypt/boot/initrd-tree"
CLEAR_TREE="0"
OUTPUT_IMAGE="/Slack-x86-crypt/boot/initrd.gz"
KERNEL_VERSION="$(uname -r)"
KEYMAP="us"
MODULE_LIST="jfs:ata_generic"
LUKSDEV="/dev/md3"
ROOTDEV="/dev/mapper/root"
ROOTFS="jfs"
#RESUMEDEV="/dev/hda2"
RAID="5"
#LVM="0"
WAIT="1"

This is my menu.lst for slack 13
title Slackware 13.0-i686
root (hd0,1)
kernel /Slack-x86-crypt/vmlinuz-generic-smp-2.6.29.6-smp
root=/dev/mapper/root ro
initrd /Slack-x86-crypt/initrd.gz

Did I mess something up?
From: Eef Hartman on
GangGreene <GangGreen(a)invalid.com> wrote:
> I am having trouble with booting using grub
>
> the error returned is mount failing to mount /dev/mapper/root /mnt
> then I get dropped to a command prompt waiting for me to fix something.
>
> I don't ever get the prompt for the luks encrypted partition.

As far as I know grub cannot handle LVM cq RAID boot volumes.
It has to load its "file system stage" from there: one of these
e2fs_stage1_5
fat_stage1_5
ffs_stage1_5
iso9660_stage1_5
jfs_stage1_5
minix_stage1_5
reiserfs_stage1_5
stage1
stage2
ufs2_stage1_5
vstafs_stage1_5
xfs_stage1_5
(stage 1 is the one, loaded into the MBR cq bootblock, stage2 is the actual
kernel loader and the stage1_5 ones are file system support to be able to
load stage2 and the kernel itself).

I _believe_ that with LVM cq RAID the /boot _has_ to be a separate partition
for grub and the RAM disk then has to be loaded with the right kind of
modules for the /dev/mapper interface so that the kernel can then mount /

> Why is it trying to mount the root filesystem at /mnt and not /?
>
> Here is how I created the initrd.gz
>
> booted to the install cd
> mdadm -Es > /etc/mdadm.conf
> mdadm -As
> cryptsetup luksOpen /dev/md3 root
> swapon -a /dev/md1
> mount /dev/mapper/root /mnt

Maybe because of this:
the ram disk image HAS got the root mounted at /mnt (the ram disk
itself is /, of course).

> mount /dev/md0 /mnt/boot

And, as I said, I don't think - but other may correct me when I'm
wrong - that grub CAN handle a /boot on a md? device.
You may need a normal ext3 (or such) partition for /boot.

PS: as lilo works differently (it doesn't use the file system for
loading kernel and initial ramdisk) it CAN have /boot on the md volume.

Lilo remebers the location OF kernel and initrd, so that's why you have
to rerun it every time you change kernel and/or initrd. But that also
means it doesn't need fs support to LOAD them.
--
*******************************************************************
** Eef Hartman, Delft University of Technology, dept. SSC/ICT **
** e-mail: E.J.M.Hartman(a)tudelft.nl - phone: +31-15-278 82525 **
*******************************************************************
From: GangGreene on
Eef Hartman wrote:

> GangGreene <GangGreen(a)invalid.com> wrote:
>> I am having trouble with booting using grub
>>
>> the error returned is mount failing to mount /dev/mapper/root /mnt
>> then I get dropped to a command prompt waiting for me to fix something.
>>
>> I don't ever get the prompt for the luks encrypted partition.
>
> As far as I know grub cannot handle LVM cq RAID boot volumes.
> It has to load its "file system stage" from there: one of these
> e2fs_stage1_5
> fat_stage1_5
> ffs_stage1_5
> iso9660_stage1_5
> jfs_stage1_5
> minix_stage1_5
> reiserfs_stage1_5
> stage1
> stage2
> ufs2_stage1_5
> vstafs_stage1_5
> xfs_stage1_5
> (stage 1 is the one, loaded into the MBR cq bootblock, stage2 is the
> actual kernel loader and the stage1_5 ones are file system support to be
> able to load stage2 and the kernel itself).
>
> I _believe_ that with LVM cq RAID the /boot _has_ to be a separate
> partition for grub and the RAM disk then has to be loaded with the right
> kind of modules for the /dev/mapper interface so that the kernel can then
> mount /

I do have a separate /boot an ext2 filesystem on a separate raid drive


>
>> Why is it trying to mount the root filesystem at /mnt and not /?
>>
>> Here is how I created the initrd.gz
>>
>> booted to the install cd
>> mdadm -Es > /etc/mdadm.conf
>> mdadm -As
>> cryptsetup luksOpen /dev/md3 root
>> swapon -a /dev/md1
>> mount /dev/mapper/root /mnt
>
> Maybe because of this:
> the ram disk image HAS got the root mounted at /mnt (the ram disk
> itself is /, of course).
>
>> mount /dev/md0 /mnt/boot
>
> And, as I said, I don't think - but other may correct me when I'm
> wrong - that grub CAN handle a /boot on a md? device.
> You may need a normal ext3 (or such) partition for /boot.

Yes I had the same setup using Arch linux raid /boot and an encrypted root
raid 5.

I think the problem is how I made the initrd.gz, I am still working on that.


>
> PS: as lilo works differently (it doesn't use the file system for
> loading kernel and initial ramdisk) it CAN have /boot on the md volume.
>
> Lilo remebers the location OF kernel and initrd, so that's why you have
> to rerun it every time you change kernel and/or initrd. But that also
> means it doesn't need fs support to LOAD them.

Thank you for your input

From: Joseph Rosevear on
GangGreene <GangGreen(a)invalid.com> wrote:
> I am having trouble with booting using grub

Grub or legacy grub? I use legacy grub.

> the error returned is mount failing to mount /dev/mapper/root /mnt
> then I get dropped to a command prompt waiting for me to fix something.

What is /dev/mapper/root for?

> I don't ever get the prompt for the luks encrypted partition.

> Why is it trying to mount the root filesystem at /mnt and not /?

Did you use Patrick's mkinitrd? (Looks like you did.) I believe it
supplies an init script for you. That init script becomes part of the
initrd.gz and includes this mount command:

mount -o ro -t $ROOTFS $ROOTDEV /mnt

Later, in the last line of the script does this:

exec switch_root /mnt /sbin/init $@

which makes /mnt become / and runs /sbin/init, thus booting (or
finishing the boot) /.

So maybe you want to take a look at your init script. You can use

mkdir /tmp/test
cp initrd.gz /tmp/test
cd /tmp/test
cat initrd.gz | cpio -vim

to expand your initrd.gz. Then take a look at your init script.

> Here is how I created the initrd.gz

> booted to the install cd
> mdadm -Es > /etc/mdadm.conf
> mdadm -As
> cryptsetup luksOpen /dev/md3 root
> swapon -a /dev/md1
> mount /dev/mapper/root /mnt
> mount /dev/md0 /mnt/boot
> mount -vt tmpfs shm /mnt/dev/shm
> mount -vt proc proc /mnt/proc
> mount -vt sysfs sysfs /mnt/sys
> chroot /mnt
> mount <- at this point shows nothing mounted
> cd /boot/Slack-x86-crypt
> mkinitrd -F

OK, I see you use mkinitrd. In Slackware 12.0 (which I'm using) the
mkinitrd is Patrick's script.

So see my notes above.

You can change the init script (made by mkinitrd) if you like. I have
tailored mine to meet my needs. Then you can use it to make a new
initrd.gz. But don't mess with the mount command. I've got a feeling
that there is a good reason it mounts to /mnt initially.

> This is my /etc/mkinitrd.conf

> SOURCE_TREE="/Slack-x86-crypt/boot/initrd-tree"
> CLEAR_TREE="0"
> OUTPUT_IMAGE="/Slack-x86-crypt/boot/initrd.gz"
> KERNEL_VERSION="$(uname -r)"
> KEYMAP="us"
> MODULE_LIST="jfs:ata_generic"
> LUKSDEV="/dev/md3"
> ROOTDEV="/dev/mapper/root"
> ROOTFS="jfs"
> #RESUMEDEV="/dev/hda2"
> RAID="5"
> #LVM="0"
> WAIT="1"

Instead of using /etc/mkinitrd.conf I do this:

mkinitrd -s initrd-tree -o initrd.gz

I actually do it twice. The first time there is no initrd-tree in my
working directory. mkinitrd therefore uses /boot/initrd-tree. Then I
modify the initrd-tree that is created. One of the modifications is
replacement of the init script with my own. My modifcations are used
by mkinitrd the second time I use the above command.

> This is my menu.lst for slack 13
> title Slackware 13.0-i686
> root (hd0,1)
> kernel /Slack-x86-crypt/vmlinuz-generic-smp-2.6.29.6-smp
> root=/dev/mapper/root ro
> initrd /Slack-x86-crypt/initrd.gz

> Did I mess something up?

I'm not really good with this, so the best I can do is to tell you what
I do. Maybe you can adapt my steps to work for you? So, I'll show you
my menu.lst:

title krnl 2.6.21.5: from Slackware 12.0
root (cd)
kernel /vmlinuz-generic-2.6.21.5 (ro) vga=791
initrd /initrd.gz

This looks like yours except that you have a "root=..." line. I have
always booted from a CD. (I put stage2_eltorito, initrd.gz and a
kernel on a CD.) I would like to learn how to do it your way, though.
How do I configure the menu.lst? Perhaps the way in your example will
help me, but I do not understand the "root=..." line.

Then how do I tell grub to to boot? Is there something I have to do to
the boot record (of the first device in the boot order) to tell it to
run grub? I don't know how to do this.

I hope this helps.

-Joe
From: Mikhail Zotov on
On Sun, 17 Jan 2010 12:32:51 -0500
GangGreene <GangGreen(a)invalid.com> wrote:

> I am having trouble with booting using grub
>
> the error returned is mount failing to mount /dev/mapper/root /mnt
> then I get dropped to a command prompt waiting for me to fix something.
>
> I don't ever get the prompt for the luks encrypted partition.
>
> Why is it trying to mount the root filesystem at /mnt and not /?
....
> Did I mess something up?

AFAIK, mounting the root partition on /mnt is the way initrd works. You
can check the initrd tree.

As for the boot problem, I had a similar situation with a custom
2.6.32.3 kernel. Before th prompt, there was a message about the
problem (missing device, IIRC). Initrd was built with correct options
but the custom kernel was missing a few options.

Not sure if this can help but anyway...

--
Mikhail

 |  Next  |  Last
Pages: 1 2
Prev: Variable I/O Performance with dd vs. cat
Next: Fail