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

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]#

相关文章:

  • Redis 核心源码解析:从设计哲学到企业级应用实践
  • Triformer:长序列多变量时间序列预测
  • 记录一次部署k3s后,服务404 page not found,nginx显示正常
  • PL/SQL语言的字符串处理
  • VUE项目初始化
  • 深入理解Golang标准库`testing/fstest`包的用法和技巧进行文件系统测试
  • 【Git】用Git命令克隆一个远程仓库、修改仓库中的文件,并将更改推送到远程仓库
  • Kotlin 协程官方文档知识汇总(一)
  • 基本数据操作关于torch
  • 【读点论文】面向识别的长弯曲文本预处理算法,有点局限
  • Java 字符流全解析:核心类实战指南
  • SpringBoot 启动优化 问题
  • 什么是Java序列化?什么情况下需要使用序列化
  • 5. 实现一个中间件
  • S7-1200对V90 PN进行位置控制的三种方法
  • 新能源行业:卓越 UE/UI 设计,引领业务腾飞的新引擎
  • 23种设计模式-命令(Command)设计模式
  • 数据文件误删除,OceanBase中如何重建受影响的节点
  • Axure设计之中继器表格——拖动行排序教程(中继器)
  • 重庆软航NTKO WebOffice控件在谷歌Chrome 133版提示扩展已停用解决方案!
  • “千馆万员讲家风”活动举办,小讲解员登台讲述家风故事
  • 白鲨抢下世界杯首张入场券,透过ACL看CFPL的成色
  • 中疾控:适龄儿童要及时、全程接种百白破疫苗
  • 存款利率、LPR同日下调,机构称对银行的影响偏正面
  • 《歌手2025》能否“爆”下去?
  • 益阳通报“河水颜色异常有死鱼”:未发现排污,原因待鉴定