Bug 453254 - explorer blocks dismounting of an encrypted volume where the *.kmy-file was saved
Summary: explorer blocks dismounting of an encrypted volume where the *.kmy-file was s...
Status: RESOLVED UPSTREAM
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 5.0.6
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-01 06:56 UTC by Paul
Modified: 2022-05-06 18:35 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
active processes and remaining files (37.08 KB, image/jpeg)
2022-05-01 06:56 UTC, Paul
Details
background processes started by kmymoney (36.91 KB, image/png)
2022-05-02 07:36 UTC, Ralf Habacker
Details
kmymoney-downloaded-version.JPG (104.78 KB, image/jpeg)
2022-05-03 06:37 UTC, Paul
Details
kmymoney-avast-version.JPG (18.87 KB, image/jpeg)
2022-05-03 06:37 UTC, Paul
Details
kmymoney-virus-warning_1.JPG (17.46 KB, image/jpeg)
2022-05-03 06:37 UTC, Paul
Details
kmymoney-virus-warning_2.JPG (29.44 KB, image/jpeg)
2022-05-03 06:37 UTC, Paul
Details
attachment-13375-0.html (2.83 KB, text/html)
2022-05-03 06:44 UTC, Paul
Details
attachment-30000-0.html (3.28 KB, text/html)
2022-05-03 10:25 UTC, Paul
Details
attachment-13474-0.html (2.22 KB, text/html)
2022-05-04 06:44 UTC, Paul
Details
kmymoney_unforced_dismount_impossible.JPG (36.51 KB, image/jpeg)
2022-05-04 11:57 UTC, Paul
Details
kmymoney-still_active_parts.JPG (13.89 KB, image/jpeg)
2022-05-04 11:57 UTC, Paul
Details
kmymoney-version-downloaded.JPG (88.89 KB, image/jpeg)
2022-05-04 16:31 UTC, Paul
Details
kmymoney-active_processes_after_closing_kmymoney.JPG (91.31 KB, image/jpeg)
2022-05-04 16:31 UTC, Paul
Details
screenshot showing explorer blocking veracrypt unmount (217.95 KB, image/png)
2022-05-06 07:01 UTC, Ralf Habacker
Details
attachment-5948-0.html (1.95 KB, text/html)
2022-05-06 18:35 UTC, Paul
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul 2022-05-01 06:56:59 UTC
Created attachment 148487 [details]
active processes and remaining files

SUMMARY
***
KMyMoney is not closed completely and blocks dismounting of an encrypted volume where the *.kmy-file was saved.
***

STEPS TO REPRODUCE
1. open/mount an encrypted volume/drive with VERACRYPT
2. open a *.kmy-file stored in the encrypted volume with KMyMoney 
3. do some changes in *.kmy-file
4. save *.kmy-file
5. exit KMyMoney with a click on "X"
6. wait a couple of minutes
7. dismount volume in VERACRYPT

OBSERVED RESULT

volume can not be dismounted "because files are in use  by another program"; unless a "forced dismount" is done

EXPECTED RESULT

- volume should be dismounted

SOFTWARE/OS VERSIONS
Windows:  10
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION

Following processes of KMyMoney are still active after closing KMyMoney:
-kioslave5.exe
-klauncher5.exe
It seems to me, that one or both of these process block the *.kmy-file and prevent dismounting of the VERACRYT-volume.
After forced dismounting, a *.kmy.n~ remains in the encrypted volume (see attachment)
Comment 1 Ralf Habacker 2022-05-02 07:36:42 UTC
Created attachment 148509 [details]
background processes started by kmymoney

You should check this again with a newer kmymoney version from https://kmymoney.org/snapshots.php.

After starting kmymoney, the background processes mentioned in the screenshot are started. After quitting kmymoney, kwinshutdown5 shuts down all remaining KDE background processes after a few seconds.
Comment 2 Stephen Leibowitz 2022-05-02 12:52:44 UTC
I agree that you should try a newer version of KMyMoney. I remember using 5.0.6 from a thumb drive. The three processes Paul mentioned were still active after I exited the program. The system would not say that it was safe to eject the thumb drive with them active. I had two options. I could start Task Manager and manually end the processes. I could also use the Windows TaskKill command. I gave a fuller discussion of the problem at https://forum.kde.org/viewtopic.php?f=69&t=165131
Comment 3 Paul 2022-05-03 06:37:19 UTC
Created attachment 148522 [details]
kmymoney-downloaded-version.JPG

Hi Ralf and Stephen

Thanks a lot for you prompt reply.

I downloaded and installed a new version from your link (see attachment).

However my antivirus AVAST blocks execution of this version completely 
(even when adding exceptions). I had to uninstall it and reinstalled 
version 5.0.6.

So I was unable to check if it would work with the newer version, sorry.

Following the links on KMyMoney-homepage one gets the version 5.0.6

  * _https://kmymoney.org/_
  * _https://kmymoney.org/download.html_
  * An installation package for an older stable release can be found on
    our _download server
    <https://download.kde.org/stable/kmymoney/5.0.6/>_. =>
    _https://download.kde.org/stable/kmymoney/5.0.6/_

Thanks anyway for you help.

Kind regards
Paul
Comment 4 Paul 2022-05-03 06:37:20 UTC
Created attachment 148523 [details]
kmymoney-avast-version.JPG
Comment 5 Paul 2022-05-03 06:37:20 UTC
Created attachment 148524 [details]
kmymoney-virus-warning_1.JPG
Comment 6 Paul 2022-05-03 06:37:20 UTC
Created attachment 148525 [details]
kmymoney-virus-warning_2.JPG
Comment 7 Paul 2022-05-03 06:44:03 UTC
Created attachment 148526 [details]
attachment-13375-0.html

Hi again

After sending the email below, I opened my *.kmy-file with the 
reinstalled version 5.0.6., made some changes, saved changes and closed 
KMyMoney. Then I waited approx. 5 seconds and dismounted the encrypted 
drive and astonishly I worked without any problem and did not ask me 
whether I want to do a "forced dismounting".

No idea why!

Kind regards
Paul

Am 03.05.2022 um 08:37 schrieb P. Furrer:
> Hi Ralf and Stephen
>
> Thanks a lot for you prompt reply.
>
> I downloaded and installed a new version from your link (see attachment).
>
> However my antivirus AVAST blocks execution of this version completely 
> (even when adding exceptions). I had to uninstall it and reinstalled 
> version 5.0.6.
>
> So I was unable to check if it would work with the newer version, sorry.
>
> Following the links on KMyMoney-homepage one gets the version 5.0.6
>
>   * _https://kmymoney.org/_
>   * _https://kmymoney.org/download.html_
>   * An installation package for an older stable release can be found
>     on our _download server
>     <https://download.kde.org/stable/kmymoney/5.0.6/>_. =>
>     _https://download.kde.org/stable/kmymoney/5.0.6/_
>
> Thanks anyway for you help.
>
> Kind regards
> Paul
Comment 8 Ralf Habacker 2022-05-03 09:37:01 UTC
(In reply to Paul from comment #7)

> > I downloaded and installed a new version from your link (see attachment).
you are using the 64bit variant 

> > However my antivirus AVAST blocks execution of this version completely 
> > (even when adding exceptions). I had to uninstall it and reinstalled 
> > version 5.0.6.

I checked the mentioned file dbus-daemon.exe from the 64bit installation at virustotal https://www.virustotal.com/gui/file/ce3e0f4e7b769d10740e17830b741a9afbbee0818d130e95af1af6121e372b48?nocache=1, which did not confirm that virus.
Comment 9 Ralf Habacker 2022-05-03 09:39:51 UTC
(In reply to Paul from comment #7)
> Created attachment 148526 [details]
> attachment-13375-0.html
> 
> Hi again
> 
> After sending the email below, I opened my *.kmy-file with the 
> reinstalled version 5.0.6., made some changes, saved changes and closed 
> KMyMoney. Then I waited approx. 5 seconds and dismounted the encrypted 
> drive and astonishly I worked without any problem and did not ask me 
> whether I want to do a "forced dismounting".
> 
> No idea why!

This should be the normal behavior as on starting kmymoney the watchdog named kwinshutdown.exe is started and terminates any background processes 5 seconds after kmymoney has been closed (see share/autostart/kwinshutdown.desktop).
Comment 10 Paul 2022-05-03 10:25:59 UTC
Created attachment 148532 [details]
attachment-30000-0.html

Hi Ralf

Thanks a lot for your help. Sorry, but I can't follow...... No idea what 
"variant" means.

Which link should I use for downloading the version for Win 10 64-bit?

Anyway, for whatever reason, it now works fine for me with version 5.0.6.

Do I have to close the "bug-report" or do you do that?

Have a good day and kind regards
Paul


-------- Weitergeleitete Nachricht --------
Betreff: 	[kmymoney] [Bug 453254] KMyMoney is not closed completely and 
blocks dismounting of an encrypted volume where the *.kmy-file was saved.
Datum: 	Tue, 03 May 2022 09:37:01 +0000
Von: 	Ralf Habacker <bugzilla_noreply@kde.org>
Antwort an: 	
An: 	zy.wpnir@sunrise.ch



https://bugs.kde.org/show_bug.cgi?id=453254

--- Comment #8 from Ralf Habacker <ralf.habacker@freenet.de> ---
(In reply to Paul from comment #7)

> > I downloaded and installed a new version from your link (see 
> attachment).
you are using the 64bit variant
> > However my antivirus AVAST blocks execution of this version 
> completely > (even when adding exceptions). I had to uninstall it and 
> reinstalled > version 5.0.6.

I checked the mentioned file dbus-daemon.exe from the 64bit installation at
virustotal
https://www.virustotal.com/gui/file/ce3e0f4e7b769d10740e17830b741a9afbbee0818d130e95af1af6121e372b48?nocache=1,
which did not confirm that virus.
Comment 11 Ralf Habacker 2022-05-03 11:58:00 UTC
(In reply to Paul from comment #10)

> Sorry, but I can't follow...... No idea what "variant" means.

This refers to the architecture variant. From the mentioned snapshot page you can download binary packages for 32bit and 64bit architectures.

> Which link should I use for downloading the version for Win 10 64-bit?

On a 64-bit system, you can use 32-bit and 64-bit binaries. 32-bit binaries are slightly smaller (unpacked 360 MB compared to 390 MB for 64-bit) and run slightly faster.
Comment 12 Paul 2022-05-04 06:44:12 UTC
Created attachment 148548 [details]
attachment-13474-0.html

Hi Stephen

Thanks for your email. For me the case is settled.

I am not sure whether there was a misunderstanding.

Just to clarify (if necessary):

  * KMyMoney was normally installed on the computer (not on a thumb drive)
  * Only the *.kmy-file is stored on an encrypted VERAcrypt-volume


Have a good day and take care everybody!

Thanks for your efficient handling of my bug-report!!

Kind regards
Paul

Am 02.05.2022 um 14:52 schrieb Stephen Leibowitz:
> https://bugs.kde.org/show_bug.cgi?id=453254
>
> Stephen Leibowitz<LibreStephen@gmail.com>  changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |LibreStephen@gmail.com
>
> --- Comment #2 from Stephen Leibowitz<LibreStephen@gmail.com>  ---
> I agree that you should try a newer version of KMyMoney. I remember using 5.0.6
> from a thumb drive. The three processes Paul mentioned were still active after
> I exited the program. The system would not say that it was safe to eject the
> thumb drive with them active. I had two options. I could start Task Manager and
> manually end the processes. I could also use the Windows TaskKill command. I
> gave a fuller discussion of the problem at
> https://forum.kde.org/viewtopic.php?f=69&t=165131
>
Comment 13 Paul 2022-05-04 11:57:03 UTC
Created attachment 148556 [details]
kmymoney_unforced_dismount_impossible.JPG

Hi Ralf

Today, it does not work anymore (enclosures).

I will do forced dismounting in VERAcrypt and it's OK for me.

Kind regards
Paul

Am 03.05.2022 um 11:39 schrieb Ralf Habacker:
> https://bugs.kde.org/show_bug.cgi?id=453254
>
> --- Comment #9 from Ralf Habacker <ralf.habacker@freenet.de> ---
> (In reply to Paul from comment #7)
>> Created attachment 148526 [details]
>> attachment-13375-0.html
>>
>> Hi again
>>
>> After sending the email below, I opened my *.kmy-file with the
>> reinstalled version 5.0.6., made some changes, saved changes and closed
>> KMyMoney. Then I waited approx. 5 seconds and dismounted the encrypted
>> drive and astonishly I worked without any problem and did not ask me
>> whether I want to do a "forced dismounting".
>>
>> No idea why!
> This should be the normal behavior as on starting kmymoney the watchdog named
> kwinshutdown.exe is started and terminates any background processes 5 seconds
> after kmymoney has been closed (see share/autostart/kwinshutdown.desktop).
>
Comment 14 Paul 2022-05-04 11:57:04 UTC
Created attachment 148557 [details]
kmymoney-still_active_parts.JPG
Comment 15 Ralf Habacker 2022-05-04 12:56:49 UTC
(In reply to Paul from comment #14)
> Created attachment 148557 [Details] [details]
> kmymoney-still_active_parts.JPG

It turns out that kwinshutdown*.exe is not included in version 5.0.6, so these processes are not killed after 5 seconds by default. Since this tool is included in the current snapshot, you need to download a newer snapshot from https://kmymoney.org/snapshots.php to fix this issue.

Using kmymoney 5.0.6 and procexp (https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer), I verified that the running kmymoney.exe and all background processes involved do not have an open file handle to the kmymoney file in use, even if it is stored in a local Veracrypt container.

Therefore, the remaining reason for the reported problem could be that kmymoney was started from a path inside the Veracrypt container and the leftover processes are blocking unmounting. Or another program like explorer could be blocking the unmount. 

You can find this out with procexp and the menu item Find->"Find Handle or DLL" by entering the drive letter e.g. "a:\".

If the problem is kmymoney or a involved background process, only a newer snapshot will help.
Comment 16 Stephen Leibowitz 2022-05-04 14:30:32 UTC
If Paul wants to stay with 5.0.6, then he could try the Taskkill command to end the three processes. Hopefully, that would release any locks they have on the file, the folder, and the VeraCrypt volume. Paul might get further insight into the problem by running OpenedFilesView, which is available at https://www.nirsoft.net/utils/opened_files_view.html

Documentation on Taskkill is at https://www.computerhope.com/taskkill.htm

Here is a sample batch file. He may need to edit the start command to point to the folder with kmymoney.exe:

start "KMyMoney" /Wait bin\kmymoney.exe
taskkill /im dbus-daemon.exe /f /t
taskkill /im kioslave5.exe /f /t
taskkill /im klauncher5.exe /f /t
Comment 17 Paul 2022-05-04 16:31:19 UTC
Created attachment 148560 [details]
kmymoney-version-downloaded.JPG

Hi Ralf and Stephen

Thanks a again.

Ralf seems to have had the right idea! Dismounting is only blocked when 
opening kmymoney via double click on the *.kmy-file on the encrypted file!
quote

Therefore, the remaining reason for the reported problem could be/*that kmymoney was started from a path inside the Veracrypt container*/  and the leftover
processes are blocking unmounting. Or another program like explorer could be
blocking the unmount.

unquote

However, there seems to be another bug in the program when opening 
kmymoney via start menu without having previously mounted the 
VERYcrypt-drive; see below SECOND and THIRD way

What did I do:

  * downloaded 64 bit-version 5.1.2 from your snapshot-link
  * extracted all files and copied them to the installation directory
    where 5.0.6 was installed (I renamed all 5.0.6-directories first!)
  * AVAST did not block anything; I previously added an exception to the
    installation directory of 5.0.6 (now 5.1.2) in AVAST


*FIRST way*

  * started kmymoney with your start.bat-file
  * my *.kmy-file on the previously mounted VERAcrypt-drive opened correctly
  * made some changes in the *.kmy-file and saved it
  * exited kmymoney
  * after 5-6 seconds dismounted the VERAcrypt-drive
  * result: it dismounts immediately as expected
  * shutdown the computer


*SECOND way*

  * restarted the computer
  * mounted the VERAcrypt-drive
  * doubleclicked the *.kmy-file
  * made some changed in the *.kmy-file and saved it
  * after 3 minutes dismounted the VERYcrypt-drive
  * result: error message as before, i.e. only a forced dismount is possible
  * forced dismounting of the VERYcrypt-drive
  * *after 10 minutes I opened kmymoney via the start menu without
    previously mounting the VERYcrypt-drive*
  * *result: kmymoney does not open; it hangs somewere; it's freezed*
  * shutdown the computer


*THIRD way*

  * restarted the computer
  * mounted the VERAcrypt-drive
  * started kmymoney via the start menu
  * my *.kmy-file on the previously mounted VERAcrypt-drive opened correctly
  * made some changes in the *.kmy-file and saved it
  * exited kmymoney
  * after 5-6 seconds dismounted the VERAcrypt-drive
  * result: it dismounts immediately as expected
  * *after a few minutes I opened kmymoney via the start menu againΒ 
    without previously mounting the VERYcrypt-drive*
  * *result: ***kmymoney *does not open; it hangs somewere; it's freezed*


After closing kmymoney I checked via Task Manager what program-parts are 
still active. In all three ways the same parts where still active (see 
enclosure).

So the solution for me is either way 1 or way 3 πŸ˜‰

Hope the above helps to find the possible bug(s).

Kind regards
Paul

NB: I am just programming in Visual Basic 6 starting with BASICA in the 
year 1984πŸ˜‚; so my process-knowledge is not as deep as yours, sorry.



Am 04.05.2022 um 14:56 schrieb Ralf Habacker:
> https://bugs.kde.org/show_bug.cgi?id=453254
>
> --- Comment #15 from Ralf Habacker<ralf.habacker@freenet.de>  ---
> (In reply to Paul from comment #14)
>> Created attachment 148557 [Details] [details]
>> kmymoney-still_active_parts.JPG
> It turns out that kwinshutdown*.exe is not included in version 5.0.6, so these
> processes are not killed after 5 seconds by default. Since this tool is
> included in the current snapshot, you need to download a newer snapshot from
> https://kmymoney.org/snapshots.php  to fix this issue.
>
> Using kmymoney 5.0.6 and procexp
> (https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer), I
> verified that the running kmymoney.exe and all background processes involved do
> not have an open file handle to the kmymoney file in use, even if it is stored
> in a local Veracrypt container.
>
> Therefore, the remaining reason for the reported problem could be that kmymoney
> was started from a path inside the Veracrypt container and the leftover
> processes are blocking unmounting. Or another program like explorer could be
> blocking the unmount.
>
> You can find this out with procexp and the menu item Find->"Find Handle or DLL"
> by entering the drive letter e.g. "a:\".
>
> If the problem is kmymoney or a involved background process, only a newer
> snapshot will help.
>
Comment 18 Paul 2022-05-04 16:31:20 UTC
Created attachment 148561 [details]
kmymoney-active_processes_after_closing_kmymoney.JPG
Comment 19 Ralf Habacker 2022-05-06 07:01:11 UTC
Created attachment 148601 [details]
screenshot showing explorer blocking veracrypt unmount

(In reply to Paul from comment #17)

> *SECOND way*
...
>  * doubleclicked the *.kmy-file

That means you entered that directory with explorer, which *BLOCKS* the unmount, not kmymoney. 

I can reproduce this issue by

* restarted the computer
 * mount the VERAcrypt-drive
 * enter veracrypt container with explorer
 * dismounted the VERAcrypt-drive
* result: error message, i.e. only a forced dismount is possible

> Hope the above helps to find the possible bug(s).

This bug is really not kmymoney related, it is a Microsoft explorer bug

A workaround is to not use or uninstall the kmymoney installer to avoid associating the *.kmy file type with the kmymoney executable.
Comment 20 Ralf Habacker 2022-05-06 07:03:52 UTC
> This bug is really not kmymoney related, it is a Microsoft explorer bug

So, this error must be fixed by Microsoft. You can report it there.
Comment 21 Ralf Habacker 2022-05-06 07:09:48 UTC
> That means you entered that directory with explorer, which *BLOCKS* the unmount, not kmymoney. 

Even changing the directory pointed to by Explorer does not release the open directory. It is necessary to close the Explorer instance in question.
Comment 22 Paul 2022-05-06 18:35:35 UTC
Created attachment 148613 [details]
attachment-5948-0.html

Thanks a lot Ralf for your help, patience and feedbacks!

Take care!

Kind regards
Paul 


Am 6. Mai 2022 09:01:11 MESZ schrieb Ralf Habacker <bugzilla_noreply@kde.org>:
>https://bugs.kde.org/show_bug.cgi?id=453254
>
>--- Comment #19 from Ralf Habacker <ralf.habacker@freenet.de> ---
>Created attachment 148601 [details]
>  --> https://bugs.kde.org/attachment.cgi?id=148601&action=edit
>screenshot showing explorer blocking veracrypt unmount
>
>(In reply to Paul from comment #17)
>
>> *SECOND way*
>...
>>  * doubleclicked the *.kmy-file
>
>That means you entered that directory with explorer, which *BLOCKS* the
>unmount, not kmymoney. 
>
>I can reproduce this issue by
>
>* restarted the computer
> * mount the VERAcrypt-drive
> * enter veracrypt container with explorer
> * dismounted the VERAcrypt-drive
>* result: error message, i.e. only a forced dismount is possible
>
>> Hope the above helps to find the possible bug(s).
>
>This bug is really not kmymoney related, it is a Microsoft explorer bug
>
>A workaround is to not use or uninstall the kmymoney installer to avoid
>associating the *.kmy file type with the kmymoney executable.
>
>-- 
>You are receiving this mail because:
>You are on the CC list for the bug.
>You reported the bug.