我在公司代理后面的Windows 10上使用流浪汉2.2.5。
所有CLI命令都挂起。
让我们用vagrant help
来说明我的问题。
vagrant help
耗时超过30秒。
Measure-Command {start-process vagrant -argumentlist "help" -Wait}
Days : 0
Hours : 0
Minutes : 0
Seconds : 36
Milliseconds : 94
Ticks : 360943091
TotalDays : 0,000417758207175926
TotalHours : 0,0100261969722222
TotalMinutes : 0,601571818333333
TotalSeconds : 36,0943091
TotalMilliseconds : 36094,3091
vagrant help --debug
表明它挂在了
DEBUG checkpoint_client: waiting for checkpoint to complete...
继续
INFO runner: Running action: environment_unload #<Vagrant::Action::Builder:0x0000000004b32910>
我注意到,如果我断开网络连接(飞行模式,拔掉以太网电缆),情况会好很多:
Measure-Command {start-process vagrant -argumentlist "help" -Wait}
Days : 0
Hours : 0
Minutes : 0
Seconds : 5
Milliseconds : 14
Ticks : 50147343
TotalDays : 5,804090625E-05
TotalHours : 0,00139298175
TotalMinutes : 0,083578905
TotalSeconds : 5,0147343
TotalMilliseconds : 5014,7343
如果我配置代理,那就更好了
$env:HTTP_PROXY="http://my.proxy.host:port"
$env:HTTPS_PROXY="http://my.proxy.host:port"
Measure-Command {start-process vagrant -argumentlist "help" -Wait}
Days : 0
Hours : 0
Minutes : 0
Seconds : 2
Milliseconds : 24
Ticks : 20249878
TotalDays : 2,34373587962963E-05
TotalHours : 0,000562496611111111
TotalMinutes : 0,0337497966666667
TotalSeconds : 2,0249878
TotalMilliseconds : 2024,9878
相比之下,在WSL(Linux的Windows Subsytem)中,在所有情况下(与连接无关),它要快得多:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 19.04
Release: 19.04
Codename: disco
$ time vagrant help
(...)
real 0m1.043s
user 0m0.500s
sys 0m0.469s
由于流浪汉在WSL Ubuntu中的版本为2.0.2,因此我也在Windows上对此版本进行了测试。我的行为也一样。
答案 0 :(得分:0)
问题在于以某种方式访问网络。
我在issue中解释了Vagrant的支持,Vagrant将定期检查是否有新版本,以便在有新版本时通知用户。
如果网络访问速度慢或挂起,则每个命令都将等待它,因为流浪汉会一直尝试直到得到答案为止。
只有这样,它会等待一段时间,然后再试一次。
要禁用此轮询,只需设置environment variable VAGRANT_CHECKPOINT_DISABLE
。