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, 28 Jun 2021 03:36:00
Message-Id: 6ecbf2d6-2c6f-3f66-5eee-f4766d5e5254@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 >>>> Dale wrote:
6 >>>>> Jack wrote:
7 >>>>>> Is it possible it was still syncing cache out to the physical drive? 
8 >>>>>> I wonder if iotop would show any activity for that drive if that's the
9 >>>>>> case?
10 >>>>>>
11 >>>>>> Jack
12 >>>>>>
13 >>>>>>
14 >>>>>>
15 >>>>> I may try that next time but the light had stopped blinking for several
16 >>>>> minutes.  Since it is a SMR drive, I always leave it running until I
17 >>>>> can't feel the heads bumping around.  I don't think it would be that
18 >>>>> but, it's worth a try. It may lead to something. 
19 >>>>>
20 >>>>> Will update when it does it again. 
21 >>>>>
22 >>>>> Thanks.
23 >>>>>
24 >>>>> Dale
25 >>>>>
26 >>>>> :-)  :-) 
27 >>>>>
28 >>>> I had to wait until I was doing backups again to try anything.  The 6TB
29 >>>> drive did fine.  The 8TB drive is giving the in use error.  The drive is
30 >>>> unmounted but iotop didn't show anything and the light isn't blinking
31 >>>> either.  I'd think if it was flushing cache the light would flash and it
32 >>>> would not umount. 
33 >>>>
34 >>>> I tried the udev-trigger trick but it didn't work.  I don't know how
35 >>>> long it will stay 'in use' so if anyone has ideas, think and type fast. 
36 >>>> If not, may have to wait until next time to try again.
37 >>>>
38 >>>> Dale
39 >>>>
40 >>>> :-)  :-) 
41 >>>>
42 >>> Some more info:
43 >>>
44 >>>
45 >>> root@fireball / # lvs
46 >>>   LV     VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log
47 >>> Cpy%Sync Convert
48 >>>   Home2  Home2  -wi-ao----
49 >>> <12.74t                                                   
50 >>>   swap   OS     -wi-ao---- 
51 >>> 12.00g                                                   
52 >>>   usr    OS     -wi-ao---- 
53 >>> 35.00g                                                   
54 >>>   var    OS     -wi-ao---- 
55 >>> 52.00g                                                   
56 >>>   backup backup -wi-ao----
57 >>> 698.63g                                                   
58 >>> root@fireball / # vgs
59 >>>   VG     #PV #LV #SN Attr   VSize    VFree 
60 >>>   Home2    2   1   0 wz--n-  <12.74t      0
61 >>>   OS       1   3   0 wz--n- <124.46g <25.46g
62 >>>   backup   1   1   0 wz--n-  698.63g      0
63 >>> root@fireball / # pvs
64 >>>   PV         VG     Fmt  Attr PSize    PFree 
65 >>>   /dev/sda7  OS     lvm2 a--  <124.46g <25.46g
66 >>>   /dev/sdb1  Home2  lvm2 a--    <5.46t      0
67 >>>   /dev/sdc1  Home2  lvm2 a--    <7.28t      0
68 >>>   /dev/sdd1  backup lvm2 a--   698.63g      0
69 >>> root@fireball / # cryptsetup close 8tb
70 >>> Device 8tb is still in use.
71 >>> root@fireball / #
72 >>>
73 >>>
74 >>> As you can see, lvm doesn't even show the device but it is still under
75 >>> /dev as tho it is available.  Weird. 
76 >>>
77 >>> I found this but at the end, the command doesn't help me.  I'm not sure
78 >>> why.  It does talk about using LUKS on top of LVM causing this problem. 
79 >>> Since the fix doesn't work, is this a different problem??
80 >>>
81 >>>
82 >>> https://linux-blog.anracom.com/tag/device-still-in-use/
83 >>>
84 >>>
85 >>> I've tried every command I can find and it still shows busy.  I even
86 >>> restarted udev and lvm.  Still busy. 
87 >>>
88 >>> Ideas?
89 >>>
90 >>> Dale
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 > After staring at it a while, it hit me that lsblk is showing it as still
136 > mounted, even tho I umounted already without error.  So, I just ran the
137 > umount command again.  After that, it closed just fine.  So, it seems to
138 > be mounted twice, not once.  I mount using this command 'mount /mnt/8tb'
139 > which uses fstab to mount the correct UUID device to that mount point. 
140 > Surely it only mounts once.  Always has in the past.  So why is it being
141 > mounted twice now?  None of my scripts used for backups includes any
142 > mounting commands.  There's also only one entry in fstab as well. 
143 >
144 > Anyone have any idea while it gets mounted twice?  Does the cryptsetup
145 > open command mount it in some way and then I mount it manually as well??
146 > When I opened it just now, it didn't show anything as mounted.  So it
147 > doesn't appear to be the open command.  What else could it be??
148 >
149 > Ideas? 
150 >
151 > Dale
152 >
153 > :-)  :-) 
154 >
155
156
157 The same drive just did it again.  I had to reboot to get it to reset. 
158 This is Linux not windoze.  Rebooting to reset something like that is
159 plain ridiculous.  I also checked, this time it was mounted only once. 
160 When I tried to umount it again, it said it wasn't mounted.  The thing
161 that really gets me, nothing can tell me what it is that is using the
162 device.  It says it is in use but no clue what it is using it. 
163
164 To test a theory, I changed fstab to mount by label instead of UUID. 
165 Maybe that will change something.  I dunno.  I do know, if this doesn't
166 improve soon, I'm going to erase the drive and either find another
167 encryption tool or just not encrypt it at all.  I'm not rebooting every
168 time this thing wants to act ugly.  I'm used to rebooting like every 6
169 months or so.  Usually when the power fails. 
170
171 If anyone has any ideas, please post.  In the meantime, I'm going to try
172 this mounting by label idea. 
173
174 Dale
175
176 :-)  :-)

Replies

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