[dm-crypt] Failure to encrypt a big disk - missing kernel module?

Carlos E. R. robin.listas at telefonica.net
Mon Apr 17 23:17:10 CEST 2017


On 2017-04-15 14:22, Carlos E. R. wrote:
> On 2017-04-15 09:51, Milan Broz wrote:
>> On 04/15/2017 04:35 AM, Carlos E. R. wrote:
>>>
>>> Maybe cryptsetup could detect mount status? :-?
>>
>> Actually it already tests device for exclusive access (it is not only mount,
>> also for use in RAID, other device-mapper mappings etc), not sure why it
>> was detected so late. Maybe that debug would reveal it ;-)
>> Maybe it is racing with some automatic mount utility, dunno.
> 
> I think I tried twice. If not immediately, later.
> 
>> (The correct message should be "Cannot format device %s which is still in use."
>> but apparently it was not failing during this step.)
> 
> Yes, that message would be very indicative :-)
> 
> 
> As that partition is still unused I did an experiment. I formatted it
> again as XFS, destroying the encryption, with gparted. Instantly it
> appeared mounted in the desktop. I tried to apply a label to it and
> failed, because it was mounted.
> 
> So I mount it, label it, and again instantly, the device is again
> mounted on the desktop - this morning I can see the display.
> 
> I have now disabled this action in the XFCE desktop. Settings, removable
> drives and media, Storage tab. Will not happen again - in this computer!
> With my memory, I will forget the next time ;-)
> 
> 
> So it is the desktop, not apparently systemd, and 'cryptsetup' could see
> the situation before starting.
> 
> If you want me to run strace or something, I still can. I will probably
> encrypt it this afternoon.

I tried an strace. See:


fstat(6, {st_mode=S_IFREG|0644, st_size=49, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa3cb134000
read(6, "# see udev.conf(5) for details\n\n"..., 4096) = 49
read(6, "", 4096)                       = 0
close(6)                                = 0
munmap(0x7fa3cb134000, 4096)            = 0
access("/run/udev/control", F_OK)       = 0
open("/dev/urandom", O_RDONLY)          = 6
read(6, "\30\371", 2)                   = 2
semget(0xd4df918, 1, IPC_CREAT|IPC_EXCL|0600) = 655360
semctl(655360, 0, SETVAL, 0x1)          = 0
semctl(655360, 0, GETVAL, 0x7fa3ca64057a) = 1
close(6)                                = 0
semop(655360, {{0, 1, 0}}, 1)           = 0
semctl(655360, 0, GETVAL, 0x7fa3ca640517) = 2
open("/dev/sdc2", O_RDONLY)             = 6
ioctl(6, BLKRAGET, 1024)                = 0
close(6)                                = 0
ioctl(5, DM_DEV_CREATE, 0x173bd80)      = 0
ioctl(5, DM_TABLE_LOAD, 0x173bd80)      = -1 EBUSY (Device or resource busy)   <===============================
semget(0xd4df918, 1, 0)                 = 655360
semctl(655360, 0, GETVAL, 0x800)        = 2
semop(655360, {{0, -1, IPC_NOWAIT}}, 1) = 0
semget(0xd4df918, 1, 0)                 = 655360
semop(655360, {{0, 1, 0}}, 1)           = 0
semctl(655360, 0, GETVAL, 0x7fa3ca640517) = 2
ioctl(5, DM_DEV_REMOVE, 0x173bc50)      = 0
semget(0xd4df918, 1, 0)                 = 655360
semctl(655360, 0, GETVAL, 0x800)        = 1
semop(655360, {{0, -1, IPC_NOWAIT}}, 1) = 0
semop(655360, {{0, 0, 0}}, 1)           = 0
semctl(655360, 0, IPC_RMID, 0)          = 0
stat("/dev/mapper/temporary-cryptsetup-4051", 0x7fffaad42dd0) = -1 ENOENT (No such file or directory)
write(2, "Failed to setup dm-crypt key map"..., 139) = 139
close(5)                                = 0
munlockall()                            = 0
setpriority(PRIO_PROCESS, 0, 0)         = 0
exit_group(1)                           = ?
+++ exited with 1 +++


I need that disk now, so this is my end of testing.


-- 
Cheers / Saludos,

		Carlos E. R.
		(from 42.2 x86_64 "Malachite" at Telcontar)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://www.saout.de/pipermail/dm-crypt/attachments/20170417/8978316c/attachment.asc>


More information about the dm-crypt mailing list