Re: Device ... is still in use.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 19, 2019 at 9:46 AM Milan Broz <gmazyland@xxxxxxxxx> wrote:
On 19/08/2019 15:23, Jean-Paul Calderone wrote:
> On Mon, Aug 19, 2019 at 9:16 AM Milan Broz <gmazyland@xxxxxxxxx <mailto:gmazyland@xxxxxxxxx>> wrote:
>
>     On 19/08/2019 14:59, Jean-Paul Calderone wrote:
>     > Hello,
>     >
>     > I have a luks device on removable media that has somehow become stuck on my system.  The physical media has been disconnected but the luks device continues to exist and I cannot remove it.
>     >
>     > cryptosetup close fails:
>     >
>     >     $ sudo cryptsetup close luks-64ca6f08-82c9-4571-a976-f37a83aca3b1
>     >     Device luks-64ca6f08-82c9-4571-a976-f37a83aca3b1 is still in use.
>     >
>     >
>     > I don't understand what is still using the device.  It is not mounted anywhere:
>     >
>     >     $ mount | grep luks-64ca6f08-82c9-4571-a976-f37a83aca3b1
>
>     See output of lsblk - it can have mapped partitions or lvm over it,
>     you need to deactivate it.
>
>     Also check lsof output if some process is not stuck keeping something open there.
>
>
> Thanks for the suggestion.  `lsblk --all` doesn't mention the device - either the mapped luks device or the underlying block device.  It mentions some ram devices, some loopback devices (but `losetup --all` says none are in use), and my internal storage devices.

If you can see it as /dev/dm-0 and in /dev/mapper but lsblk does not show it, your system seems
to be misconfigured (lsblk should read internal kernel state from sysfs).

What says "dmsetup info -c" ?

$ sudo dmsetup info -c
Name                                      Maj Min Stat Open Targ Event  UUID                                       
luks-64ca6f08-82c9-4571-a976-f37a83aca3b1 254   0 L--w    1    1      0 CRYPT-LUKS1-64ca6f0882c94571a976f37a83aca3b1-luks-64ca6f08-82c9-4571-a976-f37a83aca3b1
$
 

The /dev/dm-0 *is* the luks device itself (/dev/mapper/luks* should be symlink to it).

Anyway, if you just need to remove it by force, use
  dmsetup remove luks-64ca6f08-82c9-4571-a976-f37a83aca3b1
if it still complains, add "--force" option - it will remap it to error target removing all references to underlying devices and keys.

Also check syslog if there is any related message (crash or something that could explain it).

Looks like something bad going on at a lower level:

$ sudo dmsetup remove /dev/dm-0
device-mapper: remove ioctl on luks-64ca6f08-82c9-4571-a976-f37a83aca3b1  failed: Device or resource busy
Command failed.
$ sudo dmsetup remove --force /dev/dm-0
device-mapper: remove ioctl on luks-64ca6f08-82c9-4571-a976-f37a83aca3b1  failed: Device or resource busy
Command failed.
$ dmesg | tail -n 1
[1323040.325203] Buffer I/O error on dev dm-0, logical block 1968624, async page read

And every `dmsetup remove --force` adds another `Buffer I/O error ...` like the above.

Thanks,
Jean-Paul

_______________________________________________
dm-crypt mailing list
dm-crypt@xxxxxxxx
https://www.saout.de/mailman/listinfo/dm-crypt

[Index of Archives]     [Device Mapper Devel]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux