WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Missing DM module??? during drive encyrption  (Read 234 times)

Offline euless

  • Newbie
  • *
  • Posts: 21
Missing DM module??? during drive encyrption
« on: November 11, 2024, 09:49:05 AM »
HI,

When I try to encrypt a thumbdrive, I get error message about "Cannot initialize device-mapper. Is dm_mod kernel module loaded?"

How do I get this dm_mod and how do I load it? 

Thanks!!!

Quote
root@box:/home/tc# cryptsetup luksFormat --type luks2 /dev/sdd
WARNING: Device /dev/sdd already contains a 'crypto_LUKS' superblock signature.

WARNING!
========
This will overwrite data on /dev/sdd irrevocably.

Are you sure? (Type 'yes' in capital letters): YES
Enter passphrase for /dev/sdd:
Verify passphrase:
root@box:/home/tc# cryptsetup open /dev/sdd root
Cannot initialize device-mapper. Is dm_mod kernel module loaded?
Cannot use device root, name is invalid or still in use.
Enter passphrase for /dev/sdd:
Cannot initialize device-mapper. Is dm_mod kernel module loaded?
Cannot use device root, name is invalid or still in use.

Offline gadget42

  • Hero Member
  • *****
  • Posts: 780
Re: Missing DM module??? during drive encyrption
« Reply #1 on: November 11, 2024, 10:47:38 AM »
did a forum search for dm_mod and briefly scanned them, perhaps this one might help:

https://forum.tinycorelinux.net/index.php/topic,21613.msg135266.html#msg135266
The fluctuation theorem has long been known for a sudden switch of the Hamiltonian of a classical system Z54 . For a quantum system with a Hamiltonian changing from... https://forum.tinycorelinux.net/index.php/topic,25972.msg166580.html#msg166580

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11594
Re: Missing DM module??? during drive encyrption
« Reply #2 on: November 11, 2024, 10:51:22 AM »
Hi euless
I think you want to install  raid-dm-KERNEL.tcz

Offline euless

  • Newbie
  • *
  • Posts: 21
Re: Missing DM module??? during drive encyrption
« Reply #3 on: November 11, 2024, 09:27:30 PM »
Hi euless
I think you want to install  raid-dm-KERNEL.tcz

OK.  The dm module is actually in raid-dm-6.6.8-tinycore64.tcz.  After I installed this, that error message no longer appear.

But there is another problem.  It freezes on "cryptsetup open ...".  Any idea?

Thanks!!!
« Last Edit: November 11, 2024, 09:29:48 PM by euless »

Offline euless

  • Newbie
  • *
  • Posts: 21
Re: Missing DM module??? during drive encyrption
« Reply #4 on: November 11, 2024, 10:07:08 PM »
Hi euless
I think you want to install  raid-dm-KERNEL.tcz


Here is the  debug report if that helps.  Thanks!!!

Code: [Select]
root@box:/home/tc# cryptsetup --debug open /dev/sdd1 root
# cryptsetup 2.7.2 processing "cryptsetup --debug open /dev/sdd1 root"
# Verifying parameters for command open.
# Running command open.
# Installing SIGINT/SIGTERM handler.
# Unblocking interruption on signal.
# Allocating context for crypt device /dev/sdd1.
# Trying to open and read device /dev/sdd1 with direct-io.
# Initialising device-mapper backend library.
# Trying to load any crypt type from device /dev/sdd1.
# Crypto backend (OpenSSL 3.2.0 23 Nov 2023 [default][legacy][threads][argon2])     initialized in cryptsetup library version 2.7.2.
# Detected kernel Linux 6.6.8-tinycore64 x86_64.
# Loading LUKS2 header (repair disabled).
# Acquiring read lock for device /dev/sdd1.
# Locking directory /run/cryptsetup will be created with default compiled-in per    missions.
# Opening lock resource file /run/cryptsetup/L_8:49
# Verifying lock handle for /dev/sdd1.
# Device /dev/sdd1 READ lock taken.
# Trying to read primary LUKS2 header at offset 0x0.
# Opening locked device /dev/sdd1
# Verifying locked device handle (bdev)
# LUKS2 header version 2 of size 16384 bytes, checksum sha256.
# Checksum:914697c4580e982e44944f313790202a65d2f9451b5f860c5233a8c57cf8b692 (on-    disk)
# Checksum:914697c4580e982e44944f313790202a65d2f9451b5f860c5233a8c57cf8b692 (in-    memory)
# Trying to read secondary LUKS2 header at offset 0x4000.
# Reusing open ro fd on device /dev/sdd1
# LUKS2 header version 2 of size 16384 bytes, checksum sha256.
# Checksum:a40a8375b34aff531e9ea8209ca7bfb962b432e077e29339e92b6636ba70bdee (on-    disk)
# Checksum:a40a8375b34aff531e9ea8209ca7bfb962b432e077e29339e92b6636ba70bdee (in-    memory)
# Device size 1073741824, offset 16777216.
# Device /dev/sdd1 READ lock released.
# PBKDF argon2id, time_ms 2000 (iterations 0), max_memory_kb 1048576, parallel_t    hreads 4.
# Activating volume root [keyslot -1] using token.
# Creating directory "/dev/mapper"
# Creating device /dev/mapper/control (10, 236)
# dm version   [ opencount flush ]   [16384] (*1)
# dm versions   [ opencount flush ]   [16384] (*1)
# Detected dm-ioctl version 4.48.0.
# Device-mapper backend running with UDEV support enabled.
# dm status root  [ opencount noflush ]   [16384] (*1)
No usable token is available.
# Interactive passphrase entry requested.
Enter passphrase for /dev/sdd1:
# Activating volume root [keyslot -1] using passphrase.
# dm versions   [ opencount flush ]   [16384] (*1)
# dm status root  [ opencount noflush ]   [16384] (*1)
# Keyslot 0 priority 1 != 2 (required), skipped.
# Trying to open LUKS2 keyslot 0.
# Running keyslot key derivation.
# Reading keyslot area [0x8000].
# Acquiring read lock for device /dev/sdd1.
# Opening lock resource file /run/cryptsetup/L_8:49
# Verifying lock handle for /dev/sdd1.
# Device /dev/sdd1 READ lock taken.
# Reusing open ro fd on device /dev/sdd1
# Device /dev/sdd1 READ lock released.
# Verifying key from keyslot 0, digest 0.
# Digest 0 (pbkdf2) verify failed with -1.
No key available with this passphrase.
# Interactive passphrase entry requested.
Enter passphrase for /dev/sdd1:
# Activating volume root [keyslot -1] using passphrase.
# dm versions   [ opencount flush ]   [16384] (*1)
# dm status root  [ opencount noflush ]   [16384] (*1)
# Keyslot 0 priority 1 != 2 (required), skipped.
# Trying to open LUKS2 keyslot 0.
# Running keyslot key derivation.
# Reading keyslot area [0x8000].
# Acquiring read lock for device /dev/sdd1.
# Opening lock resource file /run/cryptsetup/L_8:49
# Verifying lock handle for /dev/sdd1.
# Device /dev/sdd1 READ lock taken.
# Reusing open ro fd on device /dev/sdd1
# Device /dev/sdd1 READ lock released.
# Verifying key from keyslot 0, digest 0.
# dm versions   [ opencount flush ]   [16384] (*1)
# Loading key (type logon, name cryptsetup:a56dfa88-2169-4463-9e09-06d04fd5f7ed-    d0) in thread keyring.
# dm versions   [ opencount flush ]   [16384] (*1)
# dm status root  [ opencount noflush ]   [16384] (*1)
# Calculated device size is 2064384 sectors (RW), offset 32768.
# dm versions   [ opencount flush ]   [16384] (*1)
# DM-UUID is CRYPT-LUKS2-a56dfa88216944639e0906d04fd5f7ed-root
# Udev cookie 0xd4d1a77 (semid 0) created
# Udev cookie 0xd4d1a77 (semid 0) incremented to 1
# Udev cookie 0xd4d1a77 (semid 0) incremented to 2
# Udev cookie 0xd4d1a77 (semid 0) assigned to CREATE task(0) with flags DISABLE_    LIBRARY_FALLBACK         (0x20)
# dm create root CRYPT-LUKS2-a56dfa88216944639e0906d04fd5f7ed-root [ opencount f    lush ]   [16384] (*1)
# dm reload root  [ opencount flush securedata ]   [16384] (*1)
# dm resume root  [ opencount flush securedata ]   [16384] (*1)
# root: Stacking NODE_ADD (251,0) 0:0 0600 [trust_udev]
# root: Stacking NODE_READ_AHEAD 256 (flags=1)
# Udev cookie 0xd4d1a77 (semid 0) decremented to 1
# Udev cookie 0xd4d1a77 (semid 0) waiting for zero

    [Edit]: Changed quote tags to code tags.  Rich
« Last Edit: November 11, 2024, 10:32:34 PM by Rich »

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11594
Re: Missing DM module??? during drive encyrption
« Reply #5 on: November 11, 2024, 10:34:43 PM »
Hi euless
Try installing  lvm2.tcz. You may need to restart the computer.

Offline euless

  • Newbie
  • *
  • Posts: 21
Re: Missing DM module??? during drive encyrption
« Reply #6 on: November 12, 2024, 05:19:02 AM »
Hi euless
Try installing  lvm2.tcz. You may need to restart the computer.

Ok.  Lvm2.tcz fixed the problem.  Everything seems to be working now.  Thanks!

Offline euless

  • Newbie
  • *
  • Posts: 21
Re: Missing DM module??? during drive encyrption
« Reply #7 on: November 12, 2024, 05:33:00 AM »
By the way, anybody know what if I forget to "cryptsetup close ..." the LUKS container before shutdown?   Will that cause any problem like corrupting the data?

Or would Linux close the LUKS container automatically?

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11594
Re: Missing DM module??? during drive encyrption
« Reply #8 on: November 12, 2024, 09:00:01 AM »
Hi euless
I don't know anything about LUKS or encrypted drives, so the
following is pure speculation.

While it's possible that LUKS uses a journal (like EXT4) to allow
it to recover in case of a crash or power failure, it's always best
not to tempt fate and close the container when done.

A normal shutdown closes all files and unmounts all drives. This
will force any data still being buffered in RAM to be written out
to the drive. Whether this includes LUKS containers, I don't know.

If you open  /opt/shutdown.sh  you can add your  cryptsetup close
command right after where it says:
Code: [Select]
# put user shutdown commands here
/opt/shutdown.sh  gets called regardless of whether you use the  Exit
icon to shut down or the command line to shut down:
Code: [Select]
exitcheck.sh shutdown