记录vagrant应用过程中遇到的问题,会继续补充

  • 降级virtualbox后,呈现挂载host目录问题

环境

host win10virtualbox 6.1.22vm centos 7

问题景象:
之前vm设置过与host的文件共享,Vagrantfile中配置

config.vm.synced_folder "D:/work/vagrant/data", "/vagrant_data"

virtualbox从6.1.16降级到6.1.22, 降级后vagrant up显示如下问题

==> pg12: Checking for guest additions in VM...==> pg12: Setting hostname...==> pg12: Configuring and enabling network interfaces...==> pg12: Mounting shared folders...    pg12: /vagrant => D:/work/vagrant/vms/pg12Vagrant was unable to mount VirtualBox shared folders. This is usuallybecause the filesystem "vboxsf" is not available. This filesystem ismade available via the VirtualBox Guest Additions and kernel module.Please verify that these guest additions are properly installed in theguest. This is not a bug in Vagrant and is usually caused by a faultyVagrant box. For context, the command attempted was:mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrantThe error output from the command was:/sbin/mount.vboxsf: mounting failed with the error: Invalid argument

解决办法:
ssh登陆vm,将vagrant(vagrant为vm默认登陆用户,依据理论状况配置)增加到vboxsf,vboxusers 组

sudo groupadd vboxusersusermod -G vboxusers vagrantusermod -G vboxsf vagrant

vm关机,再vagrant up启动后即可

[vagrant@pg12 ~]$ groupsvagrant vboxusers

查看共享目录挂载胜利

[vagrant@pg12 ~]$ ls /vagrant_data/a b c.sh
  • TBD