【问题标题】:Vagrant GuestAdditions seems to be installed (5.1.20) correctly, but not runningVagrant GuestAdditions 似乎已正确安装(5.1.20),但未运行
【发布时间】:2017-08-15 14:59:32
【问题描述】:

我想将我的 Windows 机器上存在的整个文件夹复制到托管 ubuntu/trusty64 的虚拟机。

但每次我尝试让我的流浪者起来时,我都会收到以下错误消息。

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 Enterprise Service Pack 1
Oracle VirtualBox 版本:版本 5.1.20 r114628 (Qt5.6.2)

在运行命令 vbguest status 我得到 ​​p>

$ 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?

【问题讨论】:

  • 这似乎是您应该在the official Virtual box forum 上提出的问题。
  • 我刚刚遇到了同样的问题。你解决了吗?
  • 实际上我并没有为此付出太多努力......并且找到了解决方法来完成我当时给定的任务。但如果你能找到一些解决方案并与我分享,那就太好了。

标签: oracle vagrant virtual-machine virtualbox


【解决方案1】:

使用 WinSCP 连接来宾虚拟机。从主机复制 VBoxGuestAddition.iso。就我而言,C:\ProgramFiles\Oracle\VirtualBox 中存在 VBoxGuestAddition。

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

mkdir /media/GuestAdditionsISO

然后执行下面的命令

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

一旦挂载命令执行成功,

cd /media/GuestAdditionsISO
sudo ./VBoxLinuxGuestAddition.run

然后重新启动虚拟机。这对我有用

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-26
    • 1970-01-01
    • 2020-05-20
    • 2014-06-28
    • 2021-12-08
    • 2019-09-06
    相关资源
    最近更新 更多