2017-08-15 104 views
1

我想将存在于我的Windows计算机上的整个文件夹复制到虚拟机主机ubuntu/trusty64。Vagrant GuestAdditions似乎已正确安装(5.1.20),但未运行

但是,每次我试图把我的流浪汉带起来,我会得到下面的错误消息。

vagrant up 
Bringing machine 'default' up with 'virtualbox' provider... 
==> default: Checking if box 'ubuntu/trusty64' is up to date... 
==> default: Clearing any previously set forwarded ports... 
==> default: Clearing any previously set network interfaces... 
==> default: Preparing network interfaces based on configuration... 
    default: Adapter 1: nat 
    default: Adapter 2: hostonly 
==> default: Forwarding ports... 
    default: 22 (guest) => 2222 (host) (adapter 1) 
==> 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: Machine booted and ready! 
==> default: Configuring proxy for Apt... 
==> default: Configuring proxy environment variables... 
[default] GuestAdditions seems to be installed (5.1.20) correctly, but not running. 
vboxadd: unrecognized service 
vboxadd-service: unrecognized service 
bash: line 4: setup: command not found 
==> default: Checking for guest additions in VM... 
The following SSH command responded with a non-zero exit status. 
Vagrant assumes that this means the command failed! 

setup 

Stdout from the command: 



Stderr from the command: 

bash: line 4: setup: command not found 

注:
Ubuntu的版本是最新的,你可以在第三行看到的。
流浪版本:1.9.3流浪汉
Windows版本:Windows 7企业版Service Pack 1的
甲骨文VirtualBox的版本:版本5.1.20 r114628(Qt5.6.2)

在vbguest状态运行命令我得到

$ vagrant vbguest --status 
[default] GuestAdditions seems to be installed (5.1.20) correctly, but not running. 

我流浪汉文件内容

# All Vagrant configuration is done below. The "2" in Vagrant.configure 
# configures the configuration version (we support older styles for 
# backwards compatibility). Please don't change it unless you know what 
# you're doing. 
Vagrant.configure("2") do |config| 
    # The most common configuration options are documented and commented below. 
    # For a complete reference, please see the online documentation at 
    # https://docs.vagrantup.com. 

    # Every Vagrant development environment requires a box. You can search for 
    # boxes at https://atlas.hashicorp.com/search. 
    config.vm.box = "ubuntu/trusty64" 
    config.ssh.insert_key = false 
    # Disable automatic box update checking. If you disable this, then 
    # boxes will only be checked for updates when the user runs 
    # `vagrant box outdated`. This is not recommended. 
    # config.vm.box_check_update = false 

    # Create a forwarded port mapping which allows access to a specific port 
    # within the machine from a port on the host machine. In the example below, 
    # accessing "localhost:8080" will access port 80 on the guest machine. 
    # config.vm.network "forwarded_port", guest: 80, host: 8080 

    # Create a private network, which allows host-only access to the machine 
    # using a specific IP. 
    config.vm.network "private_network", ip: "xxxxx" 

    # Create a public network, which generally matched to bridged network. 
    # Bridged networks make the machine appear as another physical device on 
    # your network. 
    # config.vm.network "public_network" 

    # Share an additional folder to the guest VM. The first argument is 
    # the path on the host to the actual folder. The second argument is 
    # the path on the guest to mount the folder. And the optional third 
    # argument is a set of non-required options. 
    #config.vm.synced_folder "../data", "/vagrant_data" , "/vagrant" 
    config.vm.synced_folder ".", "/mydata", :mount_options => ['dmode=775','fmode=664'] 
    #config.vm.synced_folder "./", "/vagrant", id: "vagrant-root", type: "nfs" 

    # Provider-specific configuration so you can fine-tune various 
    # backing providers for Vagrant. These expose provider-specific options. 
    # Example for VirtualBox: 
    # 
    # config.vm.provider "virtualbox" do |vb| 
    # # Display the VirtualBox GUI when booting the machine 
    # vb.gui = true 
    # 
    # # Customize the amount of memory on the VM: 
    # vb.memory = "1024" 
    # end 
    # 
    # View the documentation for the provider you are using for more 
    # information on available options. 

    # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies 
    # such as FTP and Heroku are also available. See the documentation at 
    # https://docs.vagrantup.com/v2/push/atlas.html for more information. 
    # config.push.define "atlas" do |push| 
    # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME" 
    # end 

    # Enable provisioning with a shell script. Additional provisioners such as 
    # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the 
    # documentation for more information about their specific syntax and use. 
    # config.vm.provision "shell", inline: <<-SHELL 
    # apt-get update 
    # apt-get install -y apache2 
    # SHELL 
    if Vagrant.has_plugin?("vagrant-proxyconf") 
    config.proxy.http  = "xxxxx" 
    config.proxy.https  = "xxxxx" 
    config.proxy.ftp  = "xxxxx" 
    config.apt_proxy.http = "xxxxx" 
    config.apt_proxy.https = "xxxxx" 
    config.proxy.no_proxy = "xxxxx" 
    end 

    if !Vagrant.has_plugin?("vagrant-proxyconf") 
    system('vagrant plugin install vagrant-proxyconf')  
    raise("vagrant-proxyconf installed. Run command again."); 
    end 

end 

请建议
1.我如何纠正这个错误?
2.将完整的文件夹从Windows共享到vm?

+1

这似乎是你应该询问[官方虚拟盒论坛](https://forums.virtualbox.org)的那种问题。 – APC

+0

我刚刚遇到同样的问题。你设法解决它吗? –

+0

其实我无法付出太多的努力...并且发现了一个工作,只是为了完成我在那个时候给出的任务。 但是,如果你找到一些解决方案并与我分享,那将会很棒。 –

回答

0

使用WinSCP连接Guest虚拟机。从主机复制VBoxGuestAddition.iso。在我的情况下,VBoxGuestAddition出现在C:\ ProgramFiles \ Oracle \ VirtualBox中。

一旦将iso文件复制到Guest VM,使用putty登录到GUest VM。

mkdir /media/GuestAdditionsISO 

然后执行以下命令

mount -o loop /path/of/VBoxGuestAddition.iso /media/GuestAdditionsISO 

一旦mount命令成功执行,

cd /media/GuestAdditionsISO 
sudo ./VBoxLinuxGuestAddition.run 

然后重新启动VM。这适用于我