Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to open an image from the mapped network drive #2858

Open
zrzka opened this issue Jul 21, 2019 · 29 comments
Open

Unable to open an image from the mapped network drive #2858

zrzka opened this issue Jul 21, 2019 · 29 comments

Comments

@zrzka
Copy link
Contributor

zrzka commented Jul 21, 2019

  • Etcher version: 1.5.51
  • Operating system and architecture: Windows 10 Home x86-64
  • Image flashed: Any
  • Environment: Windows 10 Home is executed in the VMware Fusion on a Mac
    • This is probably irrelevant, because the problem is with mapped network drives
  • Forums post: Etcher on Windows7 under VMware can only access C drive?

VMware Fusion can share folders from the host OS. It's implemented via mapped network drives.

Screenshot 2019-07-21 at 10 14 28

When I open an image from Z:\SharedWithVM\..., etcher thinks that the location is C:\SharedWithVM\... (Z -> C) and fails to open the image. Nothing interesting in logs, just ENOENT with wrong path:

Screenshot 2019-07-21 at 10 30 26

I've found an old issue with suggested workaround (comes from the Microsoft Support). I have this value already set ...

Screenshot 2019-07-21 at 10 21 11

... and it still doesn't work.

It works if the image is copied to a local drive.

@zrzka zrzka changed the title Unable to open an image from the mapped/network drive Unable to open an image from the mapped network drive Jul 21, 2019
@balena-ci
Copy link
Collaborator

[zrzka] This issue has attached support thread https://jel.ly.fish/#/support-thread~fd2d6412-7ae4-4e8b-a356-a551bc8b3f5c

@lurch
Copy link
Contributor

lurch commented Jul 21, 2019

IIRC this is because the "mapped drive letter" is only visible to user-level processes, and isn't visible to admin-level processes.
The Etcher file-selector GUI runs at a user-level (and so the mapped drive is visible), but Etcher needs to switch to an admin-level process to have enough permissions to write raw disk images (and so the mapped drive "disappears"). The drive letter switching from Z:\ to C:\ looks very strange though! 😕

Slightly-related discussion in #1436

@zrzka
Copy link
Contributor Author

zrzka commented Jul 22, 2019

@lurch that makes sense, but this error appears immediately after the image selection. I mean, target device not selected yet, didn't click on the Flash button, just launched Etcher and selected an image. AFAIK elevated privileges are required when I click on the Flash button.

@lurch
Copy link
Contributor

lurch commented Jul 22, 2019

Maybe there's something going wrong with https://github.com/balena-io/etcher/blob/master/lib/gui/app/os/windows-network-drives.js#L87 🤷‍♂️

@zvin
Copy link
Contributor

zvin commented Jul 22, 2019

@zrzka can you please try this command and paste the output here?

C:\Windows\System32\Wbem\wmic path Win32_LogicalDisk Where DriveType="4" get DeviceId,ProviderName

@zrzka
Copy link
Contributor Author

zrzka commented Jul 22, 2019

@zvin here's the output ...

C:\Users\Robert Vojta>C:\Windows\System32\Wbem\wmic path Win32_LogicalDisk Where DriveType="4" get DeviceId,ProviderName
DeviceID  ProviderName
Z:


C:\Users\Robert Vojta>

... let me know if there's anything else I can do.

@zvin
Copy link
Contributor

zvin commented Jul 22, 2019

@zrzka interesting, the second column should have the share address: something like \\<ip address>\folder.

What is the output of
C:\Windows\System32\Wbem\wmic path Win32_LogicalDisk Where DriveType="4"

@zrzka
Copy link
Contributor Author

zrzka commented Jul 22, 2019

@zvin

C:\Users\Robert Vojta>C:\Windows\System32\Wbem\wmic path Win32_LogicalDisk Where DriveType="4"
Access  Availability  BlockSize  Caption  Compressed  ConfigManagerErrorCode  ConfigManagerUserConfig  CreationClassName  Description         DeviceID  DriveType  ErrorCleared  ErrorDescription  ErrorMethodology  FileSystem  FreeSpace    InstallDate  LastErrorCode  MaximumComponentLength  MediaType  Name  NumberOfBlocks  PNPDeviceID  PowerManagementCapabilities  PowerManagementSupported  ProviderName  Purpose  QuotasDisabled  QuotasIncomplete  QuotasRebuilding  Size          Status  StatusInfo  SupportsDiskQuotas  SupportsFileBasedCompression  SystemCreationClassName  SystemName       VolumeDirty  VolumeName      VolumeSerialNumber
0                                Z:       FALSE                                                        Win32_LogicalDisk  Network Connection  Z:        4                                                            HGFS        51547848704                              255                     0          Z:                                                                                                                                                                   250685575168                      FALSE               FALSE                         Win32_ComputerSystem     DESKTOP-QPANH16               Shared Folders  00000064


C:\Users\Robert Vojta>

@zrzka
Copy link
Contributor Author

zrzka commented Jul 22, 2019

@zvin there's no share address, because it's VMware Fusion feature. One has to install VMware Tools (aka drivers for Windows) to make it working. Then the Fusion shares folders via these drivers. Not a typical network drive. Thus it will be always missing.

I tried other programs and I can easily read / write files from / to these locations.

@zvin
Copy link
Contributor

zvin commented Jul 22, 2019

I have a fix, but I can't push to GH right now. I'll ping you as soon as I have a version to test.

@zvin
Copy link
Contributor

zvin commented Jul 22, 2019

@zrzka
Copy link
Contributor Author

zrzka commented Jul 23, 2019

@zvin do I need any special permissions or ... because I've got 404 when clicking on the link.

@zvin
Copy link
Contributor

zvin commented Jul 23, 2019

@zrzka
Copy link
Contributor Author

zrzka commented Jul 23, 2019

@zvin I can select my image, so, the issue seems to be fixed. But another issue appears when I hit the Flash button:

{  
   "stack":"Error: ENOENT: no such file or directory, open 'Z:\\SharedWithVM\\subfolder\\balena-cloud-rpi3b-test-raspberrypi3-2.38.0+rev1-dev-v9.15.7.img.zip'",
   "message":"ENOENT: no such file or directory, open 'Z:\\SharedWithVM\\subfolder\\balena-cloud-rpi3b-test-raspberrypi3-2.38.0+rev1-dev-v9.15.7.img.zip'",
   "name":"Error",
   "code":"ENOENT",
   "syscall":"open",
   "errno":-4058,
   "image":"balena-cloud-rpi3b-test-raspberrypi3-2.38.0+rev1-dev-v9.15.7.img.zip"
}

@zvin
Copy link
Contributor

zvin commented Jul 23, 2019

I was kind of expecting this.
Windows network drives are mounted by user so the administrator does not see Z: if it was "mounted" by another user.
That's why this logic of replacing drive letters with the real address exists.
There is nothing we can do in the short term about this.
The correct fix would be to read the image from the user process and stream it to the writer process through some ipc.

@lurch
Copy link
Contributor

lurch commented Jul 23, 2019

@zvin is the ProviderName being empty (and so being unable to get the underlying network share) an "unusual situation"? Maybe it'd be worth displaying an error message specifically about that, rather than falling through to the ENOENT error? 🤷‍♂️

@zvin
Copy link
Contributor

zvin commented Jul 23, 2019

@lurch we don't know if the read will fail in the writer process at this point.

@zrzka
Copy link
Contributor Author

zrzka commented Jul 24, 2019

@zvin that was expected. Anyway, thanks for investing time to into this. I consider this as an edge case. I mean, why should I use balenaEtcher on Windows, running in VMware Fusion on a macOS when I can use balenaEtcher for macOS directly.

Re warning / better error message - we know it, no? Something like ...

let network_drives = get_network_drives();
let image_drive = get_drive_from_image_path(image_path);
if let Some(image_network_drive) = network_drives.get(image_drive) {
    if image_network_drive.get_provider_name().is_empty() {
        // show warning, this is gonna fail, because admin can't see mounted
        // network drives and we can't remap it to the \\$IP\... drive
        return; // aka do not continue
    } else {
        // here we can continue, because it's a network drive, we can try to read it
        // in the elevated process via \\$IP\...
    }
} else {
    // here we can continue as well, because it's not a network drive
}

... I may be wrong, just thinking aloud about this.

@lurch
Copy link
Contributor

lurch commented Jul 24, 2019

Re warning / better error message - we know it, no? Something like ...

That's exactly what I was suggesting 😉

@zvin
Copy link
Contributor

zvin commented Jul 24, 2019

You can't be sure the writer process won't be able to read your image from here.

@imrehg
Copy link
Contributor

imrehg commented Aug 14, 2019

Hitting issues like this with sshfs mounted folder, just like in #1436

@dfloer
Copy link

dfloer commented Feb 20, 2021

Sorry to bump a 1.5 year old issue, but I'm also hitting this problem. My workaround has been to map the image using the \\share\image.iso rather than X:\image.iso.

However, suggesting people use Etcher for writing image files to SD cards for use in RPis, and some of our users don't read the warning on our instructions page about this behaviour.

If it's possible, an error message indicating the inability to see a mapped network drive would be a tremendous help troubleshooting write issues, as this is the most common issue I'm seeing with our users.

@jellyfish-bot
Copy link

[zwhitchcox] This issue has attached support thread https://jel.ly.fish/a5c6201a-392f-4096-8d85-b0b7cbcc4807

@Ezelmannen
Copy link

Ezelmannen commented Aug 22, 2022

However, suggesting people use Etcher for writing image files to SD cards for use in RPis, and some of our users don't read the warning on our instructions page about this behaviour.

Sorry, but where is this instruction page where this is mentioned? Link? I see no link to any instructions on https://www.balena.io/etcher/, but maybe I'm missing something.
As you say: A lot of users (me included) just read some Raspberry Pi guide and never really see any instructions or warnings.

If it's possible, an error message indicating the inability to see a mapped network drive would be a tremendous help troubleshooting write issues, as this is the most common issue I'm seeing with our users.

This would be a very nice addition until the 'real problem' has a solution.
The current message just talks about "the drive" and given how most users just recently plugged in their SD-card, and their network share is very stable, this gives the vibe that there is something wrong with the SD-card part of the equation. (Which is probably working fine).
If it at least gave the Drive-letter (C: D: F: Z: whatever) of the drive it couldn't access that would be helpful. Also, a mention like "Are you trying to read your image from a Windows network share, then we are sorry: That is not possible at the moment".

And if this is really one of the most common errors people stumble on, then it is quite strange not even changing the error message has been fixed in the 3 years since it's been reported.

@cool2bdave
Copy link

cool2bdave commented Oct 6, 2022

I believe that we have the same issue with 1.7.9

Flashing sdcard.img.xz from a mapped network drive on Win10/Win11 causes "Attention Looks like Etcher lost access to the drive. Did it get unplugged"
Changing to the UNC path works as expected.
E.g.
Z:\b\sdcard.img.xz will fail
\a\b\sdcard.img.xz works

@nexryai
Copy link

nexryai commented May 21, 2023

Same here on Windows10 ver 1.18.4

@wolrah
Copy link

wolrah commented Jun 7, 2023

Just ran in to this same behavior on Windows 11 with version 1.18.4 with the error pointing at the USB drive being the problem when really it was the image being on a network drive. I was able to successfully load the same image over SMB from my Mac, then after discovering one of the other bug reports that led here I was able to also load the same image to the same USB drive after copying the image to a local disk.

If this can't be easily fixed I strongly agree that at least fixing the error to tell the actual problem rather than sending users on a wild goose chase with their media would be very useful.

@MottW
Copy link

MottW commented Aug 30, 2023

I was able to add the file. WORKAROUND/

Please try and let me know if that works out for you.

Copy the file to your desktop and select the file straight from the desktop. Simple as that.

@RzNmKX
Copy link

RzNmKX commented Sep 28, 2023

I was able to add the file. WORKAROUND/

Please try and let me know if that works out for you.

Copy the file to your desktop and select the file straight from the desktop. Simple as that.

Really? this is not a valid workaround. there is a reason we have the .iso/.whatever on a network drive. it makes 0 sense to need to transfer (for example) a 6GB windows server iso to my desktop just to flash it. it should be able to read from the network share.

example iso directory on NAS:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests