我想签一些内核模块(VirtualBox的)的解释在这里。
如此处所述,我创建了新密钥:
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=Descriptive name/"
Run Code Online (Sandbox Code Playgroud)
我签署了所有模块:
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxdrv)
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxnetadp)
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxnetflt)
sudo /usr/src/linux-headers-$(uname -r)/scripts/sign-file sha256 ./MOK.priv ./MOK.der $(modinfo -n vboxpci)
Run Code Online (Sandbox Code Playgroud)
但是,在导入密钥时,失败了
$ sudo mokutil --import MOK.der
input password:
input password again:
Failed to enroll new keys
Run Code Online (Sandbox Code Playgroud)
是什么原因造成的?
编辑:实际上,我只是注意到我真的不能对mokutil做太多事情。例如:
$ sudo mokutil --reset
input password:
input password again:
Failed to unset MokNew
Failed to write MokAuth
Failed to unset MokNew
Failed to issue a reset request
Run Code Online (Sandbox Code Playgroud)
我认为唯一不会失败的命令是--sb-state正确指出启用了SecureBoot的命令,以及--list-enrolled列出已注册密钥的命令。其他一切都会以某种方式出现错误。
如果您使用的是 Ubuntu,则不需要设置 root 密码。不确定其他发行版,但这应该适用于任何使用 sudo 的发行版。
sudo su
mokutil --import MOK.der
Run Code Online (Sandbox Code Playgroud)
它现在应该可以正常工作了。然后要返回正常提示,只需键入。
exit
Run Code Online (Sandbox Code Playgroud)
或简单
reboot
Run Code Online (Sandbox Code Playgroud)
您现在需要通过 UEFI 提示添加您的密钥。无论你给它起什么名字,它都应该显示出来,至少它在我的系统上对我有用。
现在您应该可以使用您的软件了。