Win10下vagrant up報錯解決方案


Win10下vagrant up報錯解決方案

前提:安裝的vagrant版本為vagrant_2.2.6_x86_64,

安裝的vagrantBox版本為VirtualBox-6.1.6-137129

輸入:vagrant up 命令時,提示如下信息

No usable default provider could be found for your system.

Vagrant relies on interactions with 3rd party systems, known as "providers", to provide Vagrant with resources to run development environments. Examples are VirtualBox, VMware, Hyper-V.

The easiest solution to this message is to install VirtualBox, which is available for free on all major platforms.

If you believe you already have a provider available, make sure it is properly installed and configured. You can see more details about why a particular provider isn't working by forcing usage with vagrant up --provider=PROVIDER, which should give you a more specific error message for that particular provider.

遇到上面的情況,說明需要指定一個提供者,

在指定一個提供者時,輸入:vagrant up --provider=virtualbox

等號后面的名稱根據提前裝載的virtualbox填寫

又提示下面的信息,說明vagrantbox的版本不再它顯示的版本中,

The provider 'centos/7' could not be found, but was requested to back the machine 'default'. Please use a provider that exists.

Vagrant knows about the following providers: docker, hyperv, virtualbox

vagrant up --provider=virtualbox The provider 'virtualbox' that was requested to back the machine 'default' is reporting that it isn't usable on this system. The reason is shown below:

Vagrant has detected that you have a version of VirtualBox installed that is not supported by this version of Vagrant. Please install one of the supported versions listed below to use Vagrant:

4.0, 4.1, 4.2, 4.3, 5.0, 5.1, 5.2, 6.0

A Vagrant update may also be available that adds support for the version you specified. Please check www.vagrantup.com/downloads.html to download the latest version.

然后在本地找plugin.rb、meta.rb文件進行修改

E:\HashiCorp\Vagrant\embedded\gems\2.2.6\gems\vagrant-2.2.6\plugins\providers\virtualbox\plugin.rb

修改這個文件,plugin.rb(文件增加紅色部分

 

module Driver autoload :Meta, File.expand_path("../driver/meta", FILE) autoload :Version_4_0, File.expand_path("../driver/version_4_0", FILE) autoload :Version_4_1, File.expand_path("../driver/version_4_1", FILE) autoload :Version_4_2, File.expand_path("../driver/version_4_2", FILE) autoload :Version_4_3, File.expand_path("../driver/version_4_3", FILE) autoload :Version_5_0, File.expand_path("../driver/version_5_0", FILE) autoload :Version_5_1, File.expand_path("../driver/version_5_1", FILE) autoload :Version_5_2, File.expand_path("../driver/version_5_2", FILE) autoload :Version_6_0, File.expand_path("../driver/version_6_0", FILE) autoload :Version_6_1, File.expand_path("../driver/version_6_1", FILE) end

E:\HashiCorp\Vagrant\embedded\gems\2.2.6\gems\vagrant-2.2.6\plugins\providers\virtualbox\driver\meta.rb

修改**meta.rb這個文件,增加紅色的部分**

driver_map = { "4.0" => Version_4_0, "4.1" => Version_4_1, "4.2" => Version_4_2, "4.3" => Version_4_3, "5.0" => Version_5_0, "5.1" => Version_5_1, "5.2" => Version_5_2, "6.0" => Version_6_0, "6.1" => Version_6_1, }

在:E:\HashiCorp\Vagrant\embedded\gems\2.2.6\gems\vagrant-2.2.6\plugins\providers\virtualbox\driver

增加一個新文件,文件名稱:version_6_1.rb,內容如下:

 

require File.expand_path("../version_6_0", FILE)

module VagrantPlugins module ProviderVirtualBox module Driver # Driver for VirtualBox 6.1.x class Version_6_1 < Version_6_0 def initialize(uuid) super

@logger = Log4r::Logger.new("vagrant::provider::virtualbox_6_1") ​ end end end end end

 

然后在執行:vagrant up --provider=virtualbox

Bringing machine 'default' up with 'virtualbox' provider... ==> default: Importing base box 'centos/7'... ==> default: Matching MAC address for NAT networking... ==> default: Setting the name of the VM: jmcentos7 ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat default: Adapter 2: bridged ==> default: Forwarding ports... default: 22 (guest) => 2222 (host) (adapter 1) ==> default: Running 'pre-boot' VM customizations... ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. The guest machine entered an invalid state while waiting for it to boot. Valid states are 'starting, running'. The machine is in the 'unknown' state. Please verify everything is configured properly and try again.

 

出現上面就成功了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM