Be sure to install gnugp and start with a fresh ~/.gnupg dir
sudo apt install -y gnupg
mkdir -p ~/.gnupg
killall gpg-agent
mv ~/.gnupg $HOME/.gnupg-`date +%Y-%m-%d-%H:%M`
gpg --version | grep -A1 algorithms:
#export GNUPGHOME="$(mktemp -d)"
export GNUPGHOME="$HOME/.gnupg"
cat >newkey.conf <<EOF
%echo Generating a basic OpenPGP key
Key-Type: RSA
Key-Length: 4096
Subkey-Type: ELG-E
Subkey-Length: 1024
Name-Real: Hippie Hacker
Name-Comment: http://ii.coop
Name-Email: hh@ii.coop
Expire-Date: 0
Passphrase: changeme
# Do a commit here, so that we can later print "done" :-)
%commit
%echo done
EOF
gpg --batch --generate-key newkey.conf
gpg --list-secret-keys
While the above is runnig you’ll need some entropy, may create a tar in /dev/shm from /usr
tar -cvf /dev/shm/deleteme /usr #Control C a bit later when your key is created
gpg --list-keys