【问题标题】:Vagrant fails to properly boot box after host reboot, causes mount errors主机重启后 Vagrant 无法正确启动盒子,导致挂载错误
【发布时间】:2014-09-11 16:13:55
【问题描述】:

总结

我的 Arch Linux 主机上有一个带有 Ubuntu 14.04 的 Vagrant 盒子。当supervisord在guest端运行时无法正常启动,如果不手动使用vagrant halt,主机会杀死每次主机关闭时完成的virtualbox进程。

问题

当我创建机器时,vagrant upvagrant halt && vagrant up 工作正常。我挂载了一个共享文件夹,该文件夹由框中的某些服务使用。 这是成功的输出

==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> 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: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /myproject => /home/myuser/myproject
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: to force provisioning. Provisioners marked to run always will still run.

当我重新启动主机 vagrant 拒绝再安装文件夹并给我以下错误:

==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> 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: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /myproject => /home/myuser/myproject
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` myproject /myproject
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` myproject /myproject

这是 Vagrantfilehttp://pastebin.com/DCMMrUym

详细输出

这是成功引导的dmesg 的最后几行(vagrant upvagrant halt && vagrant up):

[    4.721766] vboxvideo: Unknown symbol drm_open (err 0)
[    4.721768] vboxvideo: Unknown symbol drm_poll (err 0)
[    4.721770] vboxvideo: Unknown symbol drm_pci_init (err 0)
[    4.721772] vboxvideo: Unknown symbol drm_ioctl (err 0)
[    4.721774] vboxvideo: Unknown symbol drm_vblank_init (err 0)
[    4.721775] vboxvideo: Unknown symbol drm_mmap (err 0)
[    4.721776] vboxvideo: Unknown symbol drm_pci_exit (err 0)
[    4.721778] vboxvideo: Unknown symbol drm_release (err 0)
[    4.986464] init: udev-fallback-graphics main process (889) terminated with status 1
[    5.051943] vboxsf: Successfully loaded version 4.3.10_Ubuntu (interface 0x00010004)
[    6.992684] init: plymouth-upstart-bridge main process (180) killed by TERM signal

完整输出:http://pastebin.com/cktKJBZT


然后我 grep 为“virtualbox”并终止该机器的进程。或者我只是重新启动我的主机而不使用vagrant halt,这是主要用例。

这是下一个vagrant updmesg 输出:

[    5.408971] vboxvideo: Unknown symbol drm_open (err 0)
[    5.408973] vboxvideo: Unknown symbol drm_poll (err 0)
[    5.408974] vboxvideo: Unknown symbol drm_pci_init (err 0)
[    5.408977] vboxvideo: Unknown symbol drm_ioctl (err 0)
[    5.408978] vboxvideo: Unknown symbol drm_vblank_init (err 0)
[    5.408980] vboxvideo: Unknown symbol drm_mmap (err 0)
[    5.408981] vboxvideo: Unknown symbol drm_pci_exit (err 0)
[    5.408983] vboxvideo: Unknown symbol drm_release (err 0)
[    5.694825] init: udev-fallback-graphics main process (889) terminated with status 1

完整输出:http://pastebin.com/mgECtZBH

如您所见,最后两行不见了:

vboxsf: Successfully loaded version 4.3.10_Ubuntu (interface 0x00010004)
init: plymouth-upstart-bridge main process (180) killed by TERM signal

当我通过 VirtualBox GUI 打开盒子时,我在第一次尝试时会收到登录提示。杀死 virtualbox 进程(或重新启动主机)后,它挂在以下行,而没有给我登录提示。这是输出的最后几行:

* Starting early crypto disks...
  ...done.
* Starting AppArmor profiles
Skipping profile inn /etc/apparmor.d/disable: usr.sbin.rsyslogd
  ...done.
* modprobe vboxvideo failed. Please use 'dmesg' to find out why
  ...fail!
* Setting up X socket directories...
  ...done.
ssty: standard input: Input/output error
* Not starting NFS kernel daemon: no exports

然后它只是无限等待。

第一种方法

我认为可能是 supervisor 造成了这种情况,因此我删除了 supervisord 的初始开头。在终止进程(或重新启动主机)并且完全没有问题或错误之后,一切都启动并安装得很好。 无需启动 supervisord,一切都会按预期进行。

supervisord 进程启动几个服务:

  1. Redis
  2. MongoDB
  3. Nginx
  4. 弹性搜索
  5. PostgreSQL
  6. 龙卷风
  7. 芹菜

这些进程使用我主机上的上述共享文件夹。

我还没有尝试隔离其中一项服务。

对如何解开这个谜题有任何见解或想法吗?

【问题讨论】:

    标签: ubuntu vagrant boot mount supervisord


    【解决方案1】:

    我尝试停用每个使用的服务并将其范围缩小到 nginx。特别是我的自定义nginx.conf

    关键是要开启 daemon 参数。只需将daemon off; 替换为daemon on;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-30
      • 1970-01-01
      • 2013-08-08
      • 1970-01-01
      • 1970-01-01
      • 2017-07-29
      • 2017-09-18
      • 1970-01-01
      相关资源
      最近更新 更多