gpt4 book ai didi

windows-10 - 如何让 Vagrant Homestead 使用 Hyper-V 启动

转载 作者:行者123 更新时间:2023-12-04 11:46:10 24 4
gpt4 key购买 nike

我无法使用此处提供的说明启动宅基地 https://laravel.com/docs/5.7/homestead使用 super V。最初的问题是机器无法启动,它会无限期地挂起。一旦我解决了这个问题,我在完成 vagrant up 命令之前又遇到了 2 个。

我不是 100% 确定这是发布此内容的正确位置,但我已经花了大约 2 周的时间来尝试解决此问题,如果其他人遇到类似问题,我希望我可以为他们节省一点时间。我可以使用 virtual-box 使用 homestead,但是在我的 PC 上没有运行 Hyper-V 非常不方便,所以我卸载了 virtual-box 并尝试使用 Hyper-V 设置 homestead。对我来说,VM 根本无法启动。当我在 Hyper-V 管理器中查看它时,它只是在启动时挂起。事实证明,它被设置为第 1 代盒子,驱动器连接为 IDE。对我来说,解决方案是创建新一代 2 VM 并使用 SCSI 连接提供的驱动器。然后我禁用了安全启动,我能够启动。然后它在配置脚本尝试挂载默认 vagrant 共享期间失败。我不知道如何修改这个调用,所以最终禁用了它,因为据我所知,宅基地不需要它。然后我的第三个问题是无法在 homestead.yaml 文件中挂载任何用户定义的共享。对此进行的一些谷歌搜索表明,我需要在没有其他参数的情况下进行此调用,而脚本似乎没有提供选项。我修改了脚本,整个 vagrant up 命令成功完成。以下是我采取的步骤的详细信息。如果有更简单的方法让 Vagrant Homestead 使用 Hyper-V 运行,我将不胜感激。

问题 1:无法启动

说明:问题似乎是试图使用 IDE Controller 作为第 1 代启动。这对于我安装的 Windows 10 Pro 似乎不起作用。

分辨率:

1. Created a new VM using Generation 2 and attached the existing 
"ubuntu-18.04-amd64.vhdx" to it using SCSI.

2. Boot this VM and then shutdown.

3. Turn off secure boot

4. Replace the Virtual machine files in [VagrantInstallFolder]\boxes\laravel-VAGRANTSLASH-homestead\6.4.0\hyperv with the new ones created above.

5. Delete newly created box from HyperV

问题 2:不会挂载默认的 Vagrant 共享

错误消息:
==> homestead-7:机器启动并准备就绪!
未向 NFS 同步文件夹实现提供有效 ID
修剪。这是 Vagrant 的内部错误,应该是一个问题
提交。

说明: vagrant up 命令在尝试挂载默认的 vagrant 共享时失败。我发现无法覆盖此调用的参数,因此它总是尝试使用 Windows 不支持的 nfs 进行调用。如果可以覆盖此调用设置,那么这将是更可取的方式。但我能找到的让配置脚本继续执行的唯一方法是禁用此共享。

分辨率:
1. Modify the scripts\homestead.rb file and add the code below to the
Hyper V config settings section "Configure A Few Hyper-V Settings". This
will disable the default file share but you can still add your own from
the homestead.yaml file after completion of issue 3.

#Disable the default Vagrant file share
config.vm.synced_folder ".", "/vagrant", disabled: true

问题 3:用户在 homestead.yaml 文件中定义的共享仍然错误。

错误消息:

无法在 Linux 客户机中装载文件夹。这通常是因为
“vboxsf”文件系统不可用。请确认
guest 添加已正确安装在 guest 中,并且
可以正常工作。尝试的命令是:

安装-t CIFS -o VERS = 3,凭证=的/etc/smb_creds_vgt-96269f65d23acb279735d26264428995-66f0bd5cbca4d218f5f0b8a5f1712727,UID = 1000,GID = 1000,NOLOCK,UDP,noatime的//192.168.1.107/vgt-96269f65d23acb279735d26264428995-66f0bd5cbca4d218f5f0b8a5f1712727/家/Vagrant/代码

最后一条命令的错误输出是:

安装错误(22):无效的参数
请参阅 mount.cifs(8) 手册页(例如 man mount.cifs)

说明: vagrant up 命令在尝试在 homestead.yaml 文件中挂载用户定义的共享时失败。 mount 似乎将不需要的参数传递给 mount 命令。我们需要覆盖 scripts\homestead.rb 文件中的挂载调用以不使用参数。

分辨率:
1. In the "Register All Of The Configured Shared Folders" section replace the line below. 

Replace
config.vm.synced_folder folder['map'], folder['to'], type: folder['type'] ||= nil, **options

With
config.vm.synced_folder folder['map'], folder['to'], type: "smb"

2. Then run "vagrant up --provider hyperv"

最佳答案

安装了哪些 Vagrant 插件 ( vagrant plugin list )
我收到以下错误:

No valid IDs were given to the NFS synced folder implementation to prune. This is an internal bug with Vagrant and an issue should be filed.


以前我一直在使用 NFS 并安装了以下插件 https://github.com/winnfsd/vagrant-winnfsd .
一旦我通过 vagrant pluugin uninstall vagrant-winnfsd 删除了插件,配置工作。

关于windows-10 - 如何让 Vagrant Homestead 使用 Hyper-V 启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54064663/

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