windows 安装vagrant reload 失败; No Virtualbox Guest Additions installation found.

问题描述:已经安装vagrant-vbguest 插件,且版本为0.30,使用的box 为centos7

 http://cloud.centos.org/centos/7/vagrant/x86_64/images/CentOS-7.box

报错信息:报错挂载出错,通过vagrant ssh 可以登录虚拟机,但共享目录不同步。

D:\vagrant\default>vagrant reload
==> default: You assigned a static IP ending in ".1" to this machine.
==> default: This is very often used by the router and can cause the
==> default: network to not work properly. If the network doesn't work
==> default: properly, try changing this IP.
==> default: Attempting graceful shutdown of VM...
==> default: You assigned a static IP ending in ".1" to this machine.
==> default: This is very often used by the router and can cause the
==> default: network to not work properly. If the network doesn't work
==> default: properly, try changing this IP.
==> 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: 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: Machine booted and ready!
[default] No Virtualbox Guest Additions installation found.
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.bfsu.edu.cn
 * extras: mirrors.bfsu.edu.cn
 * updates: mirrors.huaweicloud.com
Package centos-release-7-9.2009.1.el7.centos.x86_64 already installed and latest version
Nothing to do
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.bfsu.edu.cn
 * extras: mirrors.bfsu.edu.cn
 * updates: mirrors.huaweicloud.com
No package kernel-devel-3.10.0-1127.el7.x86_64 available.
Error: Nothing to do
Unmounting Virtualbox Guest Additions ISO from: /mnt
umount: /mnt: not mounted
==> default: Checking for guest additions in VM...
    default: No guest additions were detected on the base box for this VM! Guest
    default: additions are required for forwarded ports, shared folders, host only
    default: networking, and more. If SSH fails on this machine, please install
    default: the guest additions and repackage the box to continue.
    default:
    default: This is not an error message; everything may continue to work properly,
    default: in which case you may ignore this message.
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

umount /mnt

Stdout from the command:



Stderr from the command:

umount: /mnt: not mounted

vagrantFile 内容;

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

# 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://vagrantcloud.com/search.
  config.vm.box = "centos-7-20210729"
  #config.vm.boot_timeout = 360
  #config.ssh.username = "vagrant"
  #config.ssh.password = "vagrant"

  # 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.
  # NOTE: This will enable public access to the opened port
  # config.vm.network "forwarded_port", guest: 80, host: 8080

  #config.vm.network "forwarded_port", guest: 80, host: 8080
  #config.vm.network "forwarded_port", guest: 22, host: 2222
  #config.vm.network "forwarded_port", guest: 3306, host: 3306
  #config.vm.network "forwarded_port", guest: 6379, host: 6379
  #config.vm.network "forwarded_port", guest: 11211, host: 11211

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine and only allow access
  # via 127.0.0.1 to disable public access
  # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  # config.vm.network "private_network", ip: "192.168.33.10"
    config.vm.network "private_network", ip: "192.168.56.1"
  # 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"
  config.vm.synced_folder "./wwwroot", "/home/wwwroot/", owner: "vagrant", groupe: "vagrant", mount_options: ["dmode=777", "fmode=777"]

  #config.vm.synced_folder '.', '/vagrant', disabled: true
  #config.vm.synced_folder "D:/vagrant/default/wwwroot/", "/home/wwwroot/",
  #owner: "root", group: "root",
  #type: "rsync",
 # rsync__exclude: ".git/",
  #rsync__args: ["--verbose", "--rsync-path='sudo rsync'", "--archive", "--delete", "-z"]
 # type: "smb", smb_host: "192.168.56.1", smb_username: "lxw",smb_password: "123456", mount_options: ["username=lxw","password=123456"]
 #type:"rsync" #,nfs: true,  nfs_udp: true

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

  # Enable provisioning with a shell script. Additional provisioners such as
  # Ansible, Chef, Docker, Puppet and Salt 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

  Vagrant::Config.run do |config|
    # we will try to autodetect this path.
    # However, if we cannot or you have a special one you may pass it like:
    # config.vbguest.iso_path = "#{ENV['HOME']}/Downloads/VBoxGuestAdditions.iso"
    # or an URL:
    # config.vbguest.iso_path = "http://company.server/VirtualBox/%{version}/VBoxGuestAdditions.iso"
    # or relative to the Vagrantfile:
    # config.vbguest.iso_path = "../relative/path/to/VBoxGuestAdditions.iso"

    # set auto_update to false, if you do NOT want to check the correct
    # additions version when booting this machine
    config.vbguest.auto_update = false

    # do NOT download the iso file from a webserver
    config.vbguest.no_remote = true
  end
end

 哪里的问题?

解决方法步骤

1.卸载掉原来的vagrant-vbguest 插件 ,因为我原来的插件是0.30版本有问题,更换低版本插件

vagrant plugin uninstall vagrant-vbguest

2.安装兼容的插件版本 

vagrant plugin install vagrant-vbguest --plugin-version 0.21

 3.销毁原来的 镜像

vagrant destroy -f

4.启动虚拟机

vagrant up --color

启动成功。

参考:解答一个使用Vagrant时遇到的错误——vagrant-vbguest插件

超详细的 Vagrant 上手指南

posted @ 2021-07-30 12:28  码农编程进阶笔记  阅读(474)  评论(0编辑  收藏  举报
返回顶部 有事您Q我