我在 ubuntu 18.4 上安装了Vagrant 2.2.4
。默认情况下,vagrant配置位置在/home/groot/.vagrant.d
目录中。由于使用ssd,我不得不在hdd中更改此位置,因此我将 .vagrant.d 移到了vagrant_home
名称的其他位置。我的硬盘分区的文件系统为NTFS
,所以我将insecure_private_key
文件保留在先前的位置:
groot@groot-Product:/media/groot/3008CF6808CF2BA2$ ls -l
drwxrwxrwx 1 groot groot 4096 Jun 17 21:56 vagrant_home
groot@groot-Product:/media/groot/3008CF6808CF2BA2$ cd vagrant_home/
groot@groot-Product:/media/groot/3008CF6808CF2BA2/vagrant_home$ ls -l
total 5
drwxrwxrwx 1 groot groot 0 Jun 17 19:03 boxes
drwxrwxrwx 1 groot groot 4096 Jun 17 21:50 data
drwxrwxrwx 1 groot groot 0 Jun 14 16:23 gems
lrwxrwxrwx 1 groot groot 43 Jun 17 20:03 insecure_private_key -> /home/groot/.vagrant.d/insecure_private_key
drwxrwxrwx 1 groot groot 0 Jun 14 16:23 rgloader
-rwxrwxrwx 1 groot groot 3 Jun 14 16:23 setup_version
drwxrwxrwx 1 groot groot 0 Jun 14 19:13 tmp
groot@groot-Product:/media/groot/3008CF6808CF2BA2/vagrant_home$
groot@groot-Product:~/.vagrant.d$ ls -l
total 4
-rw------- 1 groot groot 1675 Jun 14 16:23 insecure_private_key
groot@groot-Product:~/.vagrant.d$
因此,我创建了此文件到vagrant_home
文件夹的链接。接下来,我将无业游民的可变环境更改为新位置:
$ echo $VAGRANT_HOME
/media/groot/3008CF6808CF2BA2/vagrant_home
这些是无聊的盒子: $无业游民的盒子列表
Microsoft/EdgeOnWindows10 (virtualbox, 1.0)
dangelov/ubuntu-18.4-minimal (virtualbox, 18.4-minimal)
在初始化Microsoft/EdgeOnWindows10
框并up
之后,它出现了Authentication failure
错误:
groot@groot-Product:/media/groot/3008CF6808CF2BA2/Vagrant$ vagrant init Microsoft/EdgeOnWindows10
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
groot@groot-Product:/media/groot/3008CF6808CF2BA2/Vagrant$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'Microsoft/EdgeOnWindows10' version '1.0' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Vagrant has detected a configuration issue which exposes a
==> default: vulnerability with the installed version of VirtualBox. The
==> default: current guest is configured to use an E1000 NIC type for a
==> default: network adapter which is vulnerable in this version of VirtualBox.
==> default: Ensure the guest is trusted to use this configuration or update
==> default: the NIC type using one of the methods below:
==> default:
==> default: https://www.vagrantup.com/docs/virtualbox/configuration.html#default-nic-type
==> default: https://www.vagrantup.com/docs/virtualbox/networking.html#virtualbox-nic-type
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> 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: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
在谷歌搜索之后,我发现有些人建议与 vagrant ssh 建立联系:
groot@groot-Product:/media/groot/3008CF6808CF2BA2/Vagrant$ vagrant ssh
vagrant@127.0.0.1's password:
vagrant@127.0.0.1's password:
vagrant@127.0.0.1's password:
vagrant@127.0.0.1: Permission denied (publickey,password,keyboard-interactive).
我输入的密码是 vagrant ,但似乎不正确。这是ssh config:
groot@groot-Product:/media/groot/3008CF6808CF2BA2/Vagrant$ vagrant ssh-config
Host default
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /media/groot/3008CF6808CF2BA2/vagrant_home/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
我看到了virtualBox
网络接口,它连接到 Nat 。
所以我决定更换盒子,但出现其他错误:
groot@groot-Product:/media/groot/3008CF6808CF2BA2/Vagrant$ vagrant destroy
default: Are you sure you want to destroy the 'default' VM? [y/N] yes
default: Are you sure you want to destroy the 'default' VM? [y/N] y
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
groot@groot-Product:/media/groot/3008CF6808CF2BA2/Vagrant$ vagrant init dangelov/ubuntu-18.4-minimal
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
groot@groot-Product:/media/groot/3008CF6808CF2BA2/Vagrant$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'dangelov/ubuntu-18.4-minimal'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'dangelov/ubuntu-18.4-minimal' version '18.4-minimal' is up to date...
==> default: Setting the name of the VM: Vagrant_default_1560793456050_4214
==> default: Vagrant has detected a configuration issue which exposes a
==> default: vulnerability with the installed version of VirtualBox. The
==> default: current guest is configured to use an E1000 NIC type for a
==> default: network adapter which is vulnerable in this version of VirtualBox.
==> default: Ensure the guest is trusted to use this configuration or update
==> default: the NIC type using one of the methods below:
==> default:
==> default: https://www.vagrantup.com/docs/virtualbox/configuration.html#default-nic-type
==> default: https://www.vagrantup.com/docs/virtualbox/networking.html#virtualbox-nic-type
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> 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...
The private key to connect to this box via SSH has invalid permissions
set on it. The permissions of the private key should be set to 0600, otherwise SSH will
ignore the key. Vagrant tried to do this automatically for you but failed. Please set the
permissions on the following file to 0600 and then try running this command again:
/media/groot/3008CF6808CF2BA2/vagrant_home/boxes/dangelov-VAGRANTSLASH-ubuntu-18.4-minimal/18.4-minimal/virtualbox/vagrant_private_key
Note that this error occurs after Vagrant automatically tries to
do this for you. The likely cause of this error is a lack of filesystem
permissions or even filesystem functionality. For example, if your
Vagrant data is on a USB stick, a common case is that chmod is
not supported. The key will need to be moved to a filesystem that
supports chmod.
groot@groot-Product:/media/groot/3008CF6808CF2BA2/Vagrant$
出什么问题了?