Ubuntu 20.04 LTS安装OpenOnload加载驱动报错求助
解决OpenOnload驱动加载时"failed to find syscall table"错误
问题背景
在Ubuntu 20.04 LTS上从源码构建OpenOnload后,执行加载驱动脚本时出现insmod: ERROR: could not insert module ... Unknown symbol in module,查看dmesg得到init_sfc_resource: ERROR: failed to find syscall table,裸机和虚拟机环境均出现该问题。
解决方案
该错误源于Linux 5.15+内核默认隐藏了syscall table,而OpenOnload的sfc_resource模块需要访问它,以下是可行解决办法:
方法1:调整内核参数暴露syscall table
- 编辑GRUB配置文件:
sudo nano /etc/default/grub - 修改
GRUB_CMDLINE_LINUX行,添加内核参数:
(若原有参数,直接追加到引号内即可)GRUB_CMDLINE_LINUX="quiet splash sysctl.kernel.kptr_restrict=0 sysctl.kernel.unprivileged_bpf_disabled=0" - 更新GRUB并重启:
sudo update-grub sudo reboot - 重启后重新执行OpenOnload驱动加载脚本
方法2:应用OpenOnload内核补丁
- 安装当前版本内核源码:
sudo apt install linux-source-5.15.0-46-generic - 进入OpenOnload源码目录,定位到
driver/linux/patches下对应5.15内核的补丁文件 - 将补丁应用到内核源码目录(需确保内核源码已解压)
- 重新编译并安装内核,重启后再加载OpenOnload驱动
方法3:降级至兼容内核版本
Ubuntu 20.04的5.4 LTS内核未严格隐藏syscall table,可降级使用:
- 安装5.4内核包:
sudo apt install linux-image-5.4.0-150-generic linux-headers-5.4.0-150-generic - 重启系统,在GRUB菜单中选择5.4版本内核启动
- 重新编译OpenOnload并加载驱动
验证步骤
- 加载驱动后,执行以下命令确认成功:
若输出包含dmesg | grep sfc_resourcesfc_resource: loaded successfully则说明驱动加载正常 - 运行
onload --version验证OpenOnload功能正常
内容的提问来源于stack exchange,提问作者intrigued_66
相关产品推荐
相关产品推荐

