Why does gpg --genkey fail for su user with error "gpg cancelled by user gpg Key generation canceled." automatically on Red Hat Enterprise Linux 7 whereas works for direct login?

Solution Verified - Updated -

Issue

  • Why does gpg --genkey fail for su user with error "gpg cancelled by user gpg Key generation canceled." automatically on Red Hat Enterprise Linux 7 whereas works for direct login?
  • The strace shows error as follows.
9891  20:21:48 read(5, "INQUIRE PINENTRY_LAUNCHED 9980\n", 1002) = 31 <0.009746>
9891  20:21:48 write(5, "END", 3)       = 3 <0.000018>
9891  20:21:48 write(5, "\n", 1)        = 1 <0.000013>
9891  20:21:48 read(5, "ERR 83886179 Operation cancelled <Pinentry>\n", 1002) = 44 <0.251577>
9891  20:21:49 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f485fd8d000 <0.000019>
9891  20:21:49 write(2, "gpg: cancelled by user\n", 23) = 23 <0.000204>
9891  20:21:49 write(2, "gpg: Key generation canceled.\n", 30) = 30 <0.000074>
9891  20:21:49 open("/home/testuser/.gnupg/random_seed", O_WRONLY|O_CREAT, 0600) = 6 <0.000039>
9891  20:21:49 fcntl(6, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0 <0.000027>
9891  20:21:49 ftruncate(6, 0)          = 0 <0.000149>

Environment

  • Red Hat Enterprise Linux 7.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content