Error - gpg: cannot open ‘/dev/tty’: No such device or address - when encrypting/decrypting using PGP keys

To fix the error "gpg: cannot open '/dev/tty': No such device or address" while encrypting or decrypting using PGP keys, bypass the step where the system tries to output to /dev/tty by adding --no-tty in the GPG command.

Description description

Environment

  • Campaign Classic
  • Campaign
  • Campaign Standard

Issue/Symptoms

Getting the following error when using the encrypt post-process command or the decrypt pre-process command.

gpg: cannot open '/dev/tty': No such device or address

Resolution resolution

To fix the error mentioned above, you need to bypass the step where the system tries to output to /dev/tty, which either does not exists in the file system or the neolane user does not have rights to this directory. In the GPG command, add --no-tty to skip this step. E.g.:

<etl>
    <preProcessCommand command="gpg --decrypt --no-tty --recipient <b></b><b></b> &quot;$fileName&quot;" label="Decryption GPG" name="GPGdecrypt"/>
    <postProcessCommand command="gpg --encrypt --no-tty --recipient <b></b><b>* &quot;$fileName&quot;" label="Encryption GPG" name="GPGencrypt" suffix="gpg"/>
</etl>

Cause

This error happens because the system tries to output to /dev/tty, which either does not exists in the file system, or the neolane user does not have rights to this directory.

Also, check if the passphrase in preProcessCommand is present or not. If the passphrase is missing, then also we can get this error.

<etl>
    <preProcessCommand name="GPGdecrypt" label ="Decryption GPG" command="gpg --decrypt --passphrase passphrase --recipient CampaignOperations@adobe.com &quot;$fileName&quot;"/>
    <postProcessCommand name="GPGencrypt" label ="Encryption GPG" command="gpg --encrypt --recipient comp_ops@xxx.com.au &quot;$fileName&quot;" suffix="gpg"/>
</etl>
recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f