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> "$fileName"" label="Decryption GPG" name="GPGdecrypt"/>
<postProcessCommand command="gpg --encrypt --no-tty --recipient <b></b><b>* "$fileName"" 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 "$fileName""/>
<postProcessCommand name="GPGencrypt" label ="Encryption GPG" command="gpg --encrypt --recipient comp_ops@xxx.com.au "$fileName"" suffix="gpg"/>
</etl>