Solving NO_PUBKEY error
The first thing to do when turning on the machine is updating linux, but no sooner that I do that and I’m hit with the NO_PUBKEY error, which means that the machine cannot update.
The first solution I find involves the following command (replace # with the key ID from the error message):
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys #
Alas, that is specific to Ubuntu, while Debian is moving away from it.
So the commands to use are instead (again, replace # with the key ID from the error message)
gpg --keyserver pgpkeys.mit.edu --recv-key # gpg -a –export # | sudo apt-key add -
It is also possible to use a command to automate this for you:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys #sudo apt update 2>&1 1>/dev/null | sed -ne 's/.*NO_PUBKEY //p' | while read key; do if ! [[ ${keys[*]} =~ "$key" ]]; then sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys "$key"; keys+=("$key"); fi; done
However, I had some difficulties with the command above and even the one that worked had some warnings. Nonetheless, I’ll consider the issue resolved.
On a newer machine, I discovered
alias kupd8='sudo wget https://archive.kali.org/archive-keyring.gpg -O /usr/share/keyrings/kali-archive-keyring.gpg'
On the old machine I’ll just set up the command to work as an alias under the root account; the user account I setup for SSH probably has its own such alias.
Moving on, the machine no longer showed the Windows partition in the GRUB boot menu. This is a problem I thought I had fixed before, but let me look into it again.
- Edit /etc/default/grub and ensure this line is present and not commented out: GRUB_DISABLE_OS_PROBER=false (in my case it was commented out, so I deleted the #).
- Regenerate grub config: sudo update-grub
- Reboot and check the GRUB menu for a Windows entry.
And that’s it. Everything else seems to be working fine. So far.
To avoid these in the future I’ll create aliases in the root account.
Sources / More info: debian-webb
Comments