Gentoo Archives: gentoo-user

From: Dale <rdalek1967@×××××.com>
To: Gentoo User <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] cryptsetup close and device in use when it is not
Date: Sun, 19 Sep 2021 11:55:33
Message-Id: f51492b9-873c-0533-f818-3efe73fc42b2@gmail.com
In Reply to: Re: [gentoo-user] cryptsetup close and device in use when it is not by Ramon Fischer
1 Ramon Fischer wrote:
2 > Hi Dale,
3 >
4 >>   So, something says it is busy but eventually
5 >> releases it if left alone for a while.  I'd like to know what it is and
6 >> if it is really in use or not.  Thing is, I can't find a way to know
7 >> what it is that is using it.  The dmsetup command shows it is in use but
8 >> no way to know what is using it.
9 > I could reproduce this issue by killing my desktop process, unmounting
10 > the home partition and playing some "kill process" bingo. I could
11 > backtrace it to one unkillable process "kcryptd":
12 >
13 >    1. Kill "awesomewm": <CTRL + ALT> + Backspace
14 >    2. Kill other processes accessing "/home/"
15 >    3. umount /home
16 >    4. cryptsetup close crypthome
17 >    Device crypthome is still in use
18 >    5. dmsetup info /dev/mapper/crypthome
19 >    Name:              crypthome
20 >    State:             ACTIVE
21 >    Read Ahead:        256
22 >    Tables present:    LIVE
23 >    Open count:        1
24 >    Event number:      0
25 >    Major, minor:      253, 1
26 >    Number of targets: 1
27 >    UUID: CRYPT-LUKS2-<some_uuid>-crypthome
28 >    6. Kill any unnecessary process and try "cryptsetup close crypthome"
29 >    7. Search for major, minor: ps aux | grep "253:1"
30 >    root       150  0.2  0.0      0     0 ?        I    15:21   0:02
31 >    [kworker/u16:5-kcryptd/253:1]
32 >    8. Does not work: kill 150
33 >    9. Does not work and could be dangerous: kill -9 150
34 >
35 > So, there was still one "kcryptd" process left, accessing the hard
36 > drive, but I found no way to kill it.
37 >
38 > Maybe this could be helpful?
39 >
40 > -Ramon
41 >
42
43
44 Well, it still does it but there is no rhyme or reason to when it says
45 in use and when it closes when asked too.  I to saw a process kcryptd
46 but not sure what triggers it. I didn't try to kill it since I'm pretty
47 sure it is a kernel process.  I build everything into my kernel, no
48 modules.  Sort of scared to mess with it. 
49
50 So, sometimes it works as it should, sometimes not.  When it doesn't, if
51 I leave it alone for a while then try again, it works.  I also checked
52 to be sure SMART wasn't doing something but if it is, I couldn't see
53 it.  Since it is a removable drive, I don't have it set to do anything
54 either. 
55
56 I guess I'll just have to wait on it to finish whatever it is doing to
57 close it when it gets stubborn.  Maybe this is a bug, maybe it has a
58 really good reason for not closing.  Who knows.  :/
59
60 Thanks to all for the help.  We gave it a good try.
61
62 Dale
63
64 :-)  :-)