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

Mount windows share folder with mount.cifs on guest OS (mount error(22): Invalid argument) #9482

Closed
mikocevar opened this issue Feb 17, 2018 · 4 comments

Comments

@mikocevar
Copy link

mikocevar commented Feb 17, 2018

Hi guys!

So i would like to use sync_type: smb, which is suggested when using windows as host. The problem is, i cannot mount the folder like vagrant wants to do it, when i type vagrant up!

So i then copied the command with which he wants to mount and booted the guest with sync_type default, to test it myself. Same error, of course, but i could play around a little with it.

I found out, that removing the flag sec=ntlmssp binds the drive successfully. Now the problem is, i cannot change this flag value through the puphpet configuration... so it would work with vagrant up.

The other problem is, that while this mount works, my web server cannot make directories, i always get permissions denied.

And another issue here is, that the symlinks don't seem to work, even if i somehow workaround the permission problem... Why are there so many isses..?

I checked a lot of everything on the web and now i finally came to open this issue. Any help is appreciated.

Vagrant version

Vagrant 2.0.2

Host operating system

Windows 10 pro

Vagrant plugin list

vagrant plugin list
vagrant-vbguest (0.15.1)

VirtualBox

Version 5.2.6 r120293 (Qt5.6.2)

Guest operating system

Linux test.dev 2.6.32-696.20.1.el6.x86_64 #1 SMP Fri Jan 26 17:51:45 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

cat /etc/redhat-release
CentOS release 6.9 (Final)

Vagrantfile

# -*- mode: ruby -*-

dir = File.dirname(File.expand_path(__FILE__))

require 'yaml'
require "#{dir}/puphpet/ruby/deep_merge.rb"
require "#{dir}/puphpet/ruby/to_bool.rb"
require "#{dir}/puphpet/ruby/puppet.rb"

configValues = YAML.load_file("#{dir}/puphpet/config.yaml")

provider = ENV['VAGRANT_DEFAULT_PROVIDER'] ? ENV['VAGRANT_DEFAULT_PROVIDER'] : 'local'
if File.file?("#{dir}/puphpet/config-#{provider}.yaml")
  custom = YAML.load_file("#{dir}/puphpet/config-#{provider}.yaml")
  configValues.deep_merge!(custom)
end

if File.file?("#{dir}/puphpet/config-custom.yaml")
  custom = YAML.load_file("#{dir}/puphpet/config-custom.yaml")
  configValues.deep_merge!(custom)
end

data = configValues['vagrantfile']

Vagrant.require_version '>= 1.8.1'

Vagrant.configure('2') do |config|
  eval File.read("#{dir}/puphpet/vagrant/Vagrantfile-#{data['target']}")
  config.vm.network "public_network", ip: "192.168.0.252"
  #config.vm.network "public_network", ip: "192.168.80.252"
  config.ssh.forward_agent = true
  #config.vbguest.auto_update = false
end

Debug output

mount -t cifs -o sec=ntlmssp,credentials=/etc/smb_creds_vgt-62e0f95bf5540ccef4db6862f8cc5ec3-72af2cc030a13ce49f623394bbebbf2c,uid=501,gid=501,dir_mode=0775,file_mode=0664 //192.168.0.21/vgt-62e0f95bf5540ccef4db6862f8cc5ec3-72af2cc030a13ce49f623394bbebbf2c /var/www/share

mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

Expected behavior

Successfull mount?

Actual behavior

mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

@ghola
Copy link

ghola commented Feb 22, 2018

I hit the same issue. The problem is caused by sec=ntlmssp and is fixed by overriding that with sec=ntlm. You can apply the override through the options array in the Vagrantfile like so:

mount_options: ["vers=3.02","mfsymlinks","dir_mode=0775","file_mode=0774","sec=ntlm"]

@ghola
Copy link

ghola commented Feb 22, 2018

Btw, the problem only appears on 2.* version of Vagrant and it work correctly on 1.*.

@mikocevar
Copy link
Author

mikocevar commented Feb 22, 2018

Thanks for answering! I didn't know that you can override it through the Vagrantfile.

I was losing my mind trying to fix this, so eventually i then made a fresh box with CentOS 7 and everything worked without a problem (with sec=ntlmssp)

The result however is sad. I don't have any performance increase using smb mounted folders. So i don't know why it's even "HIGHLY RECOMMENDED".

Closing the case.

@ghost
Copy link

ghost commented Mar 30, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants