流浪灰:sudo:未找到

时间:2015-07-01 23:48:04

标签: vagrant busybox

在使用15MB Busybox小图片启动我的流浪盒时,我第一次在阶段遇到错误

Mounting shared folders...

似乎流浪汉正在尝试使用sudo,而不是sudoled。我收到这个错误:

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身份登录,但我猜这不完美?

这是我的设置: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

1 个答案:

答案 0 :(得分:0)

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

如果您没有使用共享目录功能,则缺少sudo不是问题。

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

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

请注意,busybox(当前稳定)支持mount.vboxsf,默认情况下只是禁用。

如果您是从源代码构建buildroot,我可以告诉您共享功能正常工作(我设法使用busybox获取图像以满足流浪者的需求),如果您'使用一些预先构建的内核/ busybox ...可能是个问题,您必须找到sudovboxsfvboxguest的匹配二进制文件以及 mount帮助程序您的busybox中禁用了选项,您需要找到一种解决方法(可能修改vagrant以使用mount.vboxsf)。