gpg-agent is started automatically by gpg so it shouldn't be a problem that it is running. All the same steps seem to work fine interactively on a new yakkety instance:
$ cat /tmp/tmp/key-config %no-protection %transient-key %no-ask-passphrase Key-Type: RSA Name-Real: Example Key Name-Comment: N/A Name-Email: <email address hidden> Expire-Date: 2d Preferences: (setpref) %commit
$ gpg -vvv --gen-key --batch --debug-quick-random /tmp/tmp/key-config gpg: using character set 'utf-8' gpg: invalid item '(setpref)' in preference string gpg: writing self signature gpg: RSA/SHA256 signature from: "7933319B12B759E8 [?]" gpg: writing public key to '/home/ubuntu/.gnupg/pubring.kbx' gpg: using pgp trust model gpg: key 1C67DDDBC2E31773: accepted as trusted key gpg: key 337D344BB55B6C75: accepted as trusted key gpg: key 215364B9961AB763: accepted as trusted key gpg: key 8DF81BE76250CE68: accepted as trusted key gpg: key 7933319B12B759E8: accepted as trusted key gpg: key 7933319B12B759E8 marked as ultimately trusted gpg: writing to '/home/ubuntu/.gnupg/openpgp-revocs.d/58B3E470840749DC0D34983B7933319B12B759E8.rev' gpg: RSA/SHA256 signature from: "7933319B12B759E8 Example Key (N/A) <email address hidden>" gpg: revocation certificate stored as '/home/ubuntu/.gnupg/openpgp-revocs.d/58B3E470840749DC0D34983B7933319B12B759E8.rev'
gpg-agent is started automatically by gpg so it shouldn't be a problem that it is running. All the same steps seem to work fine interactively on a new yakkety instance:
$ cat /tmp/tmp/key-config
%no-protection
%transient-key
%no-ask-passphrase
Key-Type: RSA
Name-Real: Example Key
Name-Comment: N/A
Name-Email: <email address hidden>
Expire-Date: 2d
Preferences: (setpref)
%commit
$ gpg -vvv --gen-key --batch --debug- quick-random /tmp/tmp/key-config ubuntu/ .gnupg/ pubring. kbx' ubuntu/ .gnupg/ openpgp- revocs. d/58B3E47084074 9DC0D34983B7933 319B12B759E8. rev' ubuntu/ .gnupg/ openpgp- revocs. d/58B3E47084074 9DC0D34983B7933 319B12B759E8. rev'
gpg: using character set 'utf-8'
gpg: invalid item '(setpref)' in preference string
gpg: writing self signature
gpg: RSA/SHA256 signature from: "7933319B12B759E8 [?]"
gpg: writing public key to '/home/
gpg: using pgp trust model
gpg: key 1C67DDDBC2E31773: accepted as trusted key
gpg: key 337D344BB55B6C75: accepted as trusted key
gpg: key 215364B9961AB763: accepted as trusted key
gpg: key 8DF81BE76250CE68: accepted as trusted key
gpg: key 7933319B12B759E8: accepted as trusted key
gpg: key 7933319B12B759E8 marked as ultimately trusted
gpg: writing to '/home/
gpg: RSA/SHA256 signature from: "7933319B12B759E8 Example Key (N/A) <email address hidden>"
gpg: revocation certificate stored as '/home/