Cannot sign assertion on Ubuntu 18

Hello everyone,

if I run my snap sign on an Ubuntu 18.04.2 desktop version, I get a problem with signing:

error: cannot sign assertion: cannot sign using GPG: /usr/bin/gpg --personal-digest-preferences SHA512 --default-key 0x8087CDB7729743472AEB5ACF81235414E92BF955 --detach-sign failed: exit status 2 ("gpg: WARNING: unsafe ownership on homedir '/home/ubuntu/.snap/gnupg'\ngpg: signing failed: No such file or directory\ngpg: signing failed: No such file or directory\n")

Any idea what the problem might be? I have no problem executing it on an Ubuntu 16.04 system.

Thanks for your help

are you running this on a livecd ?

No, on AWS EC2 Ubuntu 18.04 image. But we have also seen it failing on local system.