vagrant up 报错,机器起不来

来源:4-1 本章概述和实验环境介绍

慕慕1392789

2020-11-19

chapter4$ vagrant up
Bringing machine ‘docker-node1’ up with ‘virtualbox’ provider…
Bringing machine ‘docker-node2’ up with ‘virtualbox’ provider…
==> docker-node1: Importing base box ‘centos/7’…
==> docker-node1: Matching MAC address for NAT networking…
==> docker-node1: Checking if box ‘centos/7’ version ‘2004.01’ is up to date…
==> docker-node1: Setting the name of the VM: chapter4_docker-node1_1605728954865_8390
==> docker-node1: Clearing any previously set network interfaces…
==> docker-node1: Preparing network interfaces based on configuration…
docker-node1: Adapter 1: nat
docker-node1: Adapter 2: hostonly
==> docker-node1: Forwarding ports…
docker-node1: 22 (guest) => 2222 (host) (adapter 1)
==> docker-node1: Running ‘pre-boot’ VM customizations…
==> docker-node1: Booting VM…
==> docker-node1: Waiting for machine to boot. This may take a few minutes…
docker-node1: SSH address: 127.0.0.1:2222
docker-node1: SSH username: vagrant
docker-node1: SSH auth method: private key
docker-node1:
docker-node1: Vagrant insecure key detected. Vagrant will automatically replace
docker-node1: this with a newly generated keypair for better security.
docker-node1:
docker-node1: Inserting generated public key within guest…
docker-node1: Removing insecure key from the guest if it’s present…
docker-node1: Key inserted! Disconnecting and reconnecting using new SSH key…
==> docker-node1: Machine booted and ready!
[docker-node1] No Virtualbox Guest Additions installation found.
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • base: mirrors.aliyun.com
  • extras: mirrors.aliyun.com
  • updates: mirrors.bfsu.edu.cn
    Resolving Dependencies
    –> Running transaction check
    —> Package centos-release.x86_64 0:7-8.2003.0.el7.centos will be updated
    —> Package centos-release.x86_64 0:7-9.2009.0.el7.centos will be an update
    –> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size

Updating:
centos-release x86_64 7-9.2009.0.el7.centos base 27 k

Transaction Summary

Upgrade 1 Package

Total download size: 27 k
Downloading packages:
No Presto metadata available for base
Public key for centos-release-7-9.2009.0.el7.centos.x86_64.rpm is not installed
warning: /var/cache/yum/x86_64/7/base/packages/centos-release-7-9.2009.0.el7.centos.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) security@centos.org"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package : centos-release-7-8.2003.0.el7.centos.x86_64 (@anaconda)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : centos-release-7-9.2009.0.el7.centos.x86_64 1/2
Cleanup : centos-release-7-8.2003.0.el7.centos.x86_64 2/2
Verifying : centos-release-7-9.2009.0.el7.centos.x86_64 1/2
Verifying : centos-release-7-8.2003.0.el7.centos.x86_64 2/2

Updated:
centos-release.x86_64 0:7-9.2009.0.el7.centos

Complete!
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • base: mirrors.aliyun.com
  • extras: mirrors.aliyun.com
  • updates: mirrors.bfsu.edu.cn
    No package kernel-devel-3.10.0-1127.el7.x86_64 available.
    Error: Nothing to do
    ==> docker-node1: Checking for guest additions in VM…
    docker-node1: No guest additions were detected on the base box for this VM! Guest
    docker-node1: additions are required for forwarded ports, shared folders, host only
    docker-node1: networking, and more. If SSH fails on this machine, please install
    docker-node1: the guest additions and repackage the box to continue.
    docker-node1:
    docker-node1: This is not an error message; everything may continue to work properly,
    docker-node1: 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!

yum install -y kernel-devel-uname -r

Stdout from the command:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

Stderr from the command:

Error: Nothing to do

写回答

4回答

麦兜搞IT

2020-11-24

或者您试试这样。

  1. 先vagrant halt停掉机器

  2. 再vagrant destroy删除机器

  3. 把Vagrantfile里这一行删除  config.vm.provision "shell", privileged: true, path: "./setup.sh"

  4. vagrant up重新启动机器

  5. vagrant ssh docker-node1 和docker-node2进入机器,手动运行我们源码里的setup.sh去安装docker

0
0

麦兜搞IT

2020-11-24

而且我使用的centos box版本和你的是一样的

vagrant box list

centos/7            (virtualbox, 2004.01)


0
0

麦兜搞IT

2020-11-24

您好,麻烦您把您的运行环境详细描述一下,什么机器,系统。我这里刚刚又使用提供给大家的vagrantfile重新vagrant up了一遍,没有任何问题啊。


Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: mirror.nforce.com

 * extras: mirror.hostnet.nl

 * updates: mirror.sitbv.nl

Resolving Dependencies

--> Running transaction check

---> Package kernel-devel.x86_64 0:3.10.0-1127.el7 will be installed



Installed:

  kernel-devel.x86_64 0:3.10.0-1127.el7


0
0

麦兜搞IT

2020-11-20

您好,您通过vagrant status能看到机器是up的么?还是其它的状态?

0
0

系统学习Docker 践行DevOps理念

无论你是开发、测试还是运维,Docker都是你的必备技能。

3297 学习 · 1895 问题

查看课程