oracle - Vagrant GuestAdditions 似乎已正确安装 (5.1.20),但未运行

标签 oracle vagrant virtual-machine virtualbox

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

但每次我尝试启动我的 Vagrant 时,我都会收到以下错误消息。

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 版本是最新的。
Vagrant 版本:Vagrant 1.9.3
Windows 版本:Windows 7 Enterprise Service Pack 1
Oracle VirtualBox 版本:版本 5.1.20 r114628 (Qt5.6.2)

在运行命令 vbguest status 我得到

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

我的 vagrant 文件内容是

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

最佳答案

使用 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

一旦挂载命令成功执行,

cd /media/GuestAdditionsISO
sudo ./VBoxLinuxGuestAddition.run

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

关于oracle - Vagrant GuestAdditions 似乎已正确安装 (5.1.20),但未运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45695595/

相关文章:

Oracle:ROWID 是 NUMBER 还是 VARCHAR?

php - Oracle select,如何在PHP中访问 'where exists'子查询中的值?

Oracle组合键删除速度很慢

vagrant - 直接从克隆的存储库使用 puppet 模块

java - SQL 合并与 Java 中的检查和插入/更新

php - 从一个虚拟机实例到另一台虚拟机 (Vagrant) 的 Curl 请求似乎不起作用

bash - docker 如何在运行容器中运行bash\ssh(运行-d)?

ubuntu - 是否有任何解决方案可以访问 Google Cloud Platform 中 VM 实例中的用户帐户密码

linux - 2 个 wifi 适配器连接到 2 个独立的网络。如何只使用其中之一?

linux - 如何从另一个 TC Agent 复制现有 JVM,并创建专用 Java 安装来运行本地代理