Gentoo Archives: gentoo-user

From: Dale <rdalek1967@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] cryptsetup close and device in use when it is not
Date: Mon, 21 Jun 2021 05:59:48
Message-Id: 9946c2eb-bb5c-a9c0-ced9-1ac269cd69a0@gmail.com
In Reply to: Re: [gentoo-user] cryptsetup close and device in use when it is not by Dale
1 Dale wrote:
2 > Dale wrote:
3 >> Dale wrote:
4 >>> Dale wrote:
5 >>>> Jack wrote:
6 >>>>> Is it possible it was still syncing cache out to the physical drive? 
7 >>>>> I wonder if iotop would show any activity for that drive if that's the
8 >>>>> case?
9 >>>>>
10 >>>>> Jack
11 >>>>>
12 >>>>>
13 >>>>>
14 >>>> I may try that next time but the light had stopped blinking for several
15 >>>> minutes.  Since it is a SMR drive, I always leave it running until I
16 >>>> can't feel the heads bumping around.  I don't think it would be that
17 >>>> but, it's worth a try. It may lead to something. 
18 >>>>
19 >>>> Will update when it does it again. 
20 >>>>
21 >>>> Thanks.
22 >>>>
23 >>>> Dale
24 >>>>
25 >>>> :-)  :-) 
26 >>>>
27 >>> I had to wait until I was doing backups again to try anything.  The 6TB
28 >>> drive did fine.  The 8TB drive is giving the in use error.  The drive is
29 >>> unmounted but iotop didn't show anything and the light isn't blinking
30 >>> either.  I'd think if it was flushing cache the light would flash and it
31 >>> would not umount. 
32 >>>
33 >>> I tried the udev-trigger trick but it didn't work.  I don't know how
34 >>> long it will stay 'in use' so if anyone has ideas, think and type fast. 
35 >>> If not, may have to wait until next time to try again.
36 >>>
37 >>> Dale
38 >>>
39 >>> :-)  :-) 
40 >>>
41 >> Some more info:
42 >>
43 >>
44 >> root@fireball / # lvs
45 >>   LV     VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log
46 >> Cpy%Sync Convert
47 >>   Home2  Home2  -wi-ao----
48 >> <12.74t                                                   
49 >>   swap   OS     -wi-ao---- 
50 >> 12.00g                                                   
51 >>   usr    OS     -wi-ao---- 
52 >> 35.00g                                                   
53 >>   var    OS     -wi-ao---- 
54 >> 52.00g                                                   
55 >>   backup backup -wi-ao----
56 >> 698.63g                                                   
57 >> root@fireball / # vgs
58 >>   VG     #PV #LV #SN Attr   VSize    VFree 
59 >>   Home2    2   1   0 wz--n-  <12.74t      0
60 >>   OS       1   3   0 wz--n- <124.46g <25.46g
61 >>   backup   1   1   0 wz--n-  698.63g      0
62 >> root@fireball / # pvs
63 >>   PV         VG     Fmt  Attr PSize    PFree 
64 >>   /dev/sda7  OS     lvm2 a--  <124.46g <25.46g
65 >>   /dev/sdb1  Home2  lvm2 a--    <5.46t      0
66 >>   /dev/sdc1  Home2  lvm2 a--    <7.28t      0
67 >>   /dev/sdd1  backup lvm2 a--   698.63g      0
68 >> root@fireball / # cryptsetup close 8tb
69 >> Device 8tb is still in use.
70 >> root@fireball / #
71 >>
72 >>
73 >> As you can see, lvm doesn't even show the device but it is still under
74 >> /dev as tho it is available.  Weird. 
75 >>
76 >> I found this but at the end, the command doesn't help me.  I'm not sure
77 >> why.  It does talk about using LUKS on top of LVM causing this problem. 
78 >> Since the fix doesn't work, is this a different problem??
79 >>
80 >>
81 >> https://linux-blog.anracom.com/tag/device-still-in-use/
82 >>
83 >>
84 >> I've tried every command I can find and it still shows busy.  I even
85 >> restarted udev and lvm.  Still busy. 
86 >>
87 >> Ideas?
88 >>
89 >> Dale
90 >>
91 >> :-)  :-) 
92 >>
93 >
94 > Found another tidbit of info that may shed some light on this problem. 
95 > I'm not sure what it means tho.
96 >
97 >
98 >
99 > root@fireball / # lsblk
100 > NAME              MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
101 > <<<SNIP>>>
102 > sdj                 8:144  1   7.3T  0 disk 
103 > └─sdj1              8:145  1   7.3T  0 part 
104 >   └─8tb           254:5    0   7.3T  0 crypt /mnt/8tb
105 > sr0                11:0    1  1024M  0 rom  
106 > root@fireball / #
107 >
108 >
109 > So, something called crypt seems to have it open.  Now how do I tell it
110 > to go away?  Hmmmm.  Then I came up with this idea:
111 >
112 >
113 > root@fireball / # ps aux | grep crypt
114 > root       493  0.0  0.0      0     0 ?        I<   Jun13   0:00 [cryptd]
115 > root     11509  0.0  0.0   7728  2448 pts/2    S+   00:30   0:00 grep
116 > --colour=auto crypt
117 > root     23667  0.0  0.0      0     0 ?        I<   Jun20   0:00
118 > [kcryptd_io/254:]
119 > root     23668  0.0  0.0      0     0 ?        I<   Jun20   0:00
120 > [kcryptd/254:5]
121 > root     23669  0.0  0.0      0     0 ?        S    Jun20   0:00
122 > [dmcrypt_write/2]
123 > root@fireball / #
124 >
125 >
126 > So kcryptd is the offender it seems since it matches MAJ:MIN info.  I
127 > assume that is kernel related not KDE.  Can I just kill that process? 
128 > Will it do damage if I kill it or is there a better way? 
129 >
130 > Dale
131 >
132 > :-)  :-) 
133 >
134
135
136 After staring at it a while, it hit me that lsblk is showing it as still
137 mounted, even tho I umounted already without error.  So, I just ran the
138 umount command again.  After that, it closed just fine.  So, it seems to
139 be mounted twice, not once.  I mount using this command 'mount /mnt/8tb'
140 which uses fstab to mount the correct UUID device to that mount point. 
141 Surely it only mounts once.  Always has in the past.  So why is it being
142 mounted twice now?  None of my scripts used for backups includes any
143 mounting commands.  There's also only one entry in fstab as well. 
144
145 Anyone have any idea while it gets mounted twice?  Does the cryptsetup
146 open command mount it in some way and then I mount it manually as well??
147 When I opened it just now, it didn't show anything as mounted.  So it
148 doesn't appear to be the open command.  What else could it be??
149
150 Ideas? 
151
152 Dale
153
154 :-)  :-) 

Replies

Subject Author
Re: [gentoo-user] cryptsetup close and device in use when it is not Dale <rdalek1967@×××××.com>