nanobox icon indicating copy to clipboard operation
nanobox copied to clipboard

Document extra requirements for netfs on windows

Open glinton opened this issue 7 years ago • 16 comments

[nanobox config] Using netfs on windows doesn't always work right out of the box. We should either suggest native or explain the steps to enable cifs so netfs will work.

glinton avatar Jun 12 '17 21:06 glinton

Need more information on how the cifs might fail and more testing to reproduce.

lyondhill avatar Jun 16 '17 19:06 lyondhill

I'm on Windows 10, I had exactly the same issue and same outputs as that one on Slack: https://nanoboxio.slack.com/archives/C2EUZNV2T/p1499091327993469. It was keep failing the Mounting codebase. The output for the nanobox config ls was this one:

{
  "provider": "docker-machine",
  "ci-mode": false,
  "mount-type": "netfs",
  "netfs-mount-opts": "mfsymlinks",
  "cpus": 2,
  "ram": 2,
  "disk": 102400,
  "external-network-space": "192.168.99.50/24",
  "docker-machine-network-space": "172.21.0.1/16",
  "native-network-space": "172.20.0.1/16",
  "ssh-key": "default",
  "anonymous": false,
  "lock-port": 12345
}

Then @glinton asked me to do the following command: nanobox config set mount-type native. And it's working fine now, which means the mount type was not defined.

NOA-Louis avatar Jul 18 '17 03:07 NOA-Louis

In case the slack message referenced gets truncated, the error output from NOA-Louis was:

Preparing environment :
  ! Mounting codebase
  ! Mounting codebase
  ! Mounting codebase
  ! Mounting codebase
  ! Mounting codebase

Error   : failed to add share exit status 2
Context : failed to init docker client -> failed to setup env mounts -> failed to mount the code share on the provider -> failed to add share

It seems to be the same issue as originally reported, where somewhere in Windows 10, the shares/sharing is disabled or something. The workaround, as louis mentioned, is to set the mount-type to native to circumvent the cifs/share/netfs issue

glinton avatar Jul 18 '17 03:07 glinton

Oh. Uh. I have a suspicion about this one...

When Windows connects to a new network, it asks the user whether or not to treat that network as a Public or Private (Home/Work) one. If the user selects Public, most network services will be disabled on that interface, including CIFS.

The fix, if my suspicion pans out, is to change the network type to Private, thereby allowing those services to be exposed on that interface. We might even be able to do this programmatically, if it turns out to be the culprit.

danhunsaker avatar Jul 18 '17 05:07 danhunsaker

@danhunsaker Wow, that is great insight. Very cool if this ends up being the case.

tylerflint avatar Jul 18 '17 05:07 tylerflint

yah that is a great idea. I can test it on my machine now that im back home.

lyondhill avatar Jul 19 '17 19:07 lyondhill

@danhunsaker I changed my network to public and I am still able to connect to my shares. @NOA-Louis can you look to see if your network is set to public or private?

lyondhill avatar Jul 20 '17 16:07 lyondhill

Note that each network has its own setting for this, so you'll want to check what it is for each adapter, and specifically the TAP device created by/for nanobox-vpn.

danhunsaker avatar Jul 20 '17 17:07 danhunsaker

In order to diagnose this properly, we're going to need a lot more information than we have. So, anyone reading this is encouraged to chime in with the settings on their system so we can compare and contrast what works with what doesn't.

  • Windows version (with build number if available)
  • The values of the settings in Control PanelNetwork and InternetNetwork and Sharing CenterAdvanced sharing settings; there are three sections, and it only opens one at a time, so be sure to get them all...
  • Enabled drivers on the Nanobox TAP interface (Control PanelNetwork and InternetNetwork Connections and then right-click the interface and choose Properties; if you have more than one TAP interface, you can provide them all, but if you can narrow down which one is used by Nanobox, that's the one we care about...)
  • Network Profile on the Nanobox TAP interface (SettingsNetwork & InternetEthernet and then select the interface from the list; this is mostly just to confirm my initial hunch was wrong, but also useful data to have)
  • The output of ipconfig /all and route print
  • The output of net share

We may ask for additional info at a later date, but for now, this should be more than enough to start on.

danhunsaker avatar Jul 23 '17 22:07 danhunsaker

@lyondhill private network.

NOA-Louis avatar Jul 25 '17 09:07 NOA-Louis

@NOA-Louis He's saying it didn't stop working when he switched to Public. I'm not 100% certain which interface was switched, in this case, but @lyondhill is smart enough to know it has to be the one Nanobox uses, so I'm pretty sure it's not just Public/Private. I think it's actually the setting to enable file sharing in the first place, which is among the options I listed as wanting to see, above.

I'd love to see what you have for each of those values, in fact!

danhunsaker avatar Jul 25 '17 12:07 danhunsaker

@danhunsaker I did set the one nanobox uses. then I saw your message and thought it best to double check. Now all my networks on my windows machine are set to public :)

lyondhill avatar Jul 25 '17 22:07 lyondhill

That's what I figured, yeah.

It occurred to me that Public vs Private only affects discoverability, not actual sharing. Whether file sharing is enabled or not is a separate setting. It's among the ones I asked about above.

danhunsaker avatar Jul 25 '17 23:07 danhunsaker

Hi, I am a new comer. Start learning Ruby on Rails using Nanobox. I had the same issue. Now it solved. How? I solved it by using this command: 'nanobox config set mount-type native', as mentioned in 'NOA-Louis commented on Jul 18 2017'

Thanks

ingafter60 avatar Nov 03 '18 03:11 ingafter60

Hi again,

I am trying again creating a new rails app. I must setting up the development environment using nanobox from scratch. It took a lot of time just to creating a new app.

But not in other development environment. Let say, I installed Ruby and Rails on my PC. Then, if I want to create a new app, just type: rails new myapp and DONE!

Questions:

  1. Why do we need nanobox instead of normal development environment?
  2. Do I have to setup nanobox from scratch every time I want to create a new app?
  3. While having nanobox setup, can I create a new rails app by just type: rails new app like creating a new app in a PC (with Ruby and Rails installed)?

Please help about the reason to have nanobox.

Thanks.

ingafter60 avatar Nov 03 '18 03:11 ingafter60

I experienced the same issue on a Windows 10 host. Frankly, I just gave up and set the mount-type to native and left it, however the performance is something I am a bit bothered about so I'm trying to figure out why it nanobox can't use netfs. The private vs network stuff doesn't seem to make a difference for me.

My password is rejected no matter what yet even after nanobox gives up after about 4/5 attempts and throws a mount error.

Error   : mount: output: mount error(112): Host is down
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
mount: mounting //192.168.99.1/nanobox-f9bde01f4d747a89f6f207cb15de7057 on /share/f9bde01f4d747a89f6f207cb15de7057/code failed: Host is down
exit status 32
 err:exit status 1
Context : failed to setup env mounts -> failed to mount the code share on the provider

The path it says it cannot map can be browsed with CIFS in Windows Explorer if I browse the location myself. I'm assuming the // path is translated, because it would normally be \\host\share for Windows but I'm assuming the CIFS mount is happening within the Linux VM.

My Windows host is connected to a domain so I don't know if that might have something to do with it. I also have SMB 1.0 disabled, I'm going to assume nanobox doesn't use or can mount with newer SMB version, but I'm pretty much stumped on why it cannot map the project folder.

jamesmacwhite avatar Jan 19 '19 16:01 jamesmacwhite