How to generate PGP key in Azure Linux host

324 Views Asked by At

In the Web SSH console for my Azure Linux host, the following command:

gpg --homedir=$homeDir --batch --gen-key pgp-params.txt

results in this:

gpg: error running '/usr/bin/gpg-agent': exit status 2
gpg: failed to start agent '/usr/bin/gpg-agent': General error
gpg: can't connect to the agent: General error
gpg: agent_genkey failed: No agent running
gpg: key generation failed: No agent running

Running the same command in the Kudu Bash console

gpg --homedir=$homeDir --batch --gen-key pgp-params.txt

results in this:

gpg: can't connect to the agent: IPC connect call failed
gpg: agent_genkey failed: No agent running
gpg: key generation failed: No agent running

Either way, the following two files are generated, but nothing else:

private-keys-v1.d
pubring.kbx

What am I missing in order to successfully generate keys in this environment?

(Ultimately, I want to have my Azure Function App generate keys--I was running into problems which lead me to stepping through this in the various consoles)

1

There are 1 best solutions below

1
On

I tried to SSH into my Function App ran below commands and got the same error code as yours :-

apt install gnupg

enter image description here

gpg --gen-key

enter image description here

To resolve this error, I ran below commands and tried creating gpg keys :-

apt-get install -y gnupg gnupg1
cp -a /usr/bin/gpg /usr/bin/gpg2
ln -sf /usr/bin/gpg1 /usr/bin/gpg
gpg --gen-key

Results:-

enter image description here

And the Keys were generated successfully like below :-

enter image description here

Reference :-
gpg: can't connect to the agent: IPC connect call failed By Paxsali