Bug 11054

Summary: selftest: Signing packages failing on ubuntu 16.10 with gpg (GnuPG) 2.1.15
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Jose Perez C <jose.perez.carranza>
Component: devtools / tool chainAssignee: Markus Lehtonen <markus.lehtonen>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: Medium+ CC: alex.kanavin, anibal.limon, joshuagloe, markus.lehtonen, meta.mr.watcher, meta.watcher, monserratx.sedeno.bustos, oscarx.lopez.arandas
Version: 2.3   
Target Milestone: 2.3 M3   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Jose Perez C 2017-02-14 18:08:54 UTC
Selftest is failing on Ubuntu 16.10

root@ubuntu1610:~# gpg --version 
gpg (GnuPG) 2.1.15

All other workers are working correctly and those have version 2.0 or below of gpg.

======================================================================
ERROR [0.000s]: setUpClass (oeqa.selftest.signing.Signing)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1610/build/meta/lib/oeqa/selftest/signing.py", line 30, in setUpClass
    runCmd('gpg --homedir %s --import %s %s' % (cls.gpg_dir, cls.pub_key_path, cls.secret_key_path))
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1610/build/meta/lib/oeqa/utils/commands.py", line 114, in runCmd
    raise AssertionError("Command '%s' returned non-zero exit status %d:\n%s" % (command, result.status, result.output))
AssertionError: Command 'gpg --homedir /tmp/oeqa-signing-9k2dbj0u --import /home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1610/build/meta-selftest/files/signing/key.pub /home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1610/build/meta-selftest/files/signing/key.secret' returned non-zero exit status 2:
gpg: keybox '/tmp/oeqa-signing-9k2dbj0u/pubring.kbx' created
gpg: /tmp/oeqa-signing-9k2dbj0u/trustdb.gpg: trustdb created
gpg: key 7B31316B5D64AD52: public key "testuser (nocomment) <testuser@testemail.com>" imported
gpg: key 7B31316B5D64AD52: "testuser (nocomment) <testuser@testemail.com>" not changed
gpg: key 7B31316B5D64AD52/7B31316B5D64AD52: error sending to agent: Operation cancelled
gpg: Total number processed: 2
gpg:               imported: 1
gpg:              unchanged: 1
gpg:       secret keys read: 1
Comment 1 Joshua Lock 2017-02-14 20:28:42 UTC
Shouldn't we be building our own gpg-native to perform any package signing, rather than relying on host utils?
Comment 2 Aníbal Limón 2017-02-14 20:37:28 UTC
(In reply to comment #1)
> Shouldn't we be building our own gpg-native to perform any package signing,
> rather than relying on host utils?

Yes we are but seems a problem of configuration at ~/.gpg, i suggest the test to create a isolated configuration.
Comment 3 Joshua Lock 2017-02-14 20:40:03 UTC
The package signing classes have a GPG_PATH variable:

"Optional variable for specifying the gnupg "home" directory"

perhaps the tests could make use of that?
Comment 4 Alexander Kanavin 2017-02-21 08:02:25 UTC
Can you try if the issue still happens with this branch? 
https://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=akanavin/dnf-rpm4

Markus Lehtonen and I did some fixing specifically to make gpg work again, including Ubuntu. But it's done on top of rpm4/dnf, which is coming soon anyway.
Comment 5 Alexander Kanavin 2017-02-21 08:04:34 UTC
(In reply to comment #3)
> The package signing classes have a GPG_PATH variable:
> 
> "Optional variable for specifying the gnupg "home" directory"
> 
> perhaps the tests could make use of that?

The tests are already setting up their private gnupg home directory (see the --homedir parameter above), this is not an issue.
Comment 6 Markus Lehtonen 2017-02-21 10:51:27 UTC
Yes, this will be fixed with Ale(In reply to comment #4)
> Can you try if the issue still happens with this branch? 
> https://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=akanavin/dnf-
> rpm4
> 
> Markus Lehtonen and I did some fixing specifically to make gpg work again,
> including Ubuntu. But it's done on top of rpm4/dnf, which is coming soon
> anyway.

Yes, this will be fixed with Alexander's dfn/rpm4 patchset. I've tested it specifically on Ubuntu 16.10 and it works.
Comment 7 Jose Perez C 2017-02-21 22:00:27 UTC
Tested on GDC local AB were the failure was found and the 'gpg' failure is not present anymore.
Comment 8 Markus Lehtonen 2017-02-23 08:25:02 UTC
This is still broken in master. Looks like the dnf patchset will not be merged until 2.4 so I'll fix this separately.
Comment 9 Alexander Kanavin 2017-02-23 10:00:33 UTC
I'd say we need to wait for an official decision by RP; I've sent the v2 of the dnf patch with everything fixed, so it may yet find its way to master.
Comment 10 Markus Lehtonen 2017-02-23 10:28:24 UTC
Uh, I already sent a patchset for review. But, now we have a fix in any case. Let RP decide :)

https://patchwork.openembedded.org/series/5471/
Comment 11 Alexander Kanavin 2017-02-23 13:32:30 UTC
I don't mind that, if your fixes are merged, I can drop a few patches from the dnf patchset, which are only tangential to its purpose.
Comment 13 oscar lopez arandas 2017-09-11 21:07:35 UTC
Selftest is failing on Ubuntu 17.04
2.2.2.rc2
All other workers are working correctly

======================================================================
ERROR [0.000s]: setUpClass (oeqa.selftest.signing.Signing)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1704/build/meta/lib/oeqa/selftest/signing.py", line 30, in setUpClass
    runCmd('gpg --homedir %s --import %s %s' % (cls.gpg_dir, cls.pub_key_path, cls.secret_key_path))
  File "/home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1704/build/meta/lib/oeqa/utils/commands.py", line 114, in runCmd
    raise AssertionError("Command '%s' returned non-zero exit status %d:\n%s" % (command, result.status, result.output))
AssertionError: Command 'gpg --homedir /tmp/oeqa-signing-hc7m5doc --import /home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1704/build/meta-selftest/files/signing/key.pub /home/ab/autobuilder/yocto-worker/nightly-oe-selftest-ubuntu1704/build/meta-selftest/files/signing/key.secret' returned non-zero exit status 2:
gpg: keybox '/tmp/oeqa-signing-hc7m5doc/pubring.kbx' created
gpg: /tmp/oeqa-signing-hc7m5doc/trustdb.gpg: trustdb created
gpg: key 7B31316B5D64AD52: public key "testuser (nocomment) <testuser@testemail.com>" imported
gpg: key 7B31316B5D64AD52: "testuser (nocomment) <testuser@testemail.com>" not changed
gpg: key 7B31316B5D64AD52/7B31316B5D64AD52: error sending to agent: Inappropriate ioctl for device
gpg: error building skey array: Inappropriate ioctl for device
gpg: Total number processed: 2
gpg:               imported: 1
gpg:              unchanged: 1
gpg:       secret keys read: 1

----------------------------------------------------------------------
Comment 14 Alexander Kanavin 2017-09-12 10:47:40 UTC
Please open a new bug, as this is a different issue.