Sometimes in WSL Windows Subsystem for Linux, after updating Ubuntu you will get “gpg: can’t connect to the agent: IPC connect call failed” error when you try to add the key using the sudo apt-key add. You can easily solve this. This is because of a bug in Windows Subsystem for Linux. Follow the below steps to solve this error. You can try to add the key manually to solve this problem.
In the Ubuntu terminal command line add the below command. Here you can replace “YOUR_KEY_HERE” with your actual GPG key.
curl -sL "http://keyserver.ubuntu.com/pks/lookup?op=get&search=YOUR_KEY_HERE" | sudo apt-key add
That’s all.