You are not logged in.

#1 2006-10-17 15:15:17

ar2k7
Member
Registered: 2006-10-14
Posts: 27

Kernel, Mkinitcpio, Encryption problem. [Solved]

I'm trying to install Arch with encrypted ROOT filesystem using LUKS, following the arch wiki howto.
Problem is I get a kernel panic, saying something about dm-0 doesn't exist. Is mkinitcpio broken? Anyway, tried the beyond kernel but that just hangs, won't even boot on my comp (video card related I think).
Not sure what to do here, any ideas are welcome. Thanks.

Offline

#2 2006-10-17 15:42:02

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

We're going to need some more information here.  Can you post the EXACT error message ("something about dm-0" doesn't give us much information)?
Also, can you post your mkinitcpio.conf and boot loader configuration?

Offline

#3 2006-10-17 16:02:00

brain0
Developer
From: Aachen - Germany
Registered: 2005-01-03
Posts: 1,382

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

ar2k7 wrote:

I'm trying to install Arch with encrypted ROOT filesystem using LUKS, following the arch wiki howto.
Problem is I get a kernel panic, saying something about dm-0 doesn't exist.

It shouldn't even mention anything about dm-0. The right way to do this is to add root=/dev/hdXY as the root commandline, while /dev/hdXY is the block device that the encryption is based upon. Maybe the howto does that wrong or you confused it.

Anyway, to be of any further help we will need your bootloader configuration file and - if possible - your mkinitcpio.conf as well. If you can provide it, please also add a digital camera picture of the output you see at boot - if you have no digicam, please try to write the messages down as exactly as possible.

Offline

#4 2006-10-17 16:26:57

ar2k7
Member
Registered: 2006-10-14
Posts: 27

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

Yes, sorry for the bad information (thought it was a well known problem).
Here are the boot messages, written down by hand...

:: Running Hook [filesystem]
:: Loading root filesystem mode...    luks
:: Running Hook [encrypt]

device-mapper: ioctl: 4.7.0-iocH (2006-06-24) initialized: dm-devel@redhat.com

mknod:    No such file or directory - /dev/mapper/control

Enter LUKS passphrase:

key slot 0 unlocked
Command successful

:: Initramfs Completed - control passing to kinit

IP-Config: no devices to configure

kinit: Cannot open root device dm-0 (254,0)

kinit: init not found!

Kernel panic - not syncing : Attempted to kill init!

grub menu.lst config...

# (0) Arch Linux
title  Arch
root   (hd0,2)
kernel /vmlinuz26 root=/dev/hda4 ro
initrd /kernel26.img

/etc/mkinitcpio.conf

# vim:set ft=sh
# MODULES
# The following modules are loaded before any boot hooks are
# run.  Advanced users may wish to specify all system modules
# in this array.  For instance:
#     MODULES="piix ide_disk reiserfs"
MODULES=""

# BINARIES
# This setting includes, into the CPIO image, and additional
# binaries a given user may wish.  This is run first, so may
# be used to override the actual binaries used in a given hook.
# (Existing files are NOT overwritten is already added)
# BINARIES are dependancy parsed, so you may safely ignore libraries
BINARIES=""

# FILES
# This setting is similar to BINARIES above, however, files are added
# as-is and are not parsed in anyway.  This is useful for config files.
# Some users may wish to include modprobe.conf for custom module options,
# like so:
#    FILES="/etc/modprobe.conf"
FILES=""

# HOOKS
# This is the most important setting in this file.  The HOOKS control the
# modules and scripts added to the image, and what happens at boot time.
# Order is important, and it is recommended that you do not change the
# order in which HOOKS are added.  Run 'mkinitcpio -H <hook>' for
# help on a given hook.
# 'base' is _required_ unless you know precisely what you are doing.
# 'udev' is _required_ in order to automatically load modules
# 'modload' may be used in place of 'udev', but is not recommended
# 'filesystems' is _required_ unless you specify your fs modules in MODULES
# Examples:
#    This setup specifies all modules in the MODULES setting above.
#    No raid, lvm, or encrypted root is needed.
#    HOOKS="base"
#
#    This setup will autodetect all modules for your system and should
#    work as a sane default
#    HOOKS="base udev autodetect ide scsi sata filesystems"
#
#    This setup will generate a 'full' image which supports most systems.
#    No autodetection is done.
#    HOOKS="base udev ide scsi sata usb filesystems"
#
#    This setup assembles an ide raid array with an encrypted root FS.
#    Note: See 'mkinitcpio -H raid' for more information on raid devices.
#    HOOKS="base udev ide filesystems raid encrypt"
#
#    This setup loads an LVM volume group on a usb device.
#    HOOKS="base udev usb filesystems lvm"
HOOKS="base udev autodetect ide scsi sata filesystems encrypt"

/boot/mkinitcpio-kernel26.conf

# vim:set ft=sh
# MODULES
# The following modules are loaded before any boot hooks are
# run.  Advanced users may wish to specify all system modules
# in this array.  For instance:
#     MODULES="piix ide_disk reiserfs"
# BusLogic is added to support VMWARE arch booting in fallback image
MODULES="BusLogic"

# BINARIES
# This setting includes, into the CPIO image, and additional
# binaries a given user may wish.  This is run first, so may
# be used to override the actual binaries used in a given hook.
# (Existing files are NOT overwritten is already added)
# BINARIES are dependancy parsed, so you may safely ignore libraries
#BINARIES=""

# FILES
# This setting is similar to BINARIES above, however, files are added
# as-is and are not parsed in anyway.  This is useful for config files.
# Some users may wish to include modprobe.conf for custom module options,
# like so:
#    FILES="/etc/modprobe.conf"
FILES=""

# HOOKS
# This is the most important setting in this file.  The HOOKS control the
# modules and scripts added to the image, and what happens at boot time.
# Order is important, and it is recommended that you do not change the
# order in which HOOKS are added.  Run 'mkinitcpio -H <hook>' for
# help on a given hook.
# 'base' is _required_ unless you know precisely what you are doing.
# 'udev' is _required_ in order to automatically load modules
# 'modload' may be used in place of 'udev', but is not recommended
# 'filesystems' is _required_ unless you specify your fs modules in MODULES
# Examples:
#    This setup specifies all modules in the MODULES setting above.
#    No raid, lvm, or encrypted root is needed.
#    HOOKS="base"
#
#    This setup will autodetect all modules for your system and should
#    work as a sane default
#    HOOKS="base udev autodetect ide scsi sata filesystems"
#
#    This setup will generate a 'full' image which supports most systems.
#    No autodetection is done.
#    HOOKS="base udev ide scsi sata usb filesystems"
#
#    This setup assembles an ide raid array with an encrypted root FS.
#    Note: See 'mkinitcpio -H raid' for more information on raid devices.
#    HOOKS="base udev ide filesystems raid encrypt"
#
#    This setup loads an LVM volume group on a usb device.
#    HOOKS="base udev usb filesystems lvm"
HOOKS="base udev ide scsi sata usbinput raid filesystems encrypt"

Offline

#5 2006-10-17 16:49:02

brain0
Developer
From: Aachen - Germany
Registered: 2005-01-03
Posts: 1,382

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

You should add "encrypt" before "filesystem" (regenerate your image after that, make sure to specify proper -k and -g options), Otherwise the filesystem module won't be loaded and kinit cannot mount your root device.

I'll try to add a fix to mkinitcpio so that it will work even if the filesystem hook is in the wrong place, so this may not be an issue any more in the future.

Offline

#6 2006-10-17 18:22:14

ar2k7
Member
Registered: 2006-10-14
Posts: 27

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

I'm afraid that didn't work...

mkinitcpio -g /boot/kernel26.img -k 2.6.18-ARCH
:: Begin build
:: Parsing hook [base]
:: Parsing hook [udev]
:: Parsing hook [autodetect]
find: /sys/devices/: No such file or directory
:: Parsing hook [ide]
:: Parsing hook [scsi]
:: Parsing hook [sata]
:: Parsing hook [encrypt]
:: Parsing hook [filesystems]
:: Generating module dependencies
:: Generating image '/boot/kernel26.img' ...SUCCESS

Boot messages...

:: Loading Initramfs
:: Running Hook [udev]
:: Loading udev... Time: tsc clocksource has been installed
input: AT Translated Set2 keyboard as /class/input/input0
done.
:: Running Hook [encrypt]
device-mapper: ioctl 4.7.0-ioctl (2006-06-24) initialized: dm-devel@redhat.com
mknod: No such file or directory - /dev/mapper/control
:: Running Hook [filesystems]
:: Loading root filesystem module...-e
Attempting to create root device '/dev/hda4'
ERROR: Failed to parse block device name for '/dev/hda4'
   unknown
ERROR: root fs cannot be detected. Try using the rootfstype= kernel parameter
:: Initramfs Completed - control passing to kinit
IP-Config: no devices to configure
kinit: Unable to mount root fs on device dev (0,0)
kinit: init not found!
Kernel panic - not syncing: Attempted to kill init

...it doesn't even ask for a password

Offline

#7 2006-10-17 18:43:54

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

Two things that seem odd...

ar2k7 wrote:
find: /sys/devices/: No such file or directory

It appears you don't have sysfs mounted when generating the image.... :shock:

ar2k7 wrote:
mknod: No such file or directory - /dev/mapper/control

Looks like the dm-mod isn't being loaded... possibly because of the sysfs failure above.

Offline

#8 2006-10-17 19:03:46

ar2k7
Member
Registered: 2006-10-14
Posts: 27

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

phrakture wrote:

It appears you don't have sysfs mounted when generating the image.... :shock:

That would be because of my noobiness... chrooted into the encrypted disk from the livecd and forgot to mount any sysfs.

Edit:
After fixing sysfs, the mkinitcpio image is generated without any errors...
But still get kernel panic at boot...

:: Running Hook [encrypt]
device-mapper: ioctl: 4.7.0-ioctl (2006-06-24) initialized: dm-devel@redhat.com
mknod: No such file or directory - /dev/mapper/control

A password is required to access the root filesystem:
Enter LUKS passphrase:
key slot 0 unlocked.
Command successful.
:: Running Hook [filesystems]
:: Loading root filesystem module...    ext3
:: Initramfs Completed - control passing to kinit
IP-Config: no devices to configure
kinit: Cannot open root device dm-0 (254,0)
kinit: init not found!
Kernel panic - not syncing: Attempted to kill init

Offline

#9 2006-10-17 21:25:20

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

Hmm, looks like you still have the mknod error...

Just to try some diagnosis:

Edit the /lib/initcpio/hooks/encrypt file
Find the line "read dev_t < /sys/class/misc/device-mapper/dev"

Underneath that, add these two lines:

echo "device = ${dev_t}"
/bin/mkdir /dev/mapper

Rebuild the image, and try again

I'm pulling at straws here... so not 100% what's going on

Offline

#10 2006-10-17 23:13:59

brain0
Developer
From: Aachen - Germany
Registered: 2005-01-03
Posts: 1,382

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

The mknod error is no error (you can ignore it if you use the udev hook). The fact that it is actually asking for a passphrase indicates that the device mapper is okay.

Also the filesystem is now detected properly as ext3, so the crypto mapping is in fact okay and you should be able to mount the device. I have no idea where the "Cannot open root device dm-0 (254,0)" comes from, as everything else seems to be just fine and it should work. I'll have another look tomorrow, but right now I can only file this in the "odd" category.

Offline

#11 2006-10-17 23:59:52

ar2k7
Member
Registered: 2006-10-14
Posts: 27

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

Thank you for all the help in getting this far.. you guys rock! Yes the error looks a bit "odd" doesn't it. I will try to learn and understand a little bit more about it tomorrow...

(Yea btw the line 'echo "device = ${dev_t}"' returned 'device = 10:63' for me. mkdir didn't return anything about /dev/mapper so perhaps it wasn't created in the first place, don't know)

Offline

#12 2006-10-18 16:09:14

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,896
Website

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

I'm interested in this because I am trying to encrypt my usb external drive for safe backups

Maybe OT but can you mount (dev/mapper/<device>) so that user has access to it ?

Now what was that password again lol


Mr Green

Offline

#13 2006-10-18 21:57:40

ar2k7
Member
Registered: 2006-10-14
Posts: 27

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

I still have no clue what's going on here... mkinitcpio should take care of passing the correct device name to the kernel right? Any ideas?

Offline

#14 2006-10-19 06:44:54

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,896
Website

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

Hi,

Let me know how far you have got with encryption I'll try to help

MrG


Mr Green

Offline

#15 2006-10-19 07:15:49

ar2k7
Member
Registered: 2006-10-14
Posts: 27

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

Hi MrG,

The encryption part is working... but the device isn't mounted correctly at boot (see above).

Offline

#16 2006-10-19 10:05:28

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,896
Website

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

pm me about device problems you got devices set up in fstab?


Mr Green

Offline

#17 2006-10-19 10:46:04

ar2k7
Member
Registered: 2006-10-14
Posts: 27

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

This is the problem... (mkinitcpio related?)

kinit: Cannot open root device dm-0 (254,0)
kinit: init not found!
Kernel panic - not syncing: Attempted to kill init

...and /etc/fstab looks like this

# 
# /etc/fstab: static file system information
#
# <file>        <dir>         <type>    <options>          <dump> <pass>
none                   /dev/pts      devpts    defaults            0      0
none                   /dev/shm      tmpfs     defaults            0      0

/dev/cdrom             /mnt/cd   iso9660   ro,user,noauto,unhide   0      0
/dev/dvd               /mnt/dvd  udf       ro,user,noauto,unhide   0      0
/dev/fd0               /mnt/fl   vfat      user,noauto             0      0

/dev/mapper/root / ext3 defaults 0 1
/dev/hda3 /boot ext2 defaults 0 1

Offline

#18 2006-10-19 11:09:53

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,896
Website

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

so you have modules required in mkinitcpio .... you got lilo/grub set up correctly?

sorry but I have an article here on it for whole disc but its for Depain & Suse so bear with me


Mr Green

Offline

#19 2006-10-19 11:33:33

ar2k7
Member
Registered: 2006-10-14
Posts: 27

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

Well... everything is set up according to the LUKS Encrypted Root howto (or at least so I think, have posted my configs, grub menu.lst, mkinitcpio.conf etc in this thread).

Added the encrypt hook before filesystems and regenerated the mkinitcpio image. Then again don't know much about mkinitcpio, so if there's other modules missing I wouldn't know.

Offline

#20 2006-10-19 11:58:29

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,896
Website

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

ok can you use a livecd to read your root partition ie open it mount it whatever then at least we will know it works then figure out boot problem

mkinitcpio should pick it up .....

just try adding a menu entry or edit grub to point to /dev/mapper/root see what happens

Suse adds filesystem type maybe nothing .....


Mr Green

Offline

#21 2006-10-19 16:05:23

ar2k7
Member
Registered: 2006-10-14
Posts: 27

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

Yes I can do that... as said a few posts back in this thread, that's what I did (used the arch livecd to decrypt, mount, and chroot into it) to regenerate the mkinitcpio image... after changing the order of "encrypt" and "filesystems" on the HOOKS line in mkinitcpio.conf, as suggested by brain0. That's what I meant with the encryption part is working.

The howto states:

Make sure references to your root partition are references to the underlying device, not the dm-crypt device. ie: /dev/hda3, not /dev/mapper/root. mkinitcpio will take care of passing the correct device name to the kernel, but it needs to know which device to set up as root.

But anyway, this is what happens when changing grub menu.lst to point to /dev/mapper/root

Attempted to create root device '/dev/mapper/root'
ERROR: Failed to parse block device name for '/dev/mapper/root'
   unknown
ERROR: root fs cannot be detected. Try using the rootfstype= kernel parameter.
kinit: Unable to mount root fs on device dev(0,0)
kinit: init not found!
Kernel panic - not syncing: Attempted to kill init

...it doesn't even ask for a password.

So, if mkinitcpio should take care of passing the correct device name to the kernel, then where does the following error come from?

kinit: Cannot open root device dm-0 (254,0)

Edit:
After reinstalling from scratch it's now working!!
...don't know what caused previous error, but if it ain't broke...
I'm happily arching now big_smile

Offline

#22 2008-11-22 03:35:13

kludge
Member
Registered: 2008-08-03
Posts: 294

Re: Kernel, Mkinitcpio, Encryption problem. [Solved]

old thread, i know, but...

i had this exact same problem today.  my cpio was built from my arch install inside a chroot on a ubuntu cli-only install with 'mkinitcpio -k 2.6.27-ARCH -g kernel26img'.  i mounted /sys after chroot'ing, so it used ubuntu's /sys.  when i rebuilt the cpio (no changes to mkinitcpio.conf) from within arch booted properly (i.e.: with arch's /sys), everything worked fine.

i actually did a lot of hacking around in in the initcpio hooks and /lib/initcpio/init to trace the problem, but everything looked great right up to the hand-off to kinit.

i'd file a bug report, but i don't really care to reproduce the problem right now ;b


[23:00:16]    dr_kludge | i want to invent an olfactory human-computer interface, integrate it into the web standards, then produce my own forked browser.
[23:00:32]    dr_kludge | can you guess what i'd call it?
[23:01:16]    dr_kludge | nosilla.
[23:01:32]    dr_kludge | i really should be going to bed.  i'm giggling madly about that.

Offline

Board footer

Powered by FluxBB