Re: Device ... is still in use.

Jean-Paul Calderone <exarkun-wgPraSjSqjuEakHPNWoOSQC/[email protected]>
Newsgroups gmane.linux.kernel.device-mapper.dm-crypt
Message-ID <CAEeXt4N=CeYzr0_A0+q2ZYyf2hMUbcL80850-qrPSNT88tBWng@mail.gmail.com>
On Mon, Aug 19, 2019 at 9:16 AM Milan Broz <[email protected]> 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.

lsof is similarly quiet:

$ sudo lsof /dev/mapper/luks-64ca6f08-82c9-4571-a976-f37a83aca3b1
> $


Poking further with dmsetup it looks like /dev/dm-0 might be what's keeping
the luks device busy?  I'm not completely sure I'm interpreting this output
right though:

$ sudo dmsetup ls
luks-64ca6f08-82c9-4571-a976-f37a83aca3b1       (254:0)
$ ls -l /dev/dm-0
brw-rw---- 1 root disk 254, 0 Aug 18 19:48 /dev/dm-0
$ sudo lsof /dev/dm-0
$ mount | grep dm-0
$


 Thanks again,
Jean-Paul

_______________________________________________
dm-crypt mailing list
[email protected]
https://www.saout.de/mailman/listinfo/dm-crypt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.