当我运行 vagrant up 在 Lion 上配置新的 VM 时,它需要很长时间,在此期间整个 Mac 非常滞后且无响应。
输出如下,重点是“通知:目录运行已在 754.28 秒内完成”
> vagrant up
[default] Importing base box 'lucid64'...
[default] The guest additions on this VM do not match the install version of
VirtualBox! This may cause things such as forwarded ports, shared
folders, and more to not work properly. If any of those things fail on
this machine, please update the guest additions and repackage the
box.
Guest Additions Version: 4.1.0
VirtualBox Version: 4.1.6
[default] Matching MAC address for NAT networking...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- ssh: 22 => 2222 (adapter 1)
[default] -- web: 80 => 4567 (adapter 1)
[default] Creating shared folders metadata...
[default] Running any VM customizations...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Mounting shared folders...
[default] -- v-root: /vagrant
[default] -- v-data: /var/www
[default] -- manifests: /tmp/vagrant-puppet/manifests
[default] Running provisioner: Vagrant::Provisioners::Puppet...
[default] Running Puppet with lucid64.pp...
[default] stdin: is not a tty
[default] notice: /Stage[main]/Lucid64/Exec[apt-update]/returns: executed successfully
[default]
[default] notice: /Stage[main]/Lucid64/Package[apache2]/ensure: ensure changed 'purged' to 'present'
[default]
[default] notice: /Stage[main]/Lucid64/File[/etc/motd]/ensure: defined content as '{md5}a25e31ba9b8489da9cd5751c447a1741'
[default]
[default] notice: Finished catalog run in 754.28 seconds
[default]
[default] err: /File[/var/lib/puppet/rrd]/ensure: change from absent to directory failed: Could not find group puppet
[default]
[default] err: Could not send report: Got 1 failure(s) while initializing: change from absent to directory failed: Could not find group puppet
[default]
[default] Running provisioner: Vagrant::Provisioners::Puppet...
[default] Running Puppet with lucid64.pp...
[default] stdin: is not a tty
[default] notice: /Stage[main]/Lucid64/Exec[apt-update]/returns: executed successfully
[default]
[default] notice: Finished catalog run in 2.05 seconds
[default]
[default] err: /File[/var/lib/puppet/rrd]: Could not evaluate: Could not find group puppet
[default]
[default] err: Could not send report: Got 1 failure(s) while initializing: Could not evaluate: Could not find group puppet
[default]
[default] Running provisioner: Vagrant::Provisioners::Puppet...
[default] Running Puppet with lucid64.pp...
[default] stdin: is not a tty
[default] notice: /Stage[main]/Lucid64/Exec[apt-update]/returns: executed successfully
[default]
[default] notice: Finished catalog run in 1.36 seconds
[default]
[default] err: /File[/var/lib/puppet/rrd]: Could not evaluate: Could not find group puppet
[default]
[default] err: Could not send report: Got 1 failure(s) while initializing: Could not evaluate: Could not find group puppet
[default]
>
鉴于症状和输出,下一步该怎么做才能解决我所看到的性能问题?
答案1
我设法通过在客户虚拟机上启用主机 I/O 缓存来解决此问题。
- 启动虚拟机然后运行
vagrant halt
- 打开 VirtualBox 并使用 GUI 更改设置以启用 SATA 控制器的主机 I/O 缓存。
- 重新打包基础盒子:vagrant package。
- 移除并重新添加基本框:
vagrant box remove <box>; vagrant box add <box> package.box
(来源)
答案2
哇,这真是一段漫长的路程。
我不确定为什么 Vagrant 会运行三次 Puppet。应该只有一 [default] Running provisioner: Vagrant::Provisioners::Puppet...
行。检查你的 Vagrantfile 是否有任何重复的config.vm.provision :puppet
行。
在 Vagrantfile 中的配置行中添加以下选项可能有助于进一步解决问题。它将显示 Puppet 在运行期间认为正在发生的事情。
config.vm.provision :puppet, :options => "--verbose --debug"