Bug 12151 - diskdrake / kernel update -> device-mapper: table ioctl on crypt_sda5 failed
Summary: diskdrake / kernel update -> device-mapper: table ioctl on crypt_sda5 failed
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: x86_64 Linux
Priority: release_blocker major
Target Milestone: ---
Assignee: Mageia Bug Squad
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-30 12:56 CET by Morgan Leijström
Modified: 2014-02-04 19:08 CET (History)
3 users (show)

See Also:
Source RPM: drakxtools-16.21-1.mga4
CVE:
Status comment:


Attachments
picture of log when running dmsetup failed for drakdisk (47.48 KB, image/jpeg)
2014-01-08 11:08 CET, Morgan Leijström
Details
picture of booting, see comment (79.87 KB, image/jpeg)
2014-01-08 12:12 CET, Morgan Leijström
Details
log of update where it think it need password (3.14 KB, text/plain)
2014-01-13 23:04 CET, Morgan Leijström
Details

Description Morgan Leijström 2013-12-30 12:56:15 CET
Installed cauldron x86_64 64 bit gnome a few days ago in virtualbox
____Partitioning: (also see fstab at end of post)
/boot
encrypted partition LVM containing
  /
  /home
  swap

Now i booted and issued urpmi --auto-update --auto, and among other things it updated to
drakxtools-16.18-1
dracut to dracut-034-12
kernel-desktop-3.12.6-2

...and it ended with a failure:
device-mapper: table ioctl on crypt_sda5 failed: Enheten eller adressen finns inte
Command failed
INTERNAL ERROR: unknown device mapper/crypt_sda5
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:144
fs::dmcrypt::_get_existing_one() called from /usr/lib/libDrakX/fs/dmcrypt.pm:103
fs::dmcrypt::_get_existing_one_with_state() called from /usr/lib/libDrakX/fs/dmcrypt.pm:43
fs::dmcrypt::read_crypttab_() called from /usr/lib/libDrakX/fs/dmcrypt.pm:49
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

___Same result in terminal if i now try to launch diskdrake:
# diskdrake
Too late to run INIT block at /usr/lib/perl5/vendor_perl/5.18.1/x86_64-linux-thread-multi/Glib/Object/Introspection.pm line 258.
Subroutine Gtk3::main redefined at /usr/lib/perl5/vendor_perl/5.18.1/Gtk3.pm line 296.
device-mapper: table ioctl on crypt_sda5 failed: Enheten eller adressen finns inte
Command failed
INTERNAL ERROR: unknown device mapper/crypt_sda5
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:144
fs::dmcrypt::_get_existing_one() called from /usr/lib/libDrakX/fs/dmcrypt.pm:103
fs::dmcrypt::_get_existing_one_with_state() called from /usr/lib/libDrakX/fs/dmcrypt.pm:43
fs::dmcrypt::read_crypttab_() called from /usr/lib/libDrakX/fs/dmcrypt.pm:49
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 /usr/libexec/drakdisk:74


/etc/crypttab.rpmnew is empty!

/etc/fstab.rpmnew only contain one line:
none /proc proc defaults 0 0

But the used files seem to be correct:


___ /etc/crypttab contain one line:
crypt_sda5 UUID=3358a3e1-3add-4707-8246-57235916e9db


___ /etc/fstab:
/dev/vg-mga/root / ext4 acl,relatime 1 1
# Entry for /dev/sda1 :
UUID=4010fc06-ecd2-49ef-bcd7-4ba57696c1a0 /boot ext4 relatime,acl 1 2
/dev/vg-mga/home /home ext4 relatime,acl 1 2
none /proc proc defaults 0 0
/dev/vg-mga/swap swap swap defaults 0 0
Morgan Leijström 2013-12-30 12:57:30 CET

Priority: Normal => release_blocker

Comment 1 Morgan Leijström 2013-12-30 13:11:52 CET
Results:

§ several drak tools naturally fail; NFS and SMB sharing, start configuration...

§ without interfering it rebooted sucessfully, but the old kernel.
= system is useable, and a suitable update can probably repair it.
Comment 2 Morgan Leijström 2014-01-08 10:54:47 CET
Thierry?

still valid drakxtools-16.18-2.mga4 ; on a real machine, my Thinkpad R61, same partitioning:
§ /boot
§ encrypted partition LVM containing /, /home,  swap

# diskdrake
Too late to run INIT block at /usr/lib/perl5/vendor_perl/5.18.1/x86_64-linux-thread-multi/Glib/Object/Introspection.pm line 258.
Subroutine Gtk3::main redefined at /usr/lib/perl5/vendor_perl/5.18.1/Gtk3.pm line 296.
device-mapper: table ioctl on crypt_sda5 failed: Enheten eller adressen finns inte
Command failed
INTERNAL ERROR: unknown device mapper/crypt_sda5
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:144
fs::dmcrypt::_get_existing_one() called from /usr/lib/libDrakX/fs/dmcrypt.pm:103
fs::dmcrypt::_get_existing_one_with_state() called from /usr/lib/libDrakX/fs/dmcrypt.pm:43
fs::dmcrypt::read_crypttab_() called from /usr/lib/libDrakX/fs/dmcrypt.pm:49
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 /usr/libexec/drakdisk:74

# cat /etc/crypttab
crypt_sda5 UUID=5ee6a003-cbf4-4f8a-a653-4851e53bc126

# cat /etc/fstab
/dev/vg-mga/root / ext4 acl,noatime 1 1
# Entry for /dev/sda1 :
UUID=783df074-71a1-41c7-9d45-53f687bf485d /boot ext4 noatime,acl 1 2
/dev/vg-mga/home /home ext4 acl,noatime 1 2
none /proc proc defaults 0 0
/dev/vg-mga/swap swap swap defaults 0 0

Assignee: bugsquad => thierry.vignaud
Source RPM: (none) => drakxtools-16.18-2.mga4

Comment 3 Morgan Leijström 2014-01-08 11:08:39 CET
Created attachment 4741 [details]
picture of log when running dmsetup failed for drakdisk
Comment 4 Morgan Leijström 2014-01-08 12:12:05 CET
Created attachment 4742 [details]
picture of booting, see comment

As seen on picture: during boot it manages to open encrypted LVM, mount contents, then complain.

# systemctl status systemd-cryptsetup@crypt_sda5.service
systemd-cryptsetup@crypt_sda5.service - Cryptography Setup for crypt_sda5
   Loaded: loaded (/etc/crypttab)
   Active: activating (start) since ons 2014-01-08 11:57:19 CET; 10min ago
     Docs: man:systemd-cryptsetup@.service(8)
           man:crypttab(5)
 Main PID: 2325 (systemd-cryptse)
   CGroup: /system.slice/system-systemd\x2dcryptsetup.slice/systemd-cryptsetup@crypt_sda5.service
           ââ2325 /usr/lib/systemd/systemd-cryptsetup attach crypt_sda5 /dev/disk/by-uuid/5ee6a003-cbf4-4f8a-a653-485...
Comment 5 Morgan Leijström 2014-01-08 12:14:26 CET
As an effect (of dracut not working?) this machine now since updates also have compatibility problem with kernel versus graphics driver and virtualbox module versions. :(
Comment 6 Thierry Vignaud 2014-01-08 14:25:30 CET
I've not much experience with crypted partitions.

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

Comment 7 Thierry Vignaud 2014-01-08 14:29:29 CET
could be b/c they're several soft links to the same devices and the one in /etc/cryptab differs from the one used after ("mapper/foobar" vs "foobar").
Comment 8 Pascal Terjan 2014-01-08 14:36:24 CET
I would guess it is not named /dev/mapper/crypt_sda5
IIRC it should be a symlink to /dev/dm<something>

Can you also add the content of /etc/mdadm.conf?

I have no idea how things are done nowadays, I have never touched dracut or systemd :(
Comment 9 Colin Guthrie 2014-01-08 15:12:24 CET
So dracut should copy/use the /etc/crypttab and thus bring it up as /dev/mapper/crypt_sda5. If it doesn't it would bring it up as /dev/mapper/luks-$UUID

I've got a similar-ish VM somewhere I'll update it and see if I can reproduce.
Comment 10 Morgan Leijström 2014-01-08 17:48:32 CET
thanks guys for looking into this

/etc/mdadm.conf does not exist
Comment 11 Morgan Leijström 2014-01-08 19:08:58 CET
While you have loaded this landscape in your brain, i suggest a couple more exercises ;)


Bug 12033 : make an encrypted logical volume inside a LVM, and later try to remove it.


Also check it can create and remove a encrypted regular physical partition.


Also a question, can it resize an encrypted logical volyme correctly nowadays?  I remember it had some problem when i tried a couple years ago.



  I would be very grateful if the issues can be solved :)
Comment 12 Morgan Leijström 2014-01-10 09:43:30 CET
I also now and then get the KDE systray informational popup saying:

Broadcast message from root@bamse (Fri 2014-01-10 09:36:55 CET): Password entry required for 'Please enter passphrase for disk Corsair_Force_GT (crypt_sda5)!' (PID 21560). Please enter password with the systemd-tty-ask-password-agent tool!
Comment 13 Thierry Vignaud 2014-01-10 11:14:25 CET
Closing then

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

Comment 14 Colin Guthrie 2014-01-10 11:24:08 CET
@TV did you mean to close this one?
Comment 15 Thierry Vignaud 2014-01-10 16:24:19 CET
Yes. Isn't it fixed?
If not, sorry
Comment 16 Colin Guthrie 2014-01-10 17:44:34 CET
(In reply to Thierry Vignaud from comment #15)
> Yes. Isn't it fixed?
> If not, sorry

I don't see any comments relating to it being fixed but perhaps I missed something?
Comment 17 Morgan Leijström 2014-01-10 17:53:20 CET
Maybe my comment 12 was misunderstood.
I meant to report a side effect (or possible another bug).

Except for diskdrake and related tools like dracut the system is working and runs on /, swap, /home logical LVM partitions inside the encrypted partition.

Still not working after todays updates.

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

Comment 18 Morgan Leijström 2014-01-13 23:04:14 CET
Created attachment 4774 [details]
log of update where it think it need password

Another effect of the same problem: update triggered a bunch of:
"
Password entry required for 'Please enter passphrase for disk Corsair_Force_GT (crypt_sda5)!' (PID 15380).
Please enter password with the systemd-tty-ask-password-agent tool!
 "
Comment 19 Morgan Leijström 2014-01-13 23:33:58 CET
Webmin see it, and use the form
Device file	/dev/vg-mga/home
Morgan Leijström 2014-01-13 23:35:31 CET

Source RPM: drakxtools-16.18-2.mga4 => drakxtools-16.21-1.mga4

Comment 20 Colin Guthrie 2014-01-25 13:21:31 CET
I just setup a test VM installing with the same layout from the final x86_64 iso.

Installed same disk layout + GNOME.
After first boot, I installed updates, including new kernel.

All went smoothly and reboot also worked fine.

Can I ask if in your testing you've done a fresh install or if this is continually being upgraded?

I suspect the problem stems from an invalid dracut initrd fixed some time ago. It wouldn't use the crypttab properly and would ultimately startup the luks under a different name. THe system could then misbehave.

This is now resolved (I fixed it just before this bug was posted, but it may have taken a while to get into the ISO etc. and thus the fix wouldn't come in until later), as a result, you may have a /dev/mapper/luks-* device instead and can't really escape from using it, even if your cryptab refers to a different device.

I suspect a fresh install from latest ISO would be fine and not encounter this problem.
Comment 21 Morgan Leijström 2014-01-25 23:12:00 CET
Thank you Colin

final iso available already?

Ah, nice, I take your word that fresh installs should work now.


The system where i initially encountered the bug was a mga2 system x86_64, upgraded using mga4-beta2 DVD.

Then i tried a fresh install in a virtualbox VM, (see bug description) but had time to post this bug only a few days after.
- so probably just before your fix.



What about upgrading asystem (mga2 or 3) which have this layout (encrypted LVM containing /home and more)
I guess they are locked into this bug, or is there a workaround?
Should there be a notice in the errata maybe?
Comment 22 Morgan Leijström 2014-01-28 18:13:41 CET
Related: https://bugs.mageia.org/show_bug.cgi?id=12070#c6
Comment 23 Morgan Leijström 2014-02-04 19:08:57 CET
In reply to my comment 21:

I made a sucessfull reinstall on a system that had /, /home, swap on LVM on a luks partition, separate /boot.

(mga4 installer unlocked the encrypted partiton with the key i gave, and the LVM  tab then appeared)

I reformatted all but /home

Full OK.  Closing fixed.

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


Note You need to log in before you can comment on or make changes to this bug.