周梦康 发表于 2019-01-05 2060 次浏览 标签 : vagrant
$ pwd
/Applications/VirtualBox.app/Contents/MacOS
$ ls|grep *.iso
VBoxGuestAdditions.iso
$ cp VBoxGuestAdditions.iso ~/Downloads

给虚拟机添加虚拟光驱加载该镜像文件

然后我们启动虚拟机

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
....
The error output from the command was:

mount: unknown filesystem type 'vboxsf'

忽略上面的错误,登录进去

$ vagrant ssh
Last login: Sat Jan  5 01:05:44 2019 from 10.0.2.2
[vagrant@localhost ~]$ sudo mkdir /media/cdrom
[vagrant@localhost ~]$ lsscsi
[0:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sda
[0:0:1:0]    cd/dvd  VBOX     CD-ROM           1.0   /dev/sr0
[vagrant@localhost ~]$ sudo mount /dev/sr0 /media/cdrom
mount: /dev/sr0 写保护,将以只读方式挂载
[vagrant@localhost ~]$ cd /media/cdrom/
[vagrant@localhost cdrom]$ ls
32Bit  AUTORUN.INF  cert  runasroot.sh  VBoxLinuxAdditions.run    VBoxWindowsAdditions-amd64.exe  VBoxWindowsAdditions-x86.exe
64Bit  autorun.sh   OS2   TRANS.TBL     VBoxSolarisAdditions.pkg  VBoxWindowsAdditions.exe
[vagrant@localhost cdrom]$ sudo ./VBoxLinuxAdditions.run

重启还是报错

Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:

mount -t vboxsf -o uid=1000,gid=1000 home_vagrant_yq-lib /home/vagrant/yq-lib

The error output from the command was:

/sbin/mount.vboxsf: mounting failed with the error: No such device

尝试着把下面的都安装了下,重启好了。其实为什么我也不知道。也不关心了。

yum install kernel
yum install kernel-devel
yum install gcc

评论列表