Bug 9905

Summary: initrd creation failed at kernel install time
Product: Mageia Reporter: Chris Denice <eatdirt>
Component: RPM PackagesAssignee: Thierry Vignaud <thierry.vignaud>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Normal CC: mageia
Version: CauldronKeywords: PATCH
Target Milestone: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Source RPM: drakxtools-15.45-1.mga3.src.rpm CVE:
Status comment:
Attachments: skip comments

Description Chris Denice 2013-04-28 23:28:53 CEST
1/2: kernel-desktop-3.8.10-1.mga3
                                 ############################################################

device-mapper: table ioctl on #_dev_sdb1 failed: No such device or address
Command failed
INTERNAL ERROR: unknown device mapper/#_dev_sdb1
MDK::Common::Various::internal_error() called from /usr/lib/libDrakX/devices.pm:186
devices::entry() called from /usr/lib/libDrakX/devices.pm:201
devices::make() called from /usr/lib/libDrakX/fs/type.pm:276
fs::type::call_blkid() called from /usr/lib/libDrakX/fs/type.pm:284
fs::type::type_subpart_from_magic() called from /usr/lib/libDrakX/fs/dmcrypt.pm:143
fs::dmcrypt::_get_existing_one() called from /usr/lib/libDrakX/fs/dmcrypt.pm:102
fs::dmcrypt::_get_existing_one_with_state() called from /usr/lib/libDrakX/fs/dmcrypt.pm:42
fs::dmcrypt::read_crypttab_() called from /usr/lib/libDrakX/fs/dmcrypt.pm:48
fs::dmcrypt::read_crypttab() called from /usr/lib/libDrakX/fsedit.pm:86
fsedit::dmcrypts() called from /usr/lib/libDrakX/fsedit.pm:296
fsedit::get_hds() called from /sbin/bootloader-config:61
You should restart your computer for kernel-desktop-3.8.10-1.mga3

I have 3 encrypted drives on the system, but that same error appears even if they are not mounted, not desencrypted and even when /dev/mapper/* is empty.

Issuing the dracut command manually and afterwards works and generate the initrd:
dracut --kver 3.8.10-desktop-1.mga3

Same errors with the tmb branch!

Cheers.



Reproducible: 

Steps to Reproduce:
Comment 1 Chris Denice 2013-04-30 10:42:46 CEST
I look to the error in more details, the trouble is not kernel related but comes from:

dmcrypt.pm from drakxtools-15.45-1.mga3.src.rpm

which reads /etc/crypttab. This file reads

#_dev_sdb1 UUID=fc6a594a-ee39-46e6-abd0-8123bd8d6241
#_dev_sdc1 UUID=4aa507cb-d3f2-4955-a6bf-8304412e2f13
#_dev_sdd1 /dev/sdd1

so, those guys seem to be commented which is apparently not supported by dmcrypt.pm and makes it crashes. If I remove those 3 lines, kernel install goes smooth and the initrd is created.

I switched back the priority to normal, as that's quite a fine tuned bug. I may have even commented myself those lines a very long time ago, but I think dmcrypt should support the # as it is supported in fstab.

Cheers.

Source RPM: kernel-3.8.10-1.mga3.src.rpm => drakxtools-15.45-1.mga3.src.rpm
Severity: critical => normal

Comment 2 Colin Guthrie 2013-04-30 11:02:12 CEST
Yup, I would agree it should skip lines beginning with #

My perl is crap but this might do the trick:

diff --git a/perl-install/fs/dmcrypt.pm b/perl-install/fs/dmcrypt.pm
index 0e5c3c1..d46082c 100644
--- a/perl-install/fs/dmcrypt.pm
+++ b/perl-install/fs/dmcrypt.pm
@@ -34,6 +34,7 @@ sub read_crypttab_ {
 
     foreach (cat_($crypttab)) {
        my ($dm_name, $dev) = split;
+       next if $dm_name =~ /^\s*#/;
 
        my $raw_part = fs::get::device2part($dev, \@raw_parts)
          or log::l("crypttab: unknown device $dev for $dm_name"), next;

CC: (none) => mageia
Assignee: bugsquad => thierry.vignaud

Thierry Vignaud 2013-04-30 11:42:47 CEST

Keywords: (none) => PATCH

Comment 3 Thierry Vignaud 2013-04-30 11:43:39 CEST
Created attachment 3849 [details]
skip comments

Can you confirm this patch fixes it?
You can just install any kernel (kernel-foobar-latest with "foobar" any of "linus", "tmb", "server", "vserver", ...)
Comment 4 Thierry Vignaud 2013-04-30 11:44:11 CEST
Colin's fix is OK but this is simpler/earlier.
Comment 5 Chris Denice 2013-04-30 11:50:39 CEST
Just applied and tested the patch, with # or no # in /etc/crypttab and that works fine!

Thanks Masters.
Comment 6 Thierry Vignaud 2013-04-30 12:45:07 CEST
Fixed in SVN thx to Colin

Status: NEW => RESOLVED
Resolution: (none) => FIXED