当前位置: 首页 > article >正文

unable to load vboxguest kernel module

vbox 安装增强功能失败一例

起因

vbox 从 6.9 升级到 7.1.6,Centos 7 虚拟机里的的共享文件夹设置失效了。尝识重新安装增强功能,报如下错:

[root@vbox cdrom]# ./VBoxLinuxAdditions.run
Verifying archive integrity...  100%   MD5 checksums are OK. All good.
Uncompressing VirtualBox 7.1.6 Guest Additions for Linux  100%
VirtualBox Guest Additions installer
Removing installed version 7.1.6 of VirtualBox Guest Additions...
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Setting up modules
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
3.10.0-1160.119.1.el7.x86_64.

VirtualBox Guest Additions: Look at /var/log/vboxadd-setup.log to find out what
went wrong
[root@vbox cdrom]# cat /var/log/vboxadd-setup.log
-bash: $'\346cat': command not found
[root@vbox cdrom]# cat /var/log/vboxadd-setup.log
Building the main Guest Additions 7.1.6 module for kernel 3.10.0-1160.119.1.el7.x86_64.
Error building the module.  Build output follows.
make V=1 CONFIG_MODULE_SIG= CONFIG_MODULE_SIG_ALL= -C /lib/modules/3.10.0-1160.119.1.el7.x86_64/build M=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j1 modules
arch/x86/Makefile:169: *** CONFIG_RETPOLINE=y, but not supported by the compiler. Compiler update recommended..  Stop.
make: *** [vboxguest] Error 2
[root@vbox cdrom]#

 报错日志里有  “Compiler update recommended” 很明显是要升级编译工具。

安装高版本的编译工具

网上查了一下,看上去很 Easy,按下面这个命令就可以安装高版本的编译工具:

yum -y install centos-release-scl centos-release-scl-rh
yum -y install devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-binutils

Centos 7 官方2024年6月以后就不再提供支持,所以更新 Centos 7 为国内 yum 源。

CentOs-Base.repo 的内容就不贴了,网上很多,照做基本都没有问题。

主要是 CentOS-SCLo-scl.repo 和 CentOS-SCLo-scl-rh.repo 这两个都要改,不要只改一个。

[root@vbox yum.repos.d]# cat CentOS-SCLo-scl.repo
# CentOS-SCLo-sclo.repo
#
# Please see http://wiki.centos.org/SpecialInterestGroup/SCLo for more
# information

[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
baseurl=http://mirrors.cloud.tencent.com/centos/7/sclo/$basearch/sclo/
#mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-sclo
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[root@vbox yum.repos.d]# cat CentOS-SCLo-scl-rh.repo
# CentOS-SCLo-rh.repo
#
# Please see http://wiki.centos.org/SpecialInterestGroup/SCLo for more
# information

[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=http://mirrors.cloud.tencent.com/centos/7/sclo/$basearch/rh/
#mirrorlist=http://mirrorlist.centos.org?arch=$basearch&release=7&repo=sclo-rh
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

修改完成后,重新安装devtoolset ,我这里用 11 的版本。

再次安装增强组件。 注意:安装前要执行  scl enable devtoolset-11 bash 使新版的gcc生效。

[root@vbox yum.repos.d]# gcc --version
gcc (GCC) 5.2.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@vbox yum.repos.d]# scl enable devtoolset-11 bash
[root@vbox yum.repos.d]# gcc --version
gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@vbox yum.repos.d]#

安装成功

[root@vbox cdrom]# ./VBoxLinuxAdditions.run
Verifying archive integrity...  100%   MD5 checksums are OK. All good.
Uncompressing VirtualBox 7.1.6 Guest Additions for Linux  100%
VirtualBox Guest Additions installer
Removing installed version 7.1.6 of VirtualBox Guest Additions...
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Setting up modules
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
3.10.0-1160.119.1.el7.x86_64.
[root@vbox cdrom]#


http://www.kler.cn/a/599525.html

相关文章:

  • FreeSWITCH入门到精通系列(四):FreeSWITCH模块介绍与使用
  • langchain-ollama的ragflow简单实现
  • [Windows] AI智能音频分离软件SpleeterGui v2.9.5.0【官方中文版】
  • 作业12 (2023-05-15 指针概念)
  • 卷积神经网络 - LeNet-5
  • Python+AI助力智能仓储:效率与科技的完美融合
  • Xamarin.Android实现本地化部署DeepSeek的对话功能
  • 【DFS】羌笛何须怨杨柳,春风不度玉门关 - 4. 二叉树中的深搜
  • STM32八股【3】------RAM和片上FLASH
  • System.arraycopy 在音视频处理中的应用
  • TDengine 用户权限管理
  • Elasticsearch:设置向量搜索
  • 【机器学习基础 4】 Pandas库
  • 大模型应用(Java)2025/3/24
  • [Lc18_BFS拓扑排序] 邻接表 | 课程表I II
  • AI Tokenization
  • windows与linux开发板之间设置nfs共享文件
  • 23种设计模式-外观(Facade)设计模式
  • C#中 String类API(函数)
  • 数据结构八股