<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>15690</bug_id>
          
          <creation_ts>2024-12-12 09:50:53 +0000</creation_ts>
          <short_desc>AB-INT: package_write_rpm gpg exec failed</short_desc>
          <delta_ts>2026-07-30 15:19:02 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>5.99</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>OBSOLETE</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>AB-INT</status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>6.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mathieu Dubois-Briand">mathieu.dubois-briand</reporter>
          <assigned_to name="Unassigned">unassigned</assigned_to>
          <cc>ccasciato</cc>
    
    <cc>levi.shafter</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>paul</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>yoann.congal</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>100410</commentid>
    <comment_count>0</comment_count>
    <who name="Mathieu Dubois-Briand">mathieu.dubois-briand</who>
    <bug_when>2024-12-12 09:50:53 +0000</bug_when>
    <thetext>&gt; 2063 ERROR: ed-1.20.2-r0 do_package_write_rpm: Error executing a python function in exec_func_python() autogenerated:
&gt; ...
&gt; 2112 Subprocess output:
&gt; 2113 warning: Could not set GPG_TTY to stdin: Inappropriate ioctl for device
&gt; 2114 gpg: signing failed: Corrupted protection
&gt; 2115 gpg: signing failed: Corrupted protection
&gt; 2116 error: gpg exec failed (2)

https://valkyrie.yoctoproject.org/#/builders/76/builds/566</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100412</commentid>
    <comment_count>1</comment_count>
    <who name="Mathieu Dubois-Briand">mathieu.dubois-briand</who>
    <bug_when>2024-12-12 09:53:19 +0000</bug_when>
    <thetext>oe-selftest-centos alma9-vk-1 master completed at 2024-12-08T02:22:17Z
https://valkyrie.yoctoproject.org/#/builders/76/builds/566/steps/14/logs/stdio</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100430</commentid>
    <comment_count>2</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-12-12 15:54:08 +0000</bug_when>
    <thetext>gpg can run as a server so that may be a factor.
There were also changes in the gpg recipe.

Wait to see if the happens again.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101838</commentid>
    <comment_count>3</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2025-05-01 14:07:11 +0000</bug_when>
    <thetext>Bulk move of all unassigned 5.2 medium importance bugs to 5.3.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102132</commentid>
    <comment_count>4</comment_count>
    <who name="Mathieu Dubois-Briand">mathieu.dubois-briand</who>
    <bug_when>2025-06-04 07:45:03 +0000</bug_when>
    <thetext>oe-selftest-fedora fedora39-vk-2 master-next completed at 2025-06-03T16:11:02Z
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/1624/steps/14/logs/stdio</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102204</commentid>
    <comment_count>5</comment_count>
    <who name="Clayton Casciato">ccasciato</who>
    <bug_when>2025-06-06 13:34:17 +0000</bug_when>
    <thetext>Our team has been seeing a similar intermittent issue for both Kirkstone and Scarthgap:
&quot;warning: Could not set GPG_TTY to stdin: Inappropriate ioctl for device&quot;

If we keep reattempting the build, it eventually succeeds.

Sample with redactions via [...]:
ERROR: [...] do_package_write_rpm: Error executing a python function in exec_func_python() autogenerated:
    
The stack trace of python calls that resulted in this exception/failure was:
File: &apos;exec_func_python() autogenerated&apos;, lineno: 2, function: &lt;module&gt;    
     0001:
 *** 0002:sign_rpm(d)
     0003:
File: &apos;[...]/openembedded-core/meta/classes/sign_rpm.bbclass&apos;, lineno: 59, function: sign_rpm
     0055:
     0056:    signer = get_signer(d, d.getVar(&apos;RPM_GPG_BACKEND&apos;))
     0057:    rpms = glob.glob(d.getVar(&apos;RPM_PKGWRITEDIR&apos;) + &apos;/*&apos;)
     0058:
 *** 0059:    signer.sign_rpms(rpms,
     0060:                     d.getVar(&apos;RPM_GPG_NAME&apos;),
     0061:                     d.getVar(&apos;RPM_GPG_PASSPHRASE&apos;),
     0062:                     d.getVar(&apos;RPM_FILE_CHECKSUM_DIGEST&apos;),
     0063:                     int(d.getVar(&apos;RPM_GPG_SIGN_CHUNK&apos;)),
File: &apos;[...]/openembedded-core/meta/lib/oe/gpg_sign.py&apos;, lineno: 59, function: sign_rpms
     0055:                cmd += &quot;--define &apos;_file_signing_key_password %s&apos; &quot; % fsk_password
     0056:
     0057:        # Sign in chunks
     0058:        for i in range(0, len(files), sign_chunk):
 *** 0059:            subprocess.check_output(shlex.split(cmd + &apos; &apos;.join(files[i:i+sign_chunk])), stderr=subprocess.STDOUT)
     0060:
     0061:    def detach_sign(self, input_file, keyid, passphrase_file, passphrase=None, armor=True, output_suffix=None, use_sha256=False):
     0062:        &quot;&quot;&quot;Create a detached signature of a file&quot;&quot;&quot;
     0063:
File: &apos;/usr/lib/python3.10/subprocess.py&apos;, lineno: 421, function: check_output
     0417:        else:
     0418:            empty = b&apos;&apos; 
     0419:        kwargs[&apos;input&apos;] = empty
     0420:
 *** 0421:    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
     0422:               **kwargs).stdout
     0423:
     0424:
     0425:class CompletedProcess(object):
File: &apos;/usr/lib/python3.10/subprocess.py&apos;, lineno: 526, function: run 
     0522:            # We don&apos;t call process.wait() as .__exit__ does that for us. 
     0523:            raise
     0524:        retcode = process.poll()
     0525:        if check and retcode: 
 *** 0526:            raise CalledProcessError(retcode, process.args,
     0527:                                     output=stdout, stderr=stderr)
     0528:    return CompletedProcess(process.args, retcode, stdout, stderr)
     0529:
     0530:
Exception: subprocess.CalledProcessError: Command &apos;[&apos;[...]/build/tmp-beaglebone-glibc/work/beaglebone-[...]-linux-gnueabi/packagegroup-[...]-security/1.0-r0/recipe-sysroot-native/usr/bin/rpmsign&apos;, &apos;--addsign&apos;, &apos;--define&apos;, &apos;_gpg_name [...]&apos;, &apos;--define&apos;, &apos;_gpg_sign_cmd_extra_args --no-permission-warning --batch --passphrase=[...] --agent-program=[...]/build/tmp-beaglebone-glibc/work/beaglebone-[...]-linux-gnueabi/packagegroup-[...]-security/1.0-r0/recipe-sysroot-native/usr/bin/gpg-agent|--auto-expand-secmem --pinentry-mode=loopback&apos;, &apos;--define&apos;, &apos;_binary_filedigest_algorithm 8&apos;, &apos;--define&apos;, &apos;__gpg [...]/build/tmp-beaglebone-glibc/work/beaglebone-[...]-linux-gnueabi/packagegroup-[...]-security/1.0-r0/recipe-sysroot-native/usr/bin/gpg&apos;, &apos;--define&apos;, &apos;_gpg_path [...]&apos;, &apos;[...]/build/tmp-beaglebone-glibc/work/beaglebone-[...]-linux-gnueabi/packagegroup-[...]-security/1.0-r0/deploy-rpms/beaglebone/packagegroup-[...]-security-dev-1.0-r0.beaglebone.rpm&apos;, &apos;[...]/build/tmp-beaglebone-glibc/work/beaglebone-[...]-linux-gnueabi/packagegroup-[...]-security/1.0-r0/deploy-rpms/beaglebone/packagegroup-[...]-security-dbg-1.0-r0.beaglebone.rpm&apos;, &apos;[...]/build/tmp-beaglebone-glibc/work/beaglebone-[...]-linux-gnueabi/packagegroup-[...]-security/1.0-r0/deploy-rpms/beaglebone/packagegroup-[...]-security-1.0-r0.beaglebone.rpm&apos;]&apos; returned non-zero exit status 1.

Subprocess output:
warning: Could not set GPG_TTY to stdin: Inappropriate ioctl for device
warning: Could not set GPG_TTY to stdin: Inappropriate ioctl for device
warning: Could not set GPG_TTY to stdin: Inappropriate ioctl for device
gpg: signing failed: Connection reset by peer
gpg: signing failed: Connection reset by peer
error: gpg exec failed (2) 
[...]/build/tmp-beaglebone-glibc/work/beaglebone-[...]-linux-gnueabi/packagegroup-[...]-security/1.0-r0/deploy-rpms/beaglebone/packagegroup-[...]-security-dev-1.0-r0.beaglebone.rpm:
[...]/build/tmp-beaglebone-glibc/work/beaglebone-[...]-linux-gnueabi/packagegroup-[...]-security/1.0-r0/deploy-rpms/beaglebone/packagegroup-[...]-security-dbg-1.0-r0.beaglebone.rpm:
[...]/build/tmp-beaglebone-glibc/work/beaglebone-[...]-linux-gnueabi/packagegroup-[...]-security/1.0-r0/deploy-rpms/beaglebone/packagegroup-[...]-security-1.0-r0.beaglebone.rpm:

ERROR: Logfile of failure stored in: [...]/build/tmp-beaglebone-glibc/work/beaglebone-[...]-linux-gnueabi/packagegroup-21sw-security/1.0-r0/temp/log.do_package_write_rpm.1067898
ERROR: Task ([...]/meta-[...]/recipes-core/packagegroups/packagegroup-[...]-security.bb:do_package_write_rpm) failed with exit code &apos;1&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102291</commentid>
    <comment_count>6</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2025-06-18 19:05:43 +0000</bug_when>
    <thetext>Clayton,

How often does it happen out of say 10 or 100 builds for you?
What is your build host distro and HW (cpus, mem, storage)?

Have you tried stracing all or part of the failure and
comparing it to when the build works? :-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102382</commentid>
    <comment_count>7</comment_count>
    <who name="Clayton Casciato">ccasciato</who>
    <bug_when>2025-07-03 13:52:06 +0000</bug_when>
    <thetext>Hi, Randy

We&apos;ve seen this on multiple Ubuntu systems (typically 22.04) including:
Ryzen 7000 Series, 96 GB RAM, PCIe 4.0 NVMe storage
Intel 14th gen mobile, 96 GB RAM, PCIe 4.0 NVMe storage

I haven&apos;t seen this for a while, though signed builds are ad-hoc (partially due to this issue). From my memory, it could happen 6 build attempts in a row (or work just fine).

Debugging attempts have mostly been focused on GPG (no luck); we haven&apos;t tried strace (but will keep it in mind for the future).

I&apos;m wondering if this problem surfaces with rpm-sequoia: https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/rpm-sequoia?h=walnascar</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102787</commentid>
    <comment_count>8</comment_count>
    <who name="levi.shafter@elder-tomes.com">levi.shafter</who>
    <bug_when>2025-09-16 21:32:58 +0000</bug_when>
    <thetext>I have been investigating this issue, but I&apos;m stumped.

I noticed that the command generated by the `LocalSigner.sign_rpms()&apos; method in `openembedded-core: gpg_sign.py` was erroneous:


--agent-program=[...]/build/tmp-beaglebone-glibc/work/armv7at2hf-neon-21software-linux-gnueabi/p11-kit/0.25.3/recipe-sysroot-native/usr/bin/gpg-agent|--auto-expand-secmem

Upon replacing the | character with a space in the script, the same error was still intermittently observed.

I took an `strace` of our build process, but the only relevant logging I could find was in `bitbake-cookerdaemon.log`:


0:openat(AT_FDCWD,
         &quot;[...]/build/bitbake-cookerdaemon.log&quot;,
         O_RDWR|O_CREAT|O_APPEND|O_CLOEXEC, 0666) = 6

1580578:11:fstat(6, {st_mode=S_IFREG|0664, st_size=411537764, ...}) = 0

1580578:12:lseek(6, 0, SEEK_END) = 411537764

1580578:13:ioctl(6, TCGETS, 0x7fff62fbd650) = -1 ENOTTY (Inappropriate ioctl for device)

Upon investigating `bitbake-cookerdaemon.log`:

11270 12:59:30.506658 Exception in server main event loop running command [] (Traceback (most recent call last):
  File &quot;[...]/bitbake/lib/bb/server/process.py&quot;, line 298, in main
    self.command_channel_reply.send(reply)
  File &quot;[...]/bitbake/lib/bb/server/process.py&quot;, line 890, in send
    self._send(obj)
  File &quot;[...]/bitbake/lib/bb/server/process.py&quot;, line 869, in _send
    self.writer.send_bytes(obj)
  File &quot;/usr/lib/python3.12/multiprocessing/connection.py&quot;, line 200, in send_bytes
    self._send_bytes(m[offset:offset + size])
  File &quot;/usr/lib/python3.12/multiprocessing/connection.py&quot;, line 427, in _send_bytes
    self._send(header + buf)
  File &quot;/usr/lib/python3.12/multiprocessing/connection.py&quot;, line 384, in _send
    n = write(self._handle, buf)
        ^^^^^^^^^^^^^^^^^^^^^^^^
BrokenPipeError: [Errno 32] Broken pipe

Tracing code execution, the only method that appears to be capable of throwing a BrokenPipeError is `ConnectionWriter._send` in `bitbake/lib/bb/server/process.py`. Thinking perhaps the issue is being caused by concurrent signing tasks during the build process, I tried serializing the `do_package_write_rpm` tasks, but the same issue intermittently persists.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102839</commentid>
    <comment_count>9</comment_count>
    <who name="Clayton Casciato">ccasciato</who>
    <bug_when>2025-09-26 16:46:19 +0000</bug_when>
    <thetext>After backporting rpm-sequoia to a local Scarthgap build, there are still intermittent failures.

The stack trace is the same as with rpm.bb&apos;s &quot;internal-openpgp&quot;.

However, there is a new line at the start of the subprocess output:

couldn&apos;t allocate absolute path for &apos;null&apos;.
warning: Could not set GPG_TTY to stdin: Inappropriate ioctl for device
gpg: problem with fast path key listing: End of file - ignored
gpg: keydb_search failed: Broken pipe
gpg: skipped &quot;[REDACTED_KEY]&quot;: Broken pipe
gpg: signing failed: Broken pipe
error: gpg exec failed (2)

NB: the specific subprocess output varies and we&apos;ve seen this one before (with &quot;internal-openpgp&quot;).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104941</commentid>
    <comment_count>10</comment_count>
    <who name="Clayton Casciato">ccasciato</who>
    <bug_when>2026-04-02 15:20:14 +0000</bug_when>
    <thetext>https://rpm.org/releases/6.0.0:
&quot;rpmsign can use either GnuPG or Sequoia-sq for signing&quot;

&quot;[PATCH v8 7/9] rpm: 4.20.1 -&gt; 6.0.1&quot;:
https://lists.openembedded.org/g/openembedded-core/message/232961</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106391</commentid>
    <comment_count>11</comment_count>
    <who name="Paul Barker">paul</who>
    <bug_when>2026-07-30 15:19:02 +0000</bug_when>
    <thetext>Hi Clayton,

We discussed in YP Bug review call, we are no longer seeing the AB-INT issue in the Yocto autobuilder.

There appear to be two different failure modes:
- On the autobuilder we saw &quot;gpg: signing failed: Corrupted protection&quot;
- Clayton saw &quot;signing failed: Connection reset by peer&quot; and &quot;signing failed: Broken pipe&quot;

I don&apos;t think the GPG_TTY warning is likely to be the cause of the failure.

We&apos;re going to close this issue as the original failure is resolved.

Clayton, please re-open a new bug if you&apos;re still seeing failures. We&apos;ve made a lot of fixes in pseudo which hopefully will resolve your issue if you update to the latest scarthgap commit.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>