2016-11-02 124 views
1

最初,我有8個流浪機器在運行,出了點問題。所以我刪除了〜/ VirtualBox \ VMs文件夾中的vms,並將備份的.vmdk文件放在同一位置。 然後我試圖運行無業遊民了...... 但我發現了以下錯誤運行Vagrant時出錯

帶機「虛擬-AM1」了「VirtualBox的」供應商...

==> virtual-am1: Importing base box 'centos653'... 
==> virtual-am1: Matching MAC address for NAT networking... 
==> virtual-am1: Setting the name of the VM: vagrant_virtual-am1_1478100170176_83326 
==> virtual-am1: Clearing any previously set network interfaces... 
==> virtual-am1: Preparing network interfaces based on configuration... 
    virtual-am1: Adapter 1: nat 
    virtual-am1: Adapter 2: bridged 
==> virtual-am1: Forwarding ports... 
    virtual-am1: 22 (guest) => 2203 (host) (adapter 1) 
==> virtual-am1: Running 'pre-boot' VM customizations... 
    A customization command failed: 

["modifyvm", :id, "--name", "virtual-am1"] 

The following error was experienced: 

#<Vagrant::Errors::VBoxManageError: There was an error while executing `VBoxManage`, a CLI used by Vagrant 
for controlling VirtualBox. The command and stderr is shown below. 

Command: ["modifyvm", "6dd13964-e648-40cd-932e-3e18be375d31", "--name", "virtual-am1"] 

Stderr: VBoxManage: error: Could not rename the directory '/home/vagrant/VirtualBox VMs/vagrant_virtual-am1_1478100170176_83326' to '/home/vagrant/VirtualBox VMs/virtual-am1' to save the settings file (VERR_ALREADY_EXISTS) 

VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component SessionMachine, interface IMachine, callee nsISupports 

VBoxManage: error: Context: "SaveSettings()" at line 2788 of file VBoxManageModifyVM.cpp 

>Please fix this customization and try again. 

這是怎麼了我Vagrantfile看起來像...... 我們有一個自定義的文件流浪

# -*- mode: ruby -*- 
# vi: set ft=ruby : 

#Parse nodes config file 
nodes_config = (JSON.parse(File.read("nodes.json")))['nodes'] 

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! 
VAGRANTFILE_API_VERSION = "2" 

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 
    config.ssh.insert_key = false 

    config.vm.box = "centos653" 
    config.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box" 
# config.vm.provision :shell, path: "bootstrap.sh" 

    nodes_config.each do |node| 
    node_name = node[0] # name of node 
    node_values = node[1] # content of node 

    config.vm.define node_name do |config| 
     # configures all forwarding ports in JSON array 
     ports = node_values['ports'] 
     ports.each do |port| 
     config.vm.network :forwarded_port, 
      host: port[':host'], 
      guest: port[':guest'], 
      id: port[':id'] 
     end 

     config.vm.synced_folder "/bits", "/vagrant/bits" 
     config.vm.synced_folder "../virtual", "/vagrant/virtual" 

     config.vm.hostname = node_values[':hostname'] 
     #config.vm.network :private_network, ip: node_values[':ip'] 
     config.vm.network "public_network", bridge: 'enp134s1f0', ip: node_values[':ip'] 

     config.vm.provider :virtualbox do |vb| 
     vb.customize ["modifyvm", :id, "--memory", node_values[':memory']] 
     vb.customize ["modifyvm", :id, "--name", node_values[':node']] 
     vb.customize ["modifyvm", :id, "--cpus", 8] 
     end 

    end 
    end 
end 

這是我nodes.json文件看起來像

{ 
    "nodes": { 
    "virtual-am1": { 
     ":node": "virtual-am1", 
     ":ip": "192.168.1.50", 
     ":hostname": "am1.onefederation.org", 
     "ports": [ 
     { 
      ":host": 2203, 
      ":guest": 22, 
      ":id": "ssh" 
     } 
     ], 
     ":memory": 1024 
    }, 
    } 
} 

請幫忙!!!

+0

你能提供更多關於出錯的信息嗎? –

+0

最初我有vm的運行,並且我有作爲備份的所有vm的.vmdk文件。我在所有虛擬機上運行了openAM,並且OpenAM的配置出了問題。所以我決定銷燬所有的Vagrant機器,並將它們從我之前做的備份中提取出來。我使用Vagrant destroy命令來刪除所有的vms。/home/vagrant/Virtual Box/vms中沒有vms。之後,我將包含.vmdk文件的vm文件夾從備份放置在相同位置(/ home/vagrant/Virtual Box/vms)並跑到最近。運行流浪後,我得到了上述錯誤。 – Viknesh

回答

0

我有這個錯誤,你可以使用這個修正:遊民

rm -rf /home/protobox/VirtualBox VMs/project_folder 

刪除文件夾項目

轉到項目文件夾:

cd /var/www/project_folder 

然後重啓無業遊民:

vagrant destroy**maybe more**`vagrant destroy -f` 
vagrant reload 

最後你開始顛沛流離的

vagrant up 
vagrant ssh 

或者您也可以參考這裏:http://getprotobox.com/docs/issues/vbox_rename

祝你好運!