VagrantBox重新安装vboxsf驱动
Posted dingdingfish
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了VagrantBox重新安装vboxsf驱动相关的知识,希望对你有一定的参考价值。
端午假期重新安装了Oracle Vagrant Project中的21c数据库,数据库可以用,但在启动过程中最末部分有一个小警告:
C:\\WORKSPACE\\vagrant-projects\\OracleDatabase\\21.3.0>vagrant up
Bringing machine 'oracle-21c-vagrant' up with 'virtualbox' provider...
==> oracle-21c-vagrant: Checking if box 'oraclelinux/8' version '8.5.285' is up to date...
==> oracle-21c-vagrant: A newer version of the box 'oraclelinux/8' for provider 'virtualbox' is
==> oracle-21c-vagrant: available! You currently have version '8.5.285'. The latest is version
==> oracle-21c-vagrant: '8.6.331'. Run `vagrant box update` to update.
==> oracle-21c-vagrant: Clearing any previously set forwarded ports...
==> oracle-21c-vagrant: Clearing any previously set network interfaces...
==> oracle-21c-vagrant: Preparing network interfaces based on configuration...
oracle-21c-vagrant: Adapter 1: nat
==> oracle-21c-vagrant: Forwarding ports...
oracle-21c-vagrant: 1521 (guest) => 1521 (host) (adapter 1)
oracle-21c-vagrant: 5500 (guest) => 5500 (host) (adapter 1)
oracle-21c-vagrant: 22 (guest) => 2222 (host) (adapter 1)
==> oracle-21c-vagrant: Running 'pre-boot' VM customizations...
==> oracle-21c-vagrant: Booting VM...
==> oracle-21c-vagrant: Waiting for machine to boot. This may take a few minutes...
oracle-21c-vagrant: SSH address: 127.0.0.1:2222
oracle-21c-vagrant: SSH username: vagrant
oracle-21c-vagrant: SSH auth method: private key
==> oracle-21c-vagrant: Machine booted and ready!
==> oracle-21c-vagrant: Checking for guest additions in VM...
oracle-21c-vagrant: No guest additions were detected on the base box for this VM! Guest
oracle-21c-vagrant: additions are required for forwarded ports, shared folders, host only
oracle-21c-vagrant: networking, and more. If SSH fails on this machine, please install
oracle-21c-vagrant: the guest additions and repackage the box to continue.
oracle-21c-vagrant:
oracle-21c-vagrant: This is not an error message; everything may continue to work properly,
oracle-21c-vagrant: in which case you may ignore this message.
==> oracle-21c-vagrant: Setting hostname...
==> oracle-21c-vagrant: Mounting shared folders...
oracle-21c-vagrant: /vagrant => C:/WORKSPACE/vagrant-projects/OracleDatabase/21.3.0
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 vagrant /vagrant
The error output from the command was:
: No such device
登入操作系统,果然没看到/vagrant
文件系统,执行提示中的命令也报错:
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 1846368 0 1846368 0% /dev
tmpfs 1865028 0 1865028 0% /dev/shm
tmpfs 1865028 16752 1848276 1% /run
tmpfs 1865028 0 1865028 0% /sys/fs/cgroup
/dev/mapper/vg_main-lv_root 34070268 15150992 18919276 45% /
/dev/sda1 506528 154708 351820 31% /boot
tmpfs 373004 0 373004 0% /run/user/1000
$ ls -lh /sbin/mount.vboxsf
lrwxrwxrwx. 1 root root 49 Jun 4 06:58 /sbin/mount.vboxsf -> /opt/VBoxGuestAdditions-6.1.26/other/mount.vboxsf
$ sudo mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant
/sbin/mount.vboxsf: mounting failed with the error: No such device
参照这篇文章:Vagrant was unable to mount VirtualBox shared folders,重新安装驱动:
sudo wget -c http://download.virtualbox.org/virtualbox/6.1.34/VBoxGuestAdditions_6.1.34.iso -O VBoxGuestAdditions_6.1.34.iso
sudo mount VBoxGuestAdditions_6.1.34.iso -o loop /mnt
sudo sh /mnt/VBoxLinuxAdditions.run
最后一步运行时间较长:
$ sudo sh /mnt/VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 6.1.34 Guest Additions for Linux........
VirtualBox Guest Additions installer
Removing installed version 6.1.26 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel
modules. This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel
5.4.17-2136.307.3.5.el8uek.x86_64.
然后以下命令正常:
$ sudo mount -t vboxsf -o uid=1000,gid=1000 vagrant /vagrant
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 1846368 0 1846368 0% /dev
tmpfs 1865028 0 1865028 0% /dev/shm
tmpfs 1865028 16776 1848252 1% /run
tmpfs 1865028 0 1865028 0% /sys/fs/cgroup
/dev/mapper/vg_main-lv_root 34070268 15211740 18858528 45% /
/dev/sda1 506528 154384 352144 31% /boot
tmpfs 373004 0 373004 0% /run/user/1000
/dev/loop0 60096 60096 0 100% /mnt
vagrant 242218284 205162368 37055916 85% /vagrant
此时vagrant box启动时就没有警告了。
以上是关于VagrantBox重新安装vboxsf驱动的主要内容,如果未能解决你的问题,请参考以下文章
Laravel学习之Windows下Homestead环境搭建
Laravel Homestead Vagrant - 'vboxsf' 不可用问题