Adding missing GPG keys for apt-get on WSL

How to add missing GPG keys when using WSL

Adding missing GPG keys for apt-get on WSL

TL;DR: Retrieve the keys manually using:

curl -sL “https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xKEY_HASH_GOES_HERE" | sudo apt-key add

Recently, I’ve stumbled upon an issue where some GPG keys were not available. Usually the solution to that is to directly use apt-key to retrieve those keys.

For example:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 112695A0E562B32A

Unfortunately (at least on my version of WSL), there seems to be an issue with it; the command fails with:

...
gpg: connecting dirmngr at ‘/tmp/apt-key-gpghome.H755AH9Xn5/S.dirmngr’ failed: IPC connect call failed
gpg: keyserver receive failed: No dirmngr

Obviously, installing dirmngr should fix it but it doesn’t work once installed.

Since I don’t really have time to get into this further (I’m pretty sure that there are known solutions to this under WSL: https://github.com/sbt/sbt/issues/4261), I looked for alternatives.

I found the following:

curl -sL “https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xKEY_HASH_GOES_HERE" | sudo apt-key add

Basically we’re just downloading the key ourselves using curl and passing it to apt-key so that it can add it.

Time to get back to what I was trying to do in the first place.. What was it already? ;-)

About Sébastien

I am Sébastien Dubois. You can follow me on X 🐦 and on BlueSky 🦋.


I am an author, founder, and coach. I write books and articles about Knowledge Work, Personal Knowledge Management, Note-taking, Lifelong Learning, Personal Organization, and Zen Productivity. I also craft lovely digital products . You can learn more about my projects here.

If you want to follow my work, then become a member.


Ready to get to the next level?

To embark on your Knowledge Management journey, consider investing in resources that will equip you with the tools and strategies you need. Check out the Obsidian Starter Kit and the accompanying video course. It will give you a rock-solid starting point for your note-taking and Knowledge Management efforts.


If you want to take a more holistic approach, then the Knowledge Worker Kit is for you. It covers PKM, but expands into productivity, personal organization, project/task management, and more:

Knowledge Worker Kit and community
Unlock the next level of your career. Stop feeling disorganized, unproductive, or overwhelmed.

If you are in a hurry, then do not hesitate to book a coaching session with me:

Personal Knowledge Management Coaching
Receive personalized coaching to quickly reach your goals

Subscribe to the Newsletter 💌