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 cant see the powershell #9629

Closed
ishakteyran opened this issue Mar 28, 2018 · 53 comments · Fixed by #9653
Closed

vagrant cant see the powershell #9629

ishakteyran opened this issue Mar 28, 2018 · 53 comments · Fixed by #9653
Assignees
Milestone

Comments

@ishakteyran
Copy link

ishakteyran commented Mar 28, 2018

Vagrant version

2.0.3

Host operating system

Win 10 Pro

Guest operating system

1- Ubuntu (hoshicorp/precise64)
2- laravel/homestead

Vagrantfile

1 (this is in C:\ drive)

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise64"

2 (this is in D:\ drive)

Vagrant.configure("2") do |config|
config.vm.box = "laravel/homestead"

Output of vagrant up

Bringing machine 'default' up with 'virtualbox' provider...
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

Explanations

Today I installed vagrant and VirtualBox (latest one from its website) , then i tried to use the aforementioned boxes (first the ubuntu one, and then the laravel box, but when i executed vagrant up the error above is thrown. The output for powershell version is

Name Value


PSVersion 5.1.16299.251
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.251
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

However, in my system Path the powershell directory is "%SYSTEMROOT%\System32\WindowsPowerShell\v1.0".

Now, the question is "Does vagrant check the directory in the path environment variable and thinks the version is 1.0?" If so, how can we overcome the issue?

EDIT : Changed the title "Debug Output" to "Output of vagrant up "

@chrisroberts
Copy link
Member

Hi there,

Please provide a link to the gist of the debug output from running a vagrant up.

Thanks!

@ishakteyran
Copy link
Author

ishakteyran commented Mar 28, 2018

@chrisroberts Well, I dont know how to provide link to gist (what is gist) (I am a total newbie to git environment)
The Debug Output title mentioned in the first post is the actual output of vargant up command. I will edit that title properly. And make a search to find out how to provide a gist link. If I can find, I will edit this comment.

EDIT : the gist link ( https://gist.github.com/ishakteyran/60d5f6cbcd13c902443b7f9a67c57f77 )

@briancain
Copy link
Member

Thanks @ishakteyran - that's exactly what we needed!

@navigatrum
Copy link

Temporary workaround: start powershell before vagrant ssh

@ishakteyran
Copy link
Author

vagrant
@navigatrum
The story of the SS above :
1- I opened the cmd
2- then i opened the PS
3- then i went to D:\VagrantVMs in cmd and listed the content
4- then i went to D:\VagrantVMs in PS and listed the content
5- then i executed vagrant up in cmd
6- then i executed vagrant up in PS
7- then i executed vagrant ssh in cmd (as you can see no result)
8- then i executed vagrant ssh in PS and luckily i am in VM.

Yesterday I have also tried using PS instead of cmd but it has produced no result.

@navigatrum
Copy link

@ishakteyran
Hemm...yesterday I updated from Vagrant 1.8.5 to Vagrant 2.0.3 and I couldn't vagrant shh without - just - starting PS. But today I can vagrant up normally...

I'm using:

  • Git Bash (git version 2.10.2.windows.1, Tcl/Tk version: 8.6.6)
  • vagrant_box: 'bento/ubuntu-16.04'
  • vagrant_box_version: '>= 201801.02.0'
  • Windows 10 Home,
  • PowerShell version: 5.1.16299.251,
  • VirtualBox Version: 5.1.26 r117224 (Qt5.6.2)
  • Vagrant 2.0.3,
  • Ruby version: 2.4.3
  • RubyGems version: 2.6.14
  • Vagrant Files from roots/trellis: Vagrantfile and vagrant-dafault.yml

@ishakteyran
Copy link
Author

@navigatrum
as you mentioned Git bash, i also wanted to try vagrant up and vagrant ssh in Git bash, Node.js command prompt, PowerShell, and windows cmd.
As i have two vagrant boxes i first tried with the one in D: drive but no luck. Then i tried the box in C: drive and with Git bash i could vagrant ssh Right after that, i tried again in PS vagrant ssh for the box in D: drive and surprise! that worked too.
Then, i disconnected both of them, and tried to reconnect with ssh, vagrant ssh , but both of them failed.
So, it was just luck that we were able to reach the VMs.
vagrant_confusion

The image above shows the successfull and failed vagrant ssh calls for both of the boxes.

@chrisroberts chrisroberts added this to the 2.0.4 milestone Mar 29, 2018
@chrisroberts chrisroberts self-assigned this Mar 29, 2018
@devamitbera
Copy link

Any update,please .

Use vagrant_2.0.3_x86_64 for window

and Virtual box

@bialix
Copy link

bialix commented Apr 4, 2018

I have the same problem on Windows 7. It's urgent blocker for me.
Which version of vagrant is not affected by this bug?

OK, reverted vagrant to 1.8.6 and virtualbox to 5.1.34 - and it works now.

My story was: I've upgraded virtualbox to 5.2 and vagrant stopped worked. I've upgraded vagrant - and it did not like my powershell version (2). I've installed newer powershell and now vagrant can't see powershell at all, but I have powershell version 3 now.
Reverted all to older state and will remeber to never upgrade.

@briancain
Copy link
Member

@bialix - Vagrant 2.0.2 should not have this bug. Just make sure you are using the latest powershell. Thanks!

chrisroberts added a commit to chrisroberts/vagrant that referenced this issue Apr 4, 2018
Allows custom configuration of the powershell timeout and bumps
the default timeout from 10 seconds to 30 seconds.

Fixes hashicorp#9629
chrisroberts added a commit to chrisroberts/vagrant that referenced this issue Apr 4, 2018
Allows custom configuration of the powershell timeout and bumps
the default timeout from 10 seconds to 30 seconds.

Fixes hashicorp#9629
@wyamote
Copy link

wyamote commented Apr 8, 2018

I'm still having this problem with Vagrant 2.0.3.
anytime I try to
vagrant up

it returns me this error:

$ 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

alrady tried updating powershell but it didn't seem to work.

@briancain
Copy link
Member

@lucasgabd - this is a regression and should be resoled in #9653 by setting a longer timeout. You should be able to try this in the next release (2.0.4). For now, if you have the latest powershell version, I recommend downgrading to 2.0.2. Thanks!

@TiagoSilvaPereira
Copy link

@lucasgabd +1 same problem here

@imanerazzougui
Copy link

hello , i also have the same problem , and i tried to upgrade PS version but it didn't work !!

@simioluwatomi
Copy link

I am running Vagrant 2.0.4

PS C:\Users\MidAS> vagrant -v
Vagrant 2.0.4

$PSVersionTable

PS C:\Users\MidAS> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.14409.1005
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14409.1005
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Windows 7 Pro SP1, Oracle VirtualBox 5.2.8

But I still get

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

Issue is unresolved; except you want me to downgrade to Version 2.0.2

@chrisroberts
Copy link
Member

@simioluwatomi Would you upload a gist of the command you are running with the --debug flag enabled. When PowerShell is installed but the version is not detected, it is generally due to the PowerShell command taking too long and timing out. The debug output will confirm that is happening.

The timeout can be configured using the VAGRANT_POWERSHELL_VERSION_DETECTION_TIMEOUT environment variable. However, if it still fails after increasing the timeout (the default is 30 so perhaps try 60) then it may point to a different issue with how the process is being executed.

Thanks!

@jeicoo
Copy link

jeicoo commented May 12, 2018

i'm also experiencing this issue, is there an update in this one?

@clippered
Copy link

same issue with me using Win7, vagrant 2.1.1, trying to start ubuntu/trusty64

@jeicoo
Copy link

jeicoo commented Jul 1, 2018

opening powershell before using vagrant up works for me.

@yavuzkoca
Copy link

yavuzkoca commented Jul 4, 2018

Well, my powershell version was old. I just updated it from this link, restarted the computer and worked.

@bialix
Copy link

bialix commented Jul 5, 2018

vagrant 2.1.2 seems to work ok.

@BlackHatJack
Copy link

Did some digging with this, seems powershell was taking too long to start up.

vagrant ssh --debug failed, but barried in there was the line DEBUG powershell: Timeout exceeded while attempting to determine version of Powershell.

I removed a few $env:path entries and also used ngen to speed a few things up.

All good now.

@briancain
Copy link
Member

@BlackHatJack - for future reference...if this is useful...you can modify how long the timeout will wait for with this environment variable:

$env:VAGRANT_POWERSHELL_VERSION_DETECTION_TIMEOUT = "60"

Its value will be in seconds. More information about that var can be read in the docs. Thanks!

@baniemeka
Copy link

Has anyone tried running command prompt as administrator? That did it for me

@adeyeye546
Copy link

Hello guys, this is the solution

  1. Run vagrant up in your command
  2. Run vagrant provision

It should work

#Happycoding

@manose345
Copy link

manose345 commented Aug 9, 2018

Anyone has luck yet.
''
image'''
''
image''

''
image''

@adeyeye546
Copy link

Install virtualbox and run vagrant up
Them run vagrant provision

@wla2000
Copy link

wla2000 commented Aug 13, 2018

I have this problem too. In my case I always run vagrant from a Git Bash window on my Windows 10 Pro machine. Suddenly today I got the above message (except in my case the "installed version" of powershell is N/A).

I tried upgrading my vagrant from 2.0.3 to 2.1.2, but that didn't work. Then I tried running "vagrant up" in an actual PowerShell window. (Apparently I'm running version 5.1 of powershell - way above the minimum required version).

So I guess my problem is "solved" -- I'll have to remember to switch to PowerShell to run my vagrant up commands. A major annoyance, because I never use PowerShell.

It looks like a Windows CMD shell window also works with vagrant. I guess the CMD shell can figure out my current PowerShell version.

@adeyeye546
Copy link

adeyeye546 commented Aug 13, 2018 via email

@dbashyal
Copy link

None of above worked :(

PS C:\_projects\vagrant\Centos7> vagrant up
vagrant.exe : The version of powershell currently installed on this host is less than
At line:1 char:8
+ vagrant <<<<  up
    + CategoryInfo          : NotSpecified: (The version of ...st is less than:String)  
   [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
the required minimum version. Please upgrade the installed version of
powershell to the minimum required version and run the command again.

  Installed version: 2

  Minimum required version: 3

@abhishekkarigar
Copy link

abhishekkarigar commented Sep 4, 2018

to get the latest version of powershell https://www.microsoft.com/en-us/download/details.aspx?id=34595
download the 64bit version

@farukalicioglu
Copy link

farukalicioglu commented Sep 10, 2018

Same problem with,
Windows 10 Pro (all the updates done)
Vagrant: 2.1.4 (latest version)
Windows PowerShell: 5.1 (acceptable version)
VM: 5.2.16 (latest version)

this is my vagrant up --debug: https://gist.github.com/pharuck/d3dba3bef0813e582efa4b6d8cd59319
att
(Lines: 438 - 447)

powershell-version-ss

what i tried?

  • open with admin vagrant.exe (C:\HashiCorp\Vagrant\bin)
  • open with admin CMD
  • open with admin Powershell (C:\Windows\System32\WindowsPowerShell\v1.0)
  • disabled HYPER-V
  • PowerShell command: $env:VAGRANT_POWERSHELL_VERSION_DETECTION_TIMEOUT = "60"

Another suggestion?

@briancain
Copy link
Member

@pharuck - what is the result if running Write-Output $PSVersionTable.PSVersion.Major in the same powershell window?

@farukalicioglu
Copy link

farukalicioglu commented Sep 10, 2018

@briancain

result: 5

vagrant up on powershell

vagrant-up-onpowershell

@briancain
Copy link
Member

@pharuck - if you set this environment variable and increase the timeout, does it work? 🤔

@sputmayer
Copy link

Hi Guys,
I had an external Hard Drive that was faulty and when it was plugged into my USB port, it caused powershell to not respond in a certain amount of time. This caused vagrant to fail. When I unplugged the usb, powershell started responding in the right time and all works well now
Hope this helps someone

@shresthasap
Copy link

I tried to run vagrant up on Cmder. Had the same issue of PowerShell minimum required version: 3 whereas I have version 5 in window 10. I re-installed Cmder and resolved the issue. 👍

@codingarrow
Copy link

Having the same issue as pharuck, and have simulated the suggestions here in

1>CMDER
cmder

2>POWERSHELL
pshell

3>PWSH
pwsh

And the frustrating thing is I can't even backup my boxes should I wish to reinstall, it still references the Powershell minimum N/A version.

vagrant package --output vagrant_example.box (is useless)

Any ideas how to fix this or everytime Windows 10 updates vagrant breaks?

@chrisroberts
Copy link
Member

@codingarrow would you please provide a gist of the debug output (vagrant up --debug) so I can see how the command is failing and see if I can reproduce the state locally? Thanks!

@codingarrow
Copy link

chrisroberts I have attached my file, dump debug (txt) I reckon that Windows 10 security update has something that messed up the vagrant configuration. But thank you for scrutinizing this frustrating issue thoroughly

vagrantdebug20181023.txt

@codingarrow
Copy link

thank you for everyone's inputs here it appears Vagrant (latest) and VirtualBox(latest) doesn't go well with windows 10's latest Powershell Issue I've tried every possibility and every combination of Vagrant,VirtualBox even uninstalled Powershell 2.0 and made powershell.exe -Version 2 it wasted me development days

the solution is a simple downgrade and it worked! (Will check my backedup Boxes though)

v200

v197

v200_vag

Now I'm gonna stick to VirtualBox-5.1.34-121010-Win and vagrant_1.9.7_x86_64 for now on my windows 10 (updated occassionally)

Cheers

@al-fian
Copy link

al-fian commented Oct 25, 2018

In my case, I solved the problem like this:
First, I ran "update-help" in PowerShell as explained here. Once done, then I ran "vagrant up" again in CMD prompt.

@chrisroberts
Copy link
Member

After multiple attempts with different base windows configurations, with different tool sets installed and used (cmder, msys2, cygwin), applying windows updates, etc, I was not able to get windows into a state to reproduce the issues encountered. If anyone can provide steps to reproduce the issue, please do let me know so I can investigate it more.

As a workaround, I have updated the hyper-v enabled check so that it will not result in a hard failure if the powershell validation check fails. This will prevent failures when using a non-hyper-v provider like virtualbox or docker. There are places where powershell is still used (like smb synced folders) that can cause problems, but this should at least relieve the issue until a reliable reproduction of the environment can be obtained. PR is here: #10332 and it will be included in the next release.

Cheers!

@ottoedge
Copy link

Open powershell and put vagrant up
Above has been worked for me.

@Adilsys
Copy link

Adilsys commented Apr 30, 2019

Hello everybody,

I invite you to install the latest version of Powershell, according to the step listed in the link bellow:
https://social.technet.microsoft.com/wiki/contents/articles/21016.how-to-install-windows-powershell-4-0.aspx

Regards,
A.A

@Jummartinezro
Copy link

Jummartinezro commented Nov 28, 2019

I'm having the same issue. I cannot vagrant up and I have Powershell 5.0 on W7 installed:

When retrieving the Powershell version I have an updated version:

>$PSVersionTable.PSVersion.Major
5

Gist

Any ideas / updates ?

@ghost
Copy link

ghost commented Jan 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 Jan 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.