WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Problem with devmapper?  (Read 1976 times)

Offline nitpicker

  • Newbie
  • *
  • Posts: 3
Problem with devmapper?
« on: January 07, 2018, 03:55:31 PM »
Hi everyone!

After a few successful projects with piCore 8 and 9, I'm now trying to set up a file server using piCore 9.0.3. In order to encrypt the personal files on the storage device, I usually rely on cryptsetup / LUKS.

Since I couldn't find an extension providing cryptsetup in the 9.x repo, I've compiled cryptsetup and created a new extension.
There wasn't a problem during compilation and cryptsetup starts without complaints after being "inserted" into the system using tce-load. But after entering the passphrase for formatting or creating an encrypted device, the program seems to get caught in an endless loop.

I've already tried different versions of cryptsetup (1.7.5 and 2.0.0, the latter needed an additional library for luks2: libargon2) and different versions of piCore (9.0.3 and 8.1.5), but each combination shows the same behavior.

I've also compiled cryptsetup with debug symbols and attached gdb to the running process to see where it gets stuck. The backtrace shows that it's locked somewhere in libdevmapper.
I've also been experiencing problems when using losetup to attach a loop device to a file:
Code: [Select]
dd if=/dev/zero of=test.img bs=1M count=128
chmod 666 test.img
sudo losetup -f test.img
just tells me that it can't find that image file.

So now I'm wondering if there are any known issues with the device mapper in piCore? I suppose it should work flawlessly, because all the extensions are installed using loop devices...

Btw, I've tried to use cryptsetup on Raspbian (using the same setup: Pi + external harddisk) and that worked just fine. I've even created an extension for piCore containing Raspbian's cryptsetup binary along with the required libraries. This one also hung after entering the passphrase, so I really don't think it's a cryptsetup issue...

Any input on that issue would be greatly appreciated!

Best regards
Tim

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: Problem with devmapper?
« Reply #1 on: January 08, 2018, 06:19:08 AM »
Just noting that normal loops do not use devmapper.
The only barriers that can stop you are the ones you create yourself.

Offline nitpicker

  • Newbie
  • *
  • Posts: 3
Re: Problem with devmapper?
« Reply #2 on: January 09, 2018, 12:47:52 PM »
Quote
Just noting that normal loops do not use devmapper.

Good to know. So, that was a wrong assumption of mine because neither cryptsetup nor losetup were able to create the required loop device...  :(

Today, I've tried to reach me goal by using veracrypt.
Veracrypt is able to create an encrypted container on the harddisk, but when it fires up dmsetup to create a container device to mount the volume, it's also in a deadlock.

I'm running out of ideas.  :'(
Am I the only one having problems with dmsetup & friends, or am I making some stupid mistake?

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Problem with devmapper?
« Reply #3 on: January 10, 2018, 12:07:11 AM »
There are two main differences in piCore compared to Raspbian. First, most kernel modules are not installed by default. You may need modules to install for encryption or other use. Is dm-...tcz installed? Check loaded modules on Raspbian. Second is buysbox. You may need the standard utilities, install coreutils.tcz
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline nitpicker

  • Newbie
  • *
  • Posts: 3
Re: Problem with devmapper?
« Reply #4 on: January 10, 2018, 05:03:13 PM »
Thanks for the hints! :)

Quote
Second is buysbox. You may need the standard utilities, install coreutils.tcz
I had already been aware that losetup was provided by busybox, but I had expected it to work nonetheless.  ???
You're right, installing util-linux provides the "full" version, which works as it should. No more "file not found" errors.

Quote
You may need modules to install for encryption or other use
I've compared the output of lsmod on both Raspbian and piCore:
moduleRaspbianpiCoreremarks
af_algyes(yes)crypto, compiled into piCore kernel
algif_skcipheryes(yes)crypto, compiled into piCore kernel
bcm2835_gpiomemyesyes
bluetoothyesbluetooth stuff
bnepyesbluetooth stuff
brcmfmacyeswireless stuff
brcmutilyeswireless stuff
btbcmyesbluetooth stuff
cfg80211yeswireless stuff
cmacyescrypto
dm_cryptyessuspect!
dm_modyessuspect!
drmyesdirect rendering
drm_kms_helperyesdirect rendering
evdevyesyes
fb_sys_fopsyesframe buffer
fixedyesyes
gf128mulyes(yes)crypto, compiled into piCore kernel
hci_uartyesbluetooth stuff
i2c_algo_bityesi2c bus
i2c_bcm2835yesi2c bus
i2c_devyesyesi2c bus
i2c_gpioyesi2c bus
ip_tablesyesnetwork stuff
ipv6yesnetwork stuff
panel_raspberrypi_touchscreenyespanel stuff
rfkillyesyes
sgyesSCSI driver
sndyessound
snd_bcm2835yessound
snd_compressyessound
snd_pcmyessound
snd_pcm_dmaengineyessound
snd_timeryessound
snd_soc_coreyessound
squashfsyes
syscopyareayesdirect rendering
sysfillrectyesdirect rendering
sysimgbltyesdirect rendering
uioyesyesuserspace I/O
uio_pdrv_genirqyesyesuserspace I/O
vc4yesdirect rendering
x_tablesyesnetwork stuff
xtsyes(yes)crypto, compiled into piCore kernel
zramyes
zsmallocyes

The only suspects I could identify were dm_mod and dm_crypt. I modprobe'd both, but that didn't change anything. :(

Since lsmod only provides information about modules and doesn't show what's been compiled into the kernel, I also compared the default config of the Raspbian kernel and the piCore kernel. But I can't see anything suspicious there. I'm attaching the info that diff gave me to this post.

Quote
Is dm-...tcz installed?
Yes. I included lvm2 as a dependency for the cryptsetup extension, which requires raid-dm-KERNEL.tcz for itself.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Problem with devmapper?
« Reply #5 on: January 11, 2018, 01:00:01 AM »
Check the full kernel module archive on the server download are for missing modules. Less frequently used moduels are not packed into a .tcz you must do it yourself.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."