jetwhiz / encfs4win

Windows port of EncFS
https://encfs.win
Other
402 stars 41 forks source link

Error "Please insert a disk into Removable Disk" on Windows 10 #28

Closed akasubi closed 8 years ago

akasubi commented 8 years ago

This is a weird one, because I get this error on a Windows 10 laptop but not in a Win10 virtual machine (in VMWare):

error

Both the laptop and the virtual machine run Win10 with the latest updates. I get the same result regardless of whether I create a new volume, or copy and existing encfs directory and try to mount it.

jetwhiz commented 8 years ago

Hi @wezeku -- I had to replace the hard drive on my computer, so it might take a few more days for me to be able to test this out. In the meantime, could you try v1.9.0-RC4 and see if the issue exists? I'm wondering if switching away from the Boost library or RLog could be causing this.

akasubi commented 8 years ago

I tried 1.9.0-RC4 (with encfsw.exe from 1.10.1-RC4) and it works without error messages. I also noticed that while 1.10.1-RC4 gives the error message, it seems to work anyway.

gh223682 commented 8 years ago

I've experienced a very similar problem if I start encfs.exe (1.10.1-RC4) early in the login process (Windows 10). The virtual drive which is created doesn't seem to get initialized properly, and only appears as a "Removable Disk" in explorer, for example X:. When I try to open that drive, I get the message

Please insert a disk into Removable Disk (X:)

I have to kill the encfs.exe process and try again, at which point the virtual drive usually gets mapped correctly.

In an offline conversation, @jetwhiz speculated that:

This might be some sort of a race condition where encfs is starting before the Dokan FUSE library is loaded.

Through some further testing, I believe that this is indeed the case.

I successfully tested two possible workarounds:

  1. Wait a little bit longer into the login process before starting encfs.exe; or
  2. Force the Dokan FUSE library to load by issuing a command like

% dokanctl.exe /d 0

So I believe that encfs.exe should incorporate something similar, i.e.:

  1. Wait for the Dokan FUSE library to load and exit with a warning after a certain timeout period; and/or
  2. Force the Dokan FUSE library to load and exit with a warning if that fails.
jetwhiz commented 8 years ago

Hi @gh223682 @wezeku

Could you test this patch out and see if it helps with the issue?

patch.txt

It essentially just adds these lines to the main function for encfs.exe:

  // Ensure we load the dokan library beforehand 
  HINSTANCE hinstLib;
#ifdef USE_LEGACY_DOKAN
  hinstLib = LoadLibrary(TEXT("dokan.dll"));
#else
  hinstLib = LoadLibrary(TEXT("dokan1.dll"));
#endif
  if (hinstLib == NULL) {
    RLOG(ERROR) << "Unable to load Dokan FUSE library";
    return EXIT_FAILURE;
  }
akasubi commented 8 years ago

In preparation for trying the patch, I uninstalled 1.9.0-RC4 and reinstalled 1.10.1-RC4. When I rebooted and ran 1.10.1-RC4 (unpatched) again, the error message no longer popped up.

I've updated a few Intel and Lenovo drivers since my first test. This shouldn't affect the problem, but it's the only config difference between my tests that I can think of.

jetwhiz commented 8 years ago

@wezeku -- did you notice if Dokan was successfully installed on the machine when it was failing?

I noticed a problem with the installer, where Dokan would silently fail to install (because dependencies were not met). This might explain why it worked when you installed 1.9.0-RC4 and then re-installed 1.10.1-RC4. This could explain your "Please insert a disk into Removable Disk" issue.

gh223682 commented 8 years ago

@jetwhiz Dokany-1.0 also does not uninstall cleanly and leaves system files laying around.

gh223682 commented 8 years ago

@jetwhiz The latest pre-1.10.1-RC5 patch seems to do the trick. No issues so far.

jetwhiz commented 8 years ago

Dokany-1.0 also does not uninstall cleanly and leaves system files laying around.

@gh223682 Is this when you try running the dokany uninstaller?

gh223682 commented 8 years ago

Is this when you try running the dokany uninstaller?

@jetwhiz Yes. I should probably report this issue on that project.

akasubi commented 8 years ago

Dokan was correctly installed when I first encountered this problem (I checked specifically, because Dokan was my prime suspect).

Since I reinstalled 1.10.1-RC4, the problem started occurring occasionally again, so I have applied the patch. So far, no problems. I'll mount an encfs drive at startup from now on, to see how it works in the long run.