(虚拟机)VM 内的 ls /vagrant 挂起
Posted
技术标签:
【中文标题】(虚拟机)VM 内的 ls /vagrant 挂起【英文标题】:ls /vagrant inside a (virtual box) VM hangs 【发布时间】:2014-02-14 16:00:44 【问题描述】:我用下面的 Vagrant 文件配置了一个 VM(vagrant up), 然后我“vagrant ssh”进入它, 然后 *ls /vagrant *
它永远挂起,我在下面附加了一个 strace。
虚拟盒子的链接不稳定,所以复制到这里:
https://bitbucket.org/genap/public_files/downloads/saucy-server-cloudimg-amd64-vagrant-disk1.box
这个版本也会出现挂起...
流浪者版本 1.4.3 主机操作系统版本:
Distributor ID: Ubuntu
Description: Ubuntu 13.04
Release: 13.04
Codename: raring
流浪文件:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "UbuntuServer13.04"
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/saucy/current/saucy-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.network :private_network, ip: "192.168.78.9"
config.vm.host_name = "genap-portal-dev"
config.vm.provider "virtualbox" do |vb|
vb.name = "genap-portal-dev-test"
vb.memory = 1024
end
if Vagrant.has_plugin?("vagrant-hostmanager")
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
end
end
execve("/bin/ls", ["ls", "/vagrant/"], [/* 22 vars */]) = 0
brk(0) = 0x22ab000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2cb4bca000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, st_mode=S_IFREG|0644, st_size=25505, ...) = 0
mmap(NULL, 25505, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2cb4bc3000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240Z\0\0\0\0\0\0"..., 832) = 832
fstat(3, st_mode=S_IFREG|0644, st_size=134224, ...) = 0
mmap(NULL, 2234088, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2cb4788000
mprotect(0x7f2cb47a7000, 2097152, PROT_NONE) = 0
mmap(0x7f2cb49a7000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1f000) = 0x7f2cb49a7000
mmap(0x7f2cb49a9000, 1768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2cb49a9000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/librt.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0#\0\0\0\0\0\0"..., 832) = 832
fstat(3, st_mode=S_IFREG|0644, st_size=31760, ...) = 0
mmap(NULL, 2128984, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2cb4580000
mprotect(0x7f2cb4587000, 2093056, PROT_NONE) = 0
mmap(0x7f2cb4786000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x7f2cb4786000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libacl.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\34\0\0\0\0\0\0"..., 832) = 832
fstat(3, st_mode=S_IFREG|0644, st_size=31168, ...) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2cb4bc2000
mmap(NULL, 2126336, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2cb4378000
mprotect(0x7f2cb437f000, 2093056, PROT_NONE) = 0
mmap(0x7f2cb457e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x7f2cb457e000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\36\2\0\0\0\0\0"..., 832) = 832
fstat(3, st_mode=S_IFREG|0755, st_size=1853400, ...) = 0
mmap(NULL, 3961912, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2cb3fb0000
mprotect(0x7f2cb416d000, 2097152, PROT_NONE) = 0
mmap(0x7f2cb436d000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bd000) = 0x7f2cb436d000
mmap(0x7f2cb4373000, 17464, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2cb4373000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libpcre.so.3", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220\31\0\0\0\0\0\0"..., 832) = 832
fstat(3, st_mode=S_IFREG|0644, st_size=256224, ...) = 0
mmap(NULL, 2351392, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2cb3d71000
mprotect(0x7f2cb3dae000, 2097152, PROT_NONE) = 0
mmap(0x7f2cb3fae000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3d000) = 0x7f2cb3fae000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360l\0\0\0\0\0\0"..., 832) = 832
fstat(3, st_mode=S_IFREG|0755, st_size=135757, ...) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2cb4bc1000
mmap(NULL, 2212936, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2cb3b54000
mprotect(0x7f2cb3b6b000, 2097152, PROT_NONE) = 0
mmap(0x7f2cb3d6b000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7f2cb3d6b000
mmap(0x7f2cb3d6d000, 13384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2cb3d6d000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\16\0\0\0\0\0\0"..., 832) = 832
fstat(3, st_mode=S_IFREG|0644, st_size=14664, ...) = 0
mmap(NULL, 2109736, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2cb3950000
mprotect(0x7f2cb3953000, 2093056, PROT_NONE) = 0
mmap(0x7f2cb3b52000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f2cb3b52000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libattr.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\20\0\0\0\0\0\0"..., 832) = 832
fstat(3, st_mode=S_IFREG|0644, st_size=18624, ...) = 0
mmap(NULL, 2113760, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2cb374b000
mprotect(0x7f2cb374f000, 2093056, PROT_NONE) = 0
mmap(0x7f2cb394e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f2cb394e000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2cb4bc0000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2cb4bbf000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2cb4bbd000
arch_prctl(ARCH_SET_FS, 0x7f2cb4bbd800) = 0
mprotect(0x7f2cb436d000, 16384, PROT_READ) = 0
mprotect(0x7f2cb394e000, 4096, PROT_READ) = 0
mprotect(0x7f2cb3b52000, 4096, PROT_READ) = 0
mprotect(0x7f2cb3d6b000, 4096, PROT_READ) = 0
mprotect(0x7f2cb3fae000, 4096, PROT_READ) = 0
mprotect(0x7f2cb457e000, 4096, PROT_READ) = 0
mprotect(0x7f2cb4786000, 4096, PROT_READ) = 0
mprotect(0x7f2cb49a7000, 4096, PROT_READ) = 0
mprotect(0x619000, 4096, PROT_READ) = 0
mprotect(0x7f2cb4bcc000, 4096, PROT_READ) = 0
munmap(0x7f2cb4bc3000, 25505) = 0
set_tid_address(0x7f2cb4bbdad0) = 2285
set_robust_list(0x7f2cb4bbdae0, 24) = 0
futex(0x7fff2e8a5dfc, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, 7f2cb4bbd800) = -1 EAGAIN (Resource temporarily unavailable)
rt_sigaction(SIGRTMIN, 0x7f2cb3b5a7e0, [], SA_RESTORER|SA_SIGINFO, 0x7f2cb3b63bb0, NULL, 8) = 0
rt_sigaction(SIGRT_1, 0x7f2cb3b5a860, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7f2cb3b63bb0, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY) = 0
statfs("/sys/fs/selinux", 0x7fff2e8a5df0) = -1 ENOENT (No such file or directory)
statfs("/selinux", 0x7fff2e8a5df0) = -1 ENOENT (No such file or directory)
brk(0) = 0x22ab000
brk(0x22cc000) = 0x22cc000
open("/proc/filesystems", O_RDONLY) = 3
fstat(3, st_mode=S_IFREG|0444, st_size=0, ...) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2cb4bc9000
read(3, "nodev\tsysfs\nnodev\trootfs\nnodev\tb"..., 1024) = 372
read(3, "", 1024) = 0
close(3) = 0
munmap(0x7f2cb4bc9000, 4096) = 0
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, st_mode=S_IFREG|0644, st_size=1607664, ...) = 0
mmap(NULL, 1607664, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2cb4a34000
close(3) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, B38400 opost isig icanon echo ...) = 0
ioctl(1, TIOCGWINSZ, ws_row=31, ws_col=113, ws_xpixel=0, ws_ypixel=0) = 0
stat("/vagrant/", st_mode=S_IFDIR|0775, st_size=4096, ...) = 0
openat(AT_FDCWD, "/vagrant/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
getdents(3, /* 1 entries */, 32768) = 32
getdents(3, /* 1 entries */, 32768) = 32
getdents(3, /* 1 entries */, 32768) = 32
getdents(3, /* 1 entries */, 32768) = 32
...
...
最后一行 (getdents(3, /* 1 个条目 */, 32768) = 32) 然后无限重复
【问题讨论】:
【参考方案1】:vboxsf 挂载的问题几乎总是由来宾上的错误或不匹配的 VirtualBox 来宾添加引起的。至少主要和次要版本号必须与主机上的 VirtualBox 版本匹配。
选项有:
使用vagrant-vbguest 插件在需要时自动升级来宾添加。方便,但如果需要重新安装添加的新 VM 实例,则会减慢创建速度。 找到一个包含最新客人添加的盒子。想想你是否可以信任盒子图片的提供者。 使用匹配的客人添加版本构建您自己的盒子。例如,请参阅 packer.io 和 bento templates。 手动升级虚拟机上的访客添加,并将vagrant package
和add
作为新的基础框。
【讨论】:
以上是关于(虚拟机)VM 内的 ls /vagrant 挂起的主要内容,如果未能解决你的问题,请参考以下文章