gpg: signing failed ioctl

While signing PGP keys the following error occured:

gpg: signing failed: Unpassender IOCTL (I/O-Control) für das Gerät

Which is german so googling for the following words:

gpg: signing failed ioctl

Revealed a possible solution that actually worked:

GPG_TTY=$(tty)
export GPG_TTY