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 up" hangs on windows 7. Due to powershell? #8783

Closed
daffy1234 opened this issue Jul 14, 2017 · 45 comments
Closed

"Vagrant up" hangs on windows 7. Due to powershell? #8783

daffy1234 opened this issue Jul 14, 2017 · 45 comments

Comments

@daffy1234
Copy link

Please note that the Vagrant issue tracker is reserved for bug reports and
enhancements. For general usage questions, please use the Vagrant mailing list:
https://groups.google.com/forum/#!forum/vagrant-up. Thank you!

Vagrant version

Vagrant 1.9.7

Host operating system

Windows 7 Professional

Guest operating system

Ubuntu Server 14.04 ("ubuntu/trusty64" box)

Vagrantfile

Comments were removed.

$infoScript = <<SCRIPT
  echo 'IP-addresses of the vm ...'
  ifconfig
SCRIPT

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/trusty64"
  config.vm.network "public_network"
  config.vm.synced_folder "www", "/var/www"
  config.vm.synced_folder "phpconfig", "/etc/php5/apache2"
  config.vm.provision "shell", inline: <<-SHELL
    apt-get update
    apt-get install -y apache2 php5 libapache2-mod-php5
	sudo /etc/init.d/apache2 restart
  SHELL
  config.vm.provision "shell", inline: $infoScript,
      run: "always"
end

Debug output

https://gist.github.com/daffy1234/373f51a56ba183b886d045da99643011

Expected behavior

The machine should be provisioned and come up successfully.

Actual behavior

After the initial "vagrant up" command, absolutely no output is produced. vagrant.exe seems to open ruby.exe and powershell.exe. Killing powershell.exe twice is a workaround, and it gets the machine provisioned and booting normally. This issue does not occur after the machine has successfully booted at least once.

Steps to reproduce

  1. "vagrant up" on a brand new machine.
@daffy1234
Copy link
Author

Downgrading to Vagrant 1.9.6 is another workaround.

@ikus060
Copy link

ikus060 commented Jul 14, 2017

I've hit the same issue on a fresh Windows 7 install with Vagrant 1.9.7.

@marcuslang
Copy link

Same here. It hangs here:

INFO subprocess: Starting process: ["C:\WINDOWS\System32\WindowsPowerShell\v1.0\/powershell.EXE", "-NoLogo", "-NoProfile", "-NonInteractive", "-
ExecutionPolicy", "Bypass", "-Command", "(new-object System.Security.Principal.WindowsPrincipal([System.Security.Principal.WindowsIdentity]::GetCurren
t())).IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)"]
INFO subprocess: Command not in installer, restoring original environment...
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: True

@ferrarimarco
Copy link

Same issue on Windows 7 x64, even running vagrant status

@bbkane
Copy link

bbkane commented Jul 18, 2017

I have this issue as well.

@markehb
Copy link

markehb commented Jul 19, 2017

Same here, going back to 1.9.6 resolved for me as well.

@rashidkukkady
Copy link

I have similar issue... have not tried vagrant 1.9.6 as yet. Will do and update

@sd1ver
Copy link

sd1ver commented Jul 25, 2017

I've got the same issue.
The last message with --debug key is like the posted above:
DEBUG subprocess: stdout: False

@klangborste
Copy link

klangborste commented Jul 28, 2017

Also for me the same issue:

vagrant up --debug
....last 3 lines from debuggin output:
INFO subprocess: Command not in installer, restoring original environment...
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: True

@badhop
Copy link

badhop commented Jul 28, 2017

Have the same problem.

@edwardmlyte
Copy link

As has been commented on #8777, killing the powershell.exe process allows vagrant to continue, should you really NEED the latest version for some other reason.

@mac-b-71
Copy link

mac-b-71 commented Aug 1, 2017

Hello, same issue appeared today. Fix that worked for me was to update Windows PowerShell (was 2009). Now it is 2016 version and Vagrant works perfect. You can update it by installing WMF: https://msdn.microsoft.com/en-us/powershell/mt173057.aspx

@pscheit
Copy link

pscheit commented Aug 1, 2017

upgrading powershell helps (install WMF 5)
you commented half an hour earlier :D

@syagawa
Copy link

syagawa commented Aug 2, 2017

Update Windows Powershell to ver 5, the problem was solved.

Vagrant: Vagrant 1.9.7
Host OS: Windows 7 Professional 64bit
Guest OS: Ubuntu Server 14.04 ("ubuntu/trusty64" box)

@ikus060
Copy link

ikus060 commented Aug 2, 2017

Upgrading powershell cannot be a final fix for this bug. I recommend to show a warning in vagrant, asking the user to upgrade power shell...

@dfad1ripe
Copy link

WMF 5.1 + .NET 4.6.1 works for me too on Win 7 SP1. Even with that, after launching 'vagrant up', it freezes for ~20 sec, while powershell.exe eats up to 50% of i5 CPU resources. I don't remember such behavior on earlier versions.

@mikeyo241
Copy link

I had the same problem running vagrant up for "ubuntu/trusty64" it would hang on:
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: True.
I installed WMF like @bozemojmaciej suggested and the problem is fixed!!

@ashokvaddevalli
Copy link

ashokvaddevalli commented Aug 7, 2017

I am also facing same issue on using Vagrant 1.9.6 version.

INFO subprocess: Starting process: ["C:\Windows\System32\WindowsPowerShell\v1.0\/powershell.EXE", "-NoLogo", "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", "(new-object System.Security.Principal.WindowsPrincipal([System.Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)"]
INFO subprocess: Command not in installer, restoring original environment...
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: True

@zafaralam
Copy link

Had the same issue on my windows 7 machine.

Updated Windows Poweshell to version 5 and all works now.

Thanks a lot.

@ashokvaddevalli
Copy link

Updating Powershell on Host Machine or guest VM?

@pscheit
Copy link

pscheit commented Aug 8, 2017

host

@ashokvaddevalli
Copy link

ashokvaddevalli commented Aug 8, 2017

Thanks @pscheit

I have Updated Windows Poweshell to version 5 on host machine(Vagrant installed machine), now it was working now.

But I am getting another issue,

INFO synced_folders: Synced Folder Implementation: smb
INFO synced_folders: - /vagrant: . => /vagrant
INFO synced_folders: Invoking synced folder prepare for: smb
INFO interface: output: Preparing SMB shared folders...
INFO interface: output: ==> default: Preparing SMB shared folders...
INFO interface: detail: You will be asked for the username and password to use for the SMB
folders shortly. Please use the proper username/password of your
Windows account.

INFO interface: detail: 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:
INFO interface: ask: Username:
INFO interface: ask: default: Username:

@wiltaylor
Copy link

Prompting you for Samba folder credentials is normal. It is asking for an account on your host to connect to. You can put the credentials in the vagrant file but it isn't very secure to do so.

One work around I have is I store credentials in some environment variables and pass those into the vagrantfile. I set the environment variables when I open powershell to help keep them only to my vagrant session.

Example:

Vagrant.configure("2") do |config|
  config.vm.box = "Windows2012R2"
  config.vm.network "public_network", :bridge => "NAT
  config.vm.synced_folder ".", "/vagrant", type: "smb", smb_username: ENV["smb_username"], smb_password: ENV["smb_password"]
  end
end

@Bilge
Copy link

Bilge commented Aug 8, 2017

Confirm same hanging issue on Win 7 x64 with Vagrant 1.9.7.

@maheshbisen
Copy link

Its working for me after updating windows powershell.

Vagrant: Vagrant 1.9.7
Host OS: Windows 7 Professional 32bit
Guest OS: Ubuntu Server 14.04 ("ubuntu/trusty32" box)

@ashokvaddevalli
Copy link

Thanks @wiltaylor

My issue is resolved.

@kylerdmoore
Copy link

kylerdmoore commented Aug 25, 2017

Upgrading PowerShell fixed for me. Was running PowerShell 2. Upgraded to PowerShell 5 with the Windows Management Framework (WMF) 5.1 and vagrant no longer got hung up at "vagrant up" command.

Vagrant 1.9.8
Windows 7 Professional 64bit
VirtualBox 5.1.26
Using trusty64 as host vm

Here's the guide I used to upgrade PowerShell. The frameworks in this post are outdated but the rest is correct. http://mikefrobbins.com/2015/01/08/how-to-check-the-powershell-version-and-install-a-new-version/

@chrisroberts
Copy link
Member

Upgrading powershell should resolve the issue. The latest release (1.9.8) includes this PR #8839 that checks the powershell version and raises an error if the minimum is not satisfied. Cheers!

@SansGuidon
Copy link

@chrisroberts even on 1.9.8 I still need to kill powershell.exe in order to see the warning...

@elconde
Copy link

elconde commented Sep 12, 2017

@chrisroberts On 2.0.0 I also need to kill powershell.exe to see this warning.

@elconde
Copy link

elconde commented Sep 12, 2017

@kylerdmoore The link in your post is broken.

http://mikefrobbins.com/2015/01/08/how-to-check-the-powershell-version-and-install-a-new-version/

@philipp-winterle
Copy link

@chrisroberts I have 2.0.0 installed and I don't see any warning. Not even if I kill the process. Updating PS to v5 helps

@timmjd
Copy link

timmjd commented Sep 29, 2017

Last working version for Windows 7 seems to be 1.9.5. Haven't tested 1.9.6 yet, but its broken since 1.9.7.

@StalkAlex
Copy link

StalkAlex commented Oct 3, 2017

@chrisroberts your PR is not doing what you described. There wasn't any exceptions/warnings on last version 2.0.0, windows 7, getting here is what help me to solve the problem.

@dmz9
Copy link

dmz9 commented Oct 10, 2017

here is a faster and easier way of applying the workaround about installing new version of powershell.
do at your own risk, worked for me (not having any critical powershell-based startup scripts)

  1. install separate powershell 6 beta (atm). here is the git repo https://github.com/PowerShell/PowerShell/releases
    for win7 x64 i picked .msi version
  2. by default it gets installed to C:\Program Files\PowerShell\6.0.0-beta.8 (my version)
  3. rename old C:\Windows\System32\WindowsPowerShell\v1.0 to _v1.0 (or whatever) to have rollback just in case
  4. copy C:\Program Files\PowerShell\6.0.0-beta.8* into newly created C:\Windows\System32\WindowsPowerShell\v1.0*
  5. reboot (optional)
  6. profit

vagrant loaded ok

@anthony-o
Copy link

anthony-o commented Nov 27, 2017

With latest v6.0.0-rc, @dmz9 technic failed: vagrant up ends in error with:

Failed to locate the powershell executable on the available PATH. Please
ensure powershell is installed and available on the local PATH, then
run the command again.

And indeed, there is no powershell.exe but a pwsh.exe in C:\Program Files\PowerShell\6.0.0-rc. If I duplicate pwsh.exe to powershell.exe in C:\Windows\System32\WindowsPowerShell\v1.0 after step 4, then vagrant up fails with:

The version of powershell currently installed on this host is less than
the required minimum version. Please upgrade the installed version of
powershell to the minimum required version and run the command again.

  Installed version: N/A
  Minimum required version: 3

Finally, after following a solution in Stackoverflow, it finally worked: I installed .NET Framework 4.5.

@jcarey987
Copy link

So i updated powershell, and i type vagrant ssh into my terminal, which logs me into my machine. while i am logged in, the command prompt disappears. anyone else seeing this?

@robertluwang
Copy link

It is very interesting, vagrant up just hanging there forever, only saw exception when I killed all powershell process,

ERROR vagrant: #<Vagrant::Errors::PowerShellInvalidVersion: The version of powershell currently installed on this host is less than
the required minimum version. Please upgrade the installed version of
powershell to the minimum required version and run the command again.

  Installed version: N/A
  Minimum required version: 3>

checked my powershell is 2,

$PSVersionTable.PSVersion

Solved the issue by upgraded WMF to 4.0.

@MlleDelphine
Copy link

MlleDelphine commented Mar 23, 2018

I am facing the same issue now.
Today, I've up my Vagrant VMs.
I've halted them.
I've destroyed one VM and try a "vagrant up" to recreate.

Failed to locate the powershell executable on the available PATH. Please
ensure powershell is installed and available on the local PATH, then
run the command again.

Vagrant version : 2.0.1
Windows version : 10 Pro, 64bits
PowerShell version : 5.1.16299.98

@navigatrum
Copy link

Same problem.
Updated from Vagrant 1.8.5 to Vagrant 2, new Vagrantfile worked, but on vagrant up:

The version of powershell currently installed on this host is less than
the required minimum version. Please upgrade the installed version of
powershell to the minimum required version and run the command again.

  Installed version: N/A
  Minimum required version: 3

Vagrant Version 2.0.3
Windows version: 10 Home, 64bits
PowerShell version: 5.1.16299.251

@briancain
Copy link
Member

Hi @navigatrum - this issue has already been reported in #9629. Thanks!

@ultrasamad
Copy link

Restarting the pc in case of windows after adding the box before running vagrant up did a fix for me.

@alhaponyfaraj
Copy link

In my case, this issue was solved by updating powershell and .Net framework

@nunoxavier
Copy link

Fixed this by adding "%SYSTEMROOT%\System32\WindowsPowerShell\v1.0" to the environment PATH

@ghost
Copy link

ghost commented Mar 28, 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 28, 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