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

Vagrant seems to hang during smb setup. #3139

Closed
jyggen opened this issue Mar 11, 2014 · 25 comments
Closed

Vagrant seems to hang during smb setup. #3139

jyggen opened this issue Mar 11, 2014 · 25 comments

Comments

@jyggen
Copy link
Contributor

jyggen commented Mar 11, 2014

I have an issue where Vagrant hangs during vagrant up right after I've entered the credentials for my Windows account. It's been running for an hour or so no with no sign of wanting to be my friend anytime soon.

==> default: Preparing SMB shared folders...
    default: You will be asked for the username and password to use for the SMB
    default: folders shortly. Please use the proper username/password of your
    default: Windows account.
    default:
    default: Username: jyggen
    default: Password (will be hidden):

If I up the log level to debug there seems to be an issue with my Vagrant install being in a path with spaces in it.

 INFO subprocess: Starting process: ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\/powershell.EXE", "-NoProfile", "-ExecutionPolicy", "Bypass", "C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.0/plugins/synced_folders/smb/scripts/set_share.ps1", "-path", "C:\\Users\\jyggen\\devbox\\www", "-share_name", "8bd269f8-3e93-4e66-8773-09305a2b4d89--var-www"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stderr: The term 'C:/Program' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of
 the name, or if a path w
as included, verify that the path is correct and try again.
At line:1 char:11
+ C:/Program <<<<  Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.0/plugins/synced_folders/smb/scripts/set_share.ps1 -path C:\Users\jyggen\devbox\www - share_name 8bd269f8-3e93-4e66-8773-09305a2b4d89--var-www
    + CategoryInfo          : ObjectNotFound: (C:/Program:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Running Windows 7 x64, VirtualBox 4.3.8 and Vagrant 1.5.

@andyclarke
Copy link
Contributor

I have the same system set up, except I have Vagrant installed in a path with no spaces (the default location). I get a hang in the same place.
Turning on debug logging does not give me any useful information. It states:

 INFO interface: ask: Username:
 INFO interface: ask:     marketplace_search: Username:
    marketplace_search: Username: *****
 INFO interface: ask: Password (will be hidden):
 INFO interface: ask:     marketplace_search: Password (will be hidden):
    marketplace_search: Password (will be hidden):
 INFO subprocess: Starting process: ["C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\/powershell.EXE", "-NoProfile", "-
ExecutionPolicy", "Bypass", "C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.5.0/plugins/synced_folders/smb/scripts/se
t_share.ps1", "-path", "C:\\LocalDev\\marketplace", "-share_name", "13f825ea-d989-439e-a966-ae1c0bd921af--usr-local-sg-m
arketplace"]
DEBUG subprocess: Selecting on IO

@jyggen
Copy link
Contributor Author

jyggen commented Mar 11, 2014

Yeah, same here if I reinstall Vagrant in the default location.

@timonwong
Copy link

Same here.
It seems powershell never returns. However, execute the actual commands in the command line will return successfully.

@mzeis
Copy link

mzeis commented Mar 12, 2014

I experienced the same problem with Windows 7 Professional.

Here is my debug for log level info and debug: https://gist.github.com/mzeis/9503045

Please note that "Zuordnungen von Kontennamen und Sicherheitskennungen wurden nicht durchgeführt." translates to "No mapping between account names and security IDs was done".

I don't know if this is related: http://support.microsoft.com/kb/285903/en-us

@igor84
Copy link

igor84 commented Mar 12, 2014

I am having the same issue. I added some output to the set_share.ps1 script and we found that it comes to the exit 0 command, but after that nothing else is written, it just hangs. I am working on Windows 7. My colleague is working on Win8 and the same Vagrant machine works for him. The first two lines of logs it writes on his machine that are after the same lines I get are:

DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0

I never get these written after this:

INFO subprocess: Starting process: ["C:\Windows\System32\WindowsPowerShell\v1.0/powershell.EXE", "-NoProfile", "-ExecutionPolicy", "Bypass", "C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.5
.0/plugins/synced_folders/smb/scripts/set_share.ps1", "-path", "D:\git", "-share_name", "93fc0195-aa8b-4add-9d27-c1c74f0cb1c0--www"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: 93fc0195-aa8b-4add-9d27-c1c74f0cb1c0--www was deleted successfully.

@timcooper
Copy link
Contributor

Seeing the same as @andyclarke

 INFO synced_folders: Invoking synced folder prepare for: smb
 INFO interface: output: Preparing SMB shared folders...
 INFO interface: output: ==> redacted: Preparing SMB shared folders...
==> redacted: Preparing SMB shared folders...
 INFO subprocess: Starting process: ["C:\\Windows\\System32\\WindowsPowerShell\\
v1.0\\/powershell.EXE", "-NoProfile", "-ExecutionPolicy", "Bypass", "C:/HashiCor
p/Vagrant/embedded/gems/gems/vagrant-1.5.0/plugins/synced_folders/smb/scripts/se
t_share.ps1", "-path", "C:\\redacted\\correct\\local\\path",
 "-share_name", "ff71ea8a-5597-4753-8657-54372ad2a441--redacted
"]
DEBUG subprocess: Selecting on IO

Only difference being I include the username/password options in the vagrantfile so it doesn't ask for them.

Host is Windows 7 64bit, guest is CentOS 6.4, I tried booting without the shares and manually installing samba-client in case vagrant wasn't able to (I think it makes reference to something like this in the docs but can't find it right now)

@mitchellh
Copy link
Contributor

I've seen this happen once in awhile and I'm not sure why. If someone can dig deeper and debug this a bit more I'd really appreciate it since I can't often reproduce it. The powershell script is there for you to look at!

@andyclarke
Copy link
Contributor

As far as I can tell so far it seems to complete the powershell script successfully, creating the share (can be seen with "net share").
Trying to work out where it goes from there.

@jyggen
Copy link
Contributor Author

jyggen commented Mar 13, 2014

Yeah, set_share.ps1 seems to work just fine and the share is created. exit 0 at the bottom is reached (verified by adding some output right above it):

$result = net share $share_name=$path /unlimited /GRANT:$grant
if ($result -Match "$share_name was shared successfully.") {
    exit 0
}

However, I added some output right above if r.exit_code != 0 in the ruby file that's calling the script (synced_folder.rb) and it's not displayed. I'm not really familiar with Ruby though, but I think the code below should output test if reached?

script_path = File.expand_path("../scripts/set_share.ps1", __FILE__)

# some other stuff here

r = Vagrant::Util::PowerShell.execute(script_path, *args)
machine.ui.output("test") # this is not executed
if r.exit_code != 0
  raise Errors::DefineShareFailed,
    host: hostpath.to_s,
    stderr: r.stderr,
    stdout: r.stdout
end

@jyggen
Copy link
Contributor Author

jyggen commented Mar 13, 2014

I added some debug output to the childprocess gem's exited method and the powershell process keeps returning code 259, which is equal to the gem's constant PROCESS_STILL_ACTIVE. So back to figuring out why the powershell script isn't returning when it clearly reaches the line above exit 0.

@igor84
Copy link

igor84 commented Mar 13, 2014

Well after 5 hours of debugging this with no knowledge of Ruby or PowerShell I found the solution is to install PowerShellV3 (since Win7 comes with v2) from here http://www.microsoft.com/en-us/download/details.aspx?id=34595
The download you want is either Windows 6.1 x64 or x86, depends if you are either running 64bit or 32bit.

Now I'm off to see why php suddenly disappeared from my virtual machine...

@jyggen
Copy link
Contributor Author

jyggen commented Mar 14, 2014

Right, upgrading to Powershell v3 does solve the problem with the powershell script not returning. However, now I get the following error instead (after the machine is booted):

(JSON::ParserError)6)/Vagrant/embedded/lib/ruby/2.0.0/json/common.rb:155:in `parse': 757: unexpected token at 'C:/Program Files (x86)/Vagrant/embedded/gems/gems/vagrant-1.5.0/plugins/synced_folders/smb/scripts/host_info.ps1

Running that script manually outputs the following (valid) JSON:

{
    "ip_addresses": [
        "192.168.50.172",
        "fe80::a190:ae95:cfa1:1834",
        "192.168.3.1",
        "fe80::7c08:9a7a:605e:5edd",
        "192.168.56.1",
        "fe80::c183:c7bf:9793:7273",
        "192.168.99.1",
        "fe80::c0b3:faec:8503:2224"
    ]
}

@wkiril
Copy link

wkiril commented Mar 14, 2014

same here - windows 7 professional x64, powershell v2.0

@sskorc
Copy link

sskorc commented Mar 14, 2014

This may be a different issue, however I have had PowerShell v3 already installed and I receive the same error as @mzeis.

@jyggen
Copy link
Contributor Author

jyggen commented Mar 14, 2014

Yeah, after the change I made in #3210 I receive the same error as @sskorc and @mzeis.

Exporting an SMB share failed! Details about the failure are shown
below. Please inspect the error message and correct any problems.

Host path: C:/Users/jyggen/devbox

Stderr: Systemfel 1332 har uppstått.

Det har inte gjorts någon mappning mellan kontonamn och säkerhets-ID.

Error:


Stdout:

Error code 1332 with the message "No mapping between account names and security IDs was done.".

@mzeis
Copy link

mzeis commented Mar 14, 2014

After installing PowerShell v3, I receive the same message as mentioned by @jyggen, @sskorc et al before (but now without setting the log level to debug).

After installing Vagrant 1.5.1 and rebooting, the current error is C:/Programme/Vagrant/embedded/lib/ruby/2.0.0/json/common.rb:155:inparse': 757: unexpected token` (see https://gist.github.com/mzeis/9503045#file-vagrant-up-2014-03-14_1602 for full back trace).

@mitchellh
Copy link
Contributor

Fixed by #3210

@dmanchikalapudi
Copy link

How do I get this change? I am dead in the water with the same issue.

@wkiril
Copy link

wkiril commented Mar 16, 2014

try updating powershell to v3.0 (if it's not) from here - http://www.microsoft.com/en-us/download/details.aspx?id=34595
and then apply the commit from here - d01b9ef

it worked for me

@dmanchikalapudi
Copy link

Appreciate your prompt reply wkiril. I did install powershell and I got past the hanging issue ... I am missing the applying the commit part. Where do I apply it? I have not done it before now and I dont think I have the setup to compile and run vagrant from source.

@wkiril
Copy link

wkiril commented Mar 16, 2014

actually the file on Windows is located at: HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.5.1\lib\vagrant\util\powershell.rb at line 24 (assuming HashiCorp\Vagrant is your install directory). you don't need to compile anything

@dmanchikalapudi
Copy link

Thanks wkiril. I had a fix a couple more missing cookbooks (as a result of removing berkshelf plugin due to incompatibilities with vagrant 1.5.1) ... but once I fixed them, everything booted up cleanly ... said it mounted my smb drives ... but when I log into the guest box, the mounted drives are empty. Did u have similar problems?

@binary1230
Copy link

quick note because I finally got down to this issue after 8 hours of frustration and finally debugging the ruby script enough to figure out what was going on. Was seeing this on vagrant 1.6.2 release, installed powershell v3.0, and it finally started working.

There really should be something in the documentation about making sure you have the latest version of powershell during the install process.

binary1230 added a commit to magfest/ubersystem that referenced this issue May 27, 2014
I spent 8 freaking hours figuring this out.  Instructions related to working around this bug:
hashicorp/vagrant#3139
@piotr-cz
Copy link

piotr-cz commented Sep 3, 2014

IMHO PowerShell 3.0 requirement should be stated in SMB docs, this would save me time trying to make SMB work.

@joelcollinsdc
Copy link

+1, this recommended documentation change would be GREATLY appreciated. wasted an hour on this.

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

No branches or pull requests