gpt4 book ai didi

Laravel Vagrant Up SSH 问题

转载 作者:行者123 更新时间:2023-12-04 23:39:57 27 4
gpt4 key购买 nike

我正在尝试在宅基地 Vagrant 的帮助下创建一个 Laravel 应用程序。我正在使用 Windows 7 开发环境。我正在使用按项目安装,并且我在 Laravel 文档中可以vagrant up my project .当我在我的项目中 Vagrant 时,我会挂断电话

SSH auth method: password



我收到以下消息:
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

我正在使用 Laravel 5.3 和 Vagrant 1.9.0。我使用的是 Vagrant 1.8.4,但是一旦我开始遇到问题,我就安装了 Vagrant 1.9.0,但收到了完全相同的错误。我尝试了 here 的以下修复,并且从 vb.gui 我可以从启动的服务器中看到以下错误:
[   0.100000] Failed to access perfctr msr (MSR c0010007 is 0)
lvmetad is not active yet, using direct activation during sysinit
lvmetad is not active yet, using direct activation during sysinit
Scanning for Btrfs filesystems
/dev/mapper/vagrant--vg-root:clean, 127066/2559088 files, 1241443/10228736 blocks
[ 10.420196] piix4_smbus 0000:00:07.0: SMBus base address uninitialized - updrade BIOS or use force_addr=0xadr
[ ] A start jon is running for Raise network interfaces (4 min 44s / 5min 5 s)

然后服务器启动,我可以登录,但是我的 Homestead.yaml 文件中的文件夹和 IP 未在服务器上设置。

这是我的 Homestead.yaml 文件:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
hostname: mysite
name: mysite
provider: virtualbox

authorize: C:/Users/xxx/.ssh/id_rsa.pub

keys:
- C:/Users/xxx/.ssh/id_rsa

folders:
- map: "C:/Users/xxx/www/mysite"
to: "/home/vagrant/mysite"

sites:
- map: homestead.app
to: "/home/vagrant/mysite/public"

databases:
- homestead

当实例正在运行并且我运行时:
vagrant ssh-config

我明白了
Host mysite
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes

当我运行时:
vagrant global-status

我得到:
id       name   provider   state   directory
-----------------------------------------------------------------------
66eb5bf mysite virtualbox running C:/Users/xxx/www/mysite

当我尝试使用以下方法从 vagrant 获取 degub 信息时:
vagrant up --debug > vdebug.txt

在命令提示符中生成大量消息,但仅在 vdebug.txt 文件中:
Bringing machine 'mysite' up with 'virtualbox' provider...
==> mysite: Importing base box 'laravel/homestead'...

[KProgress: 20%
[KProgress: 30%
[KProgress: 60%
[KProgress: 70%
[KProgress: 90%
[K==> mysite: Matching MAC address for NAT networking...
==> mysite: Checking if box 'laravel/homestead' is up to date...
==> mysite: Setting the name of the VM: mysite
==> mysite: Clearing any previously set network interfaces...
==> mysite: Preparing network interfaces based on configuration...
mysite: Adapter 1: nat
mysite: Adapter 2: hostonly
==> mysite: Forwarding ports...
mysite: 80 (guest) => 8000 (host) (adapter 1)
mysite: 443 (guest) => 44300 (host) (adapter 1)
mysite: 3306 (guest) => 33060 (host) (adapter 1)
mysite: 5432 (guest) => 54320 (host) (adapter 1)
mysite: 22 (guest) => 2222 (host) (adapter 1)
==> mysite: Running 'pre-boot' VM customizations...
==> mysite: Booting VM...
==> mysite: Waiting for machine to boot. This may take a few minutes...
mysite: SSH address: 127.0.0.1:2222
mysite: SSH username: vagrant
mysite: SSH auth method: password

如果你完成了这篇文章,谢谢!我的问题是如何从我的 Homestead.yaml 文件中获取我的 IP 和文件夹到服务器。任何帮助将不胜感激。如果我可以添加更多信息,请告诉我。我会及时通知你我的状态。

编辑 1

我忘了补充说我已经启用了虚拟化。

编辑 2

我更改了我的项目文件夹中的 Homestead.yaml 文件,将 IP 设置为 192.168.10.20 而不是 192.168.10.10,但仍然没有更改。我会继续更新,直到我有答案。

编辑 3

尝试更改位于我的项目文件夹中的 Vagrantfile 以在 Vagrant.configure 函数中添加以下内容:
config.vm.network "public_network", ip: "192.168.10.20", :bridge => "en1: Realtek PCIe GBE Family Controller #2"

我收到了同样的错误,但我也收到了这个:
Specific bridge 'en1: Realtek PCIe GBE Family Controller #2' not found. You may be asked to specify
which network to bridge to.

最佳答案

发生此错误是因为 Ubuntu 尝试启动所有网络接口(interface),但您的电缆未连接,然后它一直等到此超时。

导出 VM 时似乎会出现此问题,有关 https://www.virtualbox.org/ticket/15705 的更多信息

你可以编辑你的 Vagrantfile 并在 Vagrant.configure 循环的末尾添加这些行:

 config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--cableconnected1", "on"]
end

基本上在最后一个“结束”之前添加这个。

关于Laravel Vagrant Up SSH 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40960545/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com