While fighting with my discrete graphics card, I reinstalled Ubuntu several times. The first couple times I was very careful to move the .priv and .der key I was using to sign my dkms kernel modules to another partition. Unfortunately, as I got more frustrated I became less careful and apparently accidentally cut and pasted from the backup (rather than copying and pasting) and then reformatted over the sole remaining key in the next re-install. I used photorec
to try and recover the files but unfortunately no *.der or *.priv files were recovered.
It seems that the intended way to un-enroll machine owner keys (MOKs) is
mokutil --delete keyname.der
Given that I no longer have the public key, is there another way for me to un-enroll it?
To delete only one specific key from the database you could first use the
--export
flag, like so:This will export all machine owner keys to the current directory:
They are numbered according to the list given by
which should then enable you to delete only one specific key, e.g. key 1:
Figured it out. The
--reset
parameter does the trick.If you had multiple MOKs enrolled and only wanted to remove one it might not be ideal.
If someone comes up with a better option I'll accept that answer.
I realize this is an old question, but I have had fits with this issue regarding VirtualBox and machine owner keys - to the point that I had rebuilt one each time VirtualBox would not start a session.
Here is what I wound up doing:
mokkeys
.cd
to that directory.mokutil --export
to list all the MOK*.der's.mokutil -l | less
to compare the listed der's with what the detail listed per key and identified the extra keys that I wanted to remove.sudo mokutil --delete
for each MOK*.der individually. (always double prompted for the MOK password, sudo was the only way this worked for me - have been trying to remove these for way too long a time).