LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-07-2010, 08:02 PM   #1
bonaire
Member
 
Registered: Jun 2008
Location: Bonn/Germany
Distribution: Slackware-13.37
Posts: 94

Rep: Reputation: 19
script error in mkinitrd with -current


Hello,

since an update to the latest -current version, it comes to an error inside the init script from the initrd.gz on my system, shortly behind the scan for encrpyted devices inside lvm containers.

The message is
Code:
mdadm: No arrays found in config file
  1 logical volume(s) in volume group "vg" now active
ash: missing ]
mount: mounting crypt-vg-root on /mnt/failed: No such file or directory
ERROR: No /sbin/init found on rootdev (or not mounted).  Trouble ahead.
       You can try to fix it. Type "exit" when things are done.
If i then unlock the crypted root device within the lvm, boot continues.
I think this is a bug, because configuration did not change, and it worked before the update.

I have not the time and qualification, to look into the script, but maybe someone has it and can help me here?
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 05-07-2010, 08:16 PM   #2
bonaire
Member
 
Registered: Jun 2008
Location: Bonn/Germany
Distribution: Slackware-13.37
Posts: 94

Original Poster
Rep: Reputation: 19
Got it

Code:
 # Unlock any LUKS encrypted devices that were deferred above but have now
  # become available due to the vgscan (i.e. filesystems on LVM Logical Volumes)

  if [ -x /sbin/cryptsetup -a -n "${LUKSLIST_DEFERRED}"]; then
    for LUKSDEV in ${LUKSLIST_DEFERRED} ; do
should be
Code:
 # Unlock any LUKS encrypted devices that were deferred above but have now
  # become available due to the vgscan (i.e. filesystems on LVM Logical Volumes)

  if [ -x /sbin/cryptsetup -a -n "${LUKSLIST_DEFERRED}" ]; then
    for LUKSDEV in ${LUKSLIST_DEFERRED} ; do
 
2 members found this post helpful.
Old 05-07-2010, 08:54 PM   #3
mRgOBLIN
Slackware Contributor
 
Registered: Jun 2002
Location: New Zealand
Distribution: Slackware
Posts: 999

Rep: Reputation: 231Reputation: 231Reputation: 231
Well spotted.

Thanks for the report.
 
Old 05-08-2010, 12:31 PM   #4
bonaire
Member
 
Registered: Jun 2008
Location: Bonn/Germany
Distribution: Slackware-13.37
Posts: 94

Original Poster
Rep: Reputation: 19
Sorry for pushing that again, but i am a bit confused, after i spend some time with that. I was attracted to learn how it works.

Code:
 if [ -x /sbin/cryptsetup -a -n "${LUKSLIST_DEFERRED}" ];
Why does the test for /sbin/cryptsetup make use of parameters, parameters that are not available for the cryptsetup i have here? -a is at least unknown for the cryptsetup version, that is available when the system is up.

Another point i saw is:
Code:
KEYPART=$(echo $LUKSKEY |cut -f1 -d:)
LUKSPATH="/mountkey$(echo $LUKSKEY |cut -f2 -d:)"
# Catch possible mount failure:
if blkid -t TYPE=vfat $KEYPART 1>/dev/null 2>&1 ; then
  MOUNTOPTS="-t vfat -o shortname=mixed"
else
  MOUNTOPTS="-t auto"
fi
I can do anything, the return value of blkid is always 2 (with the blkid version available when the system is up). So this does not work for me. Currently this leads to the problem that my ext4 formatted stick partition is tried to be mounted as vfat. (The stick has two partitions, one is vfat, the other one ext4)

And a last thing is: The command
Code:
/sbin/cryptsetup isLuks ${LUKSDEV} 1>/dev/null 2>/dev/null
Forces udev to dump information on tty0. This leads to the problem that the udev message is written after "cryptsetup luksOpen" asks me for the passphrase. On my system, the output looks like that
Code:
Unlocking Luks encrypted device '/dev/mapper/vg-root' as luks mapped device 'crypt-vg-root' 
Enter passphrase for /dev/mapper/crypt-vg-root: udevd-work[1009]: device node '/dev/mapper/vg-root' already exists, link to '/dev/mapper/vg-root' will not overwrite it
This is not really a problem for myself, but users, who did not setup the system by there self, could be confused because boot does not continue and there is only a message, that has nothing to do with the passphrase.

Maybe the forum is not the best place for it, but before i write an email to pv, i think it is better to discuss that here.
 
Old 05-08-2010, 01:51 PM   #5
XGizzmo
Member
 
Registered: Mar 2007
Distribution: Slackware
Posts: 264

Rep: Reputation: 69
Code:
 if [ -x /sbin/cryptsetup -a -n "${LUKSLIST_DEFERRED}" ];
The -x -a and -n are for test not cryptsetup. In English it says "if /sbin/cryptseup is executable AND the length of ${LUKSLIST_DEFERRED} is NOT zero".

Last edited by XGizzmo; 05-08-2010 at 01:52 PM.
 
Old 05-08-2010, 01:57 PM   #6
bonaire
Member
 
Registered: Jun 2008
Location: Bonn/Germany
Distribution: Slackware-13.37
Posts: 94

Original Poster
Rep: Reputation: 19
Thanks for the explanation! The other stuff is also caused by my ignorance? Would be cool.
 
Old 05-09-2010, 05:15 AM   #7
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,900

Rep: Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023
Quote:
Originally Posted by bonaire View Post
Got it
Yes, nicely spotted bonaire. thankyou. The code that went into initrd has changed a little from what I gave Eric, but that error is entirely down to me.

My apologies to anyone affected by this.


P.S. The keyfile stuff is all Eric's so I can't offer any advice on that one.

As for the passphrase prompt getting overwritten, I have that problem here too, but with messages for my usb keyboard. I found that using a "WAIT=2" parameter on mkinitrd.conf sorts that one out as it allows udev time to do it's stuff before the cryptsetup stuff starts running.

Last edited by GazL; 05-09-2010 at 05:30 AM.
 
Old 05-09-2010, 06:23 AM   #8
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,900

Rep: Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023Reputation: 5023
Quote:
Originally Posted by bonaire View Post
Unlocking Luks encrypted device '/dev/mapper/vg-root' as luks mapped device 'crypt-vg-root'
Enter passphrase for /dev/mapper/crypt-vg-root: udevd-work[1009]: device node '/dev/mapper/vg-root' already exists, link to '/dev/mapper/vg-root' will not overwrite it
[/code]
This is not really a problem for myself, but users, who did not setup the system by there self, could be confused because boot does not continue and there is only a message, that has nothing to do with the passphrase.

Maybe the forum is not the best place for it, but before i write an email to pv, i think it is better to discuss that here.

The new cryptsetup stuff is primarily a combination of work done by Eric and myself, so the forum is probably a better option for discussing this stuff than emailing pat.


I mentioned above that I use a WAIT to get around the prompt being overwritten by udev output but I don't think that's what's happening here.


From looking at the names of the devices, it looks like you're using an encrypted lvm logical volume rather than an encrypted lvm physical volume. My guess is that you're using -C /dev/mapper/vg-root -r crypt-vg-root ?

So, what will happen on your system is that the first run of the LUKS code won't find anything to unlock and your device will be added to the 'deferred' list. Then the "vgchange -ay" will run and will create the new device entries. udev will then stick its oar in and appears to also be trying to create the new device entries which then causes the "already exists" error message you're seeing. It's not the "cryptsetup isLuks" that is causing this.


Possible ways to resolve this:

1) Add a couple of seconds sleep after the following line:
" if [ -x /sbin/cryptsetup -a -n "${LUKSLIST_DEFERRED}"]; then"

This would slow down booting slightly, so it's not ideal.

2) Redirect udevd's output to /dev/null, but this reduces the amount of diagnostics going to the screen which may be undesirable.

3) Stop udev trying to process lvm logical volumes during the initrd's init, or stop it complaining when they already exist. I don't know if it's even possible but it may be worth looking into. I've avoided the majority of the udev stuff so far so it's not an area I know much about.

Eric do you have any thoughts on this?

Last edited by GazL; 05-09-2010 at 06:27 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mkinitrd error fof3 Linux - General 3 10-20-2008 12:09 PM
Slackware-current and mkinitrd-1.3.2 prontxo Slackware 4 04-11-2008 11:18 AM
Slackware-current and mkinitrd-1.3.1 prontxo Slackware 8 03-30-2008 06:43 AM
mkinitrd script with slackware deb75 Slackware 1 04-20-2004 10:56 AM
Error on instalation Mandrake 9.2 on MKinitrd matu_t_21 Mandriva 0 03-03-2004 06:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration