Skip to content

Instantly share code, notes, and snippets.

@sanmai
Last active May 27, 2026 06:06
Show Gist options
  • Select an option

  • Save sanmai/8b5cc5093600dd5c00b2212ddbc1475f to your computer and use it in GitHub Desktop.

Select an option

Save sanmai/8b5cc5093600dd5c00b2212ddbc1475f to your computer and use it in GitHub Desktop.
memtest86+ with secure boot on debian

have MOK enrolled but grub gives you shit with bad shim signature when starting memtest86+?

fear no more, this is the script that will sign your mt86 binary so that secure enabled system can load it

#!/bin/bash
if sbverify --cert /var/lib/dkms/mok.pem /boot/mt86+x64; then
echo "Success!"
exit 0
fi
if [[ ! -f /var/lib/dkms/mok.pem ]]; then
openssl x509 -inform DER -in /var/lib/dkms/mok.pub -out /var/lib/dkms/mok.pem
fi
set -e
sbsign -v --key /var/lib/dkms/mok.key --cert /var/lib/dkms/mok.pem /boot/mt86+x64
chmod -v --reference=/boot/mt86+x64 /boot/mt86+x64.*
chown -v --reference=/boot/mt86+x64 /boot/mt86+x64.*
mv -v /boot/mt86+x64.* /boot/mt86+x64
sbverify --cert /var/lib/dkms/mok.pem /boot/mt86+x64
sbverify --list /boot/mt86+x64
echo "Success!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment