在我的 Ubuntu 18.04 机器上加载期间,所有 DKMS 管理的内核模块都开始失败。我注意到了它,acpi_call
所以让我用它来演示:
# uname -r
4.15.0-99-generic
# modinfo acpi_call.ko
filename: /lib/modules/4.15.0-99-generic/updates/dkms/acpi_call.ko
license: GPL
srcversion: 72B6FB9451F0D2139482F11
depends:
retpoline: Y
name: acpi_call
vermagic: 4.15.0-99-generic SMP mod_unload
signat: PKCS#7
signer:
sig_key:
sig_hashalgo: md4
# modprobe acpi_call
modprobe: ERROR: could not insert 'acpi_call': Exec format error
我尝试使用 DKMS 重新安装它,但无济于事:
# dkms status acpi-call
acpi-call, 1.1.0, 4.15.0-99-generic, x86_64: installed
# dkms remove acpi-call/1.1.0 --all
-------- Uninstall Beginning --------
Module: acpi-call
Version: 1.1.0
Kernel: 4.15.0-99-generic (x86_64)
-------------------------------------
Status: Before uninstall, this module version was ACTIVE on this kernel.
acpi_call.ko:
- Uninstallation
- Deleting from: /lib/modules/4.15.0-99-generic/updates/dkms/
- Original module
- No original module was found for this module on this kernel.
- Use the dkms install command to reinstall any previous module version.
depmod...
DKMS: uninstall completed.
------------------------------
Deleting module version: 1.1.0
completely from the DKMS tree.
------------------------------
Done.
# dkms install acpi-call/1.1.0
Creating symlink /var/lib/dkms/acpi-call/1.1.0/source ->
/usr/src/acpi-call-1.1.0
DKMS: add completed.
Kernel preparation unnecessary for this kernel. Skipping...
Building module:
cleaning build area...
make -j8 KERNELRELEASE=4.15.0-99-generic -C /lib/modules/4.15.0-99-generic/build M=/var/lib/dkms/acpi-call/1.1.0/build...
Signing module:
- /var/lib/dkms/acpi-call/1.1.0/4.15.0-99-generic/x86_64/module/acpi_call.ko
Nothing to do.
cleaning build area...
DKMS: build completed.
acpi_call.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/4.15.0-99-generic/updates/dkms/
depmod...
DKMS: install completed.
# modprobe acpi_call
modprobe: ERROR: could not insert 'acpi_call': Exec format error
中的其他模块/lib/modules/4.15.0-99-generic/updates/dkms
表现出完全相同的问题。
我也试过modprobe -f
,导致不同的错误信息:
# modprobe -f acpi_call
modprobe: ERROR: could not insert 'acpi_call': Required key not available
这使我陷入了MOK 兔子洞,但即使在注册了新的 MOK 并sign-file
-ing.ko
文件之后,我仍然收到Required key not available
错误消息。如果我禁用验证,那么modprobe -f
仍然会失败并显示Exec format error
.
另外,我注意到这一行dmesg
:
[ 617.320431] module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 1, loc 0000000057734886, val ffffffffc0d56a43
这里出了什么问题,我该如何解决?
事实证明,问题在于我系统上的默认 GCC 已更改为 GCC-9(由于
freehdl
升级失败,但无论如何)。与用于构建 Ubuntu 内核的 GCC 版本相比,这导致了用于使用 DKMS 构建模块的 GCC 版本不同(并且显然与 ABI 不兼容?)。降级回 GCC-7(并重建所有 DKMS 模块)后,现在一切都像以前一样工作,包括安全启动支持。