流浪灰:sudo:未找到 [英] vagrant ash: sudo: not found

查看:50
本文介绍了流浪灰:sudo:未找到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我用一个 15MB 的 Busybox 小图片启动我的 vagrant box 时,我第一次在这个阶段遇到错误

When starting my vagrant box with a small 15MB Busybox image, the first time I get an error during the phase

Mounting shared folders...

似乎 vagrant 正在尝试使用 sudo 进行一些操作,但尚未安装.我收到此错误:

It seems vagrant is trying something with sudo, which isn't istalled. I get this error:

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mkdir -p /vagrant

Stdout from the command:



Stderr from the command:

ash: sudo: not found

到目前为止它有效,我可以使用密码vagrant以root身份登录,但我想这不完美?

It works so far, I can login as root with the password vagrant, but I guess this is not perfect?

这是我的设置:https://github.com/rubo77/ffnord-example/blob/pyddhcpd/Vagrantfile

  config.ssh.username = 'root'
  config.ssh.password = 'vagrant'
  config.ssh.insert_key = 'true'
  config.ssh.shell = 'ash'
  (0..9).each do |i|
        config.vm.define "gc-node0#{i}" do |node|
        end
  end

推荐答案

默认情况下 vagrant 将目录 /vagrant (guest) 与当前项目目录共享/同步,该目录包含 Vagrantfile(host),使用config.vm.synced_folder可以共享更多目录,不知道是否可以禁用默认的/vagrant.

By default vagrant share/sync the directory /vagrant (guest) with the current project directory, the one containing the Vagrantfile (host), more directories can be shared using config.vm.synced_folder, I don't know if the default /vagrant can be disabled.

如果您不使用共享目录功能,那么缺少的 sudo 不是问题.

If you aren't using the shared directories feature then the missing sudo isn't a problem.

如果你的文件系统是可写的,你可以创建一次 /vagrant 目录,所以接下来 up vagrant 不应该尝试 sudo mkdir 再次;

If your filesystem is writeable you can create the /vagrant directory once, so on next up vagrant shouldn't try to sudo mkdir again;

但是假设您使用的是 VirtualBox(我不知道其他模拟器行为/架构)您将面临另一个问题,共享目录需要内核模块vboxsfvboxguest(来自 VirtualBox Guest Additions)要构建(针对正在运行的内核源代码)和加载(insmod),以及命令 mount.vboxsf 要在 /sbin 中构建和安装,加上你的 busybox 需要启用选项 mount helpers 因为 vagrant 使用 mount -t vboxsf 而不是mount.vboxsf 直接,当 vagrant 尝试挂载共享目录并且这些要求不匹配时,在失败之前会出现很长时间的超时错误(一分钟/两分钟或更长时间).

but assuming you're using VirtualBox (I don't know about others emulator behavior/architecture) you'll face another problem, shared directories require the kernel modules vboxsf and vboxguest (from VirtualBox Guest Additions) to be built (against the running kernel sources) and loaded (insmod), and the command mount.vboxsf to be built and installed in /sbin, plus your busybox require the option mount helpers enabled because vagrant use mount -t vboxsf and not mount.vboxsf directly, when vagrant try to mount the shared directories and those requirements aren't matched there is a long timeout before failing with error (a minute/two or more).

请注意,busybox(当前稳定版)支持sudo,默认情况下是禁用的.

Notice that busybox (current stable) support sudo, is just disabled by default.

如果您自己从来源构建buildroot,我可以看出共享 功能有效(我设法让一个带有 busybox 的图像像 vagrant 期望的那样工作),如果你使用的是一些预先构建的内核/busybox……可能是一个问题,你必须为 vboxsf 找到匹配的二进制文件vboxguestmount.vboxsf 并且如果 mount helpers 选项在您的 busybox 中被禁用,您需要找到一个解决方法(也许修改 vagrant 使用 mount.vboxsf).

If you're building the buildroot yourself from sources I can tell that the shared feature works (I managed to get an image with busybox to work as vagrant expect), if you're using some pre-built kernel/busybox... may be a problem, you have to find matching binaries for vboxsf, vboxguest, mount.vboxsf and if the mount helpers option is disabled in your busybox you need to find a workaround (perhaps modifying vagrant to use mount.vboxsf).

这篇关于流浪灰:sudo:未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆