Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 948671 - i486-openrc stage 3 libsqlite3.so from dev-db/sqlite has non-486 opcodes, unable to emerge-webrsync without --no-pgp-verify
Summary: i486-openrc stage 3 libsqlite3.so from dev-db/sqlite has non-486 opcodes, una...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Release Media
Classification: Unclassified
Component: Stages (show other bugs)
Hardware: x86 Linux
: Normal normal
Assignee: Gentoo Release Team
URL: https://sqlite.org/forum/forumpost/45...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-24 19:25 UTC by Joshua Coombs
Modified: 2025-01-26 14:21 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Coombs 2025-01-24 19:25:05 UTC
A clean chroot on a real 486 (Soekris 4501 / AMD Elan) going through the handbook steps for installing fails at the initial emerge-webrsync with:

 * Checking digest ...
 * Checking signature ...
[   INFO] Refreshing keys...
[11668.369857] traps: gpg[1258] trap invalid opcode ip:b7dfaa0e sp:bfda6f30 error:0 in libsqlite3.so.0.8.6[b7d1f000+14a000]
[  ERROR] OpenPGP keyring refresh failed:
gpg: key DB6B8C1F96D8BF6D: 18 signatures not checked due to missing keys

 * ERROR: /:: failed:
 *   signature verification failed
 * 
 * If you need support, post the output of `emerge --info '=/::'`,
 * the complete build log and the output of `emerge -pqv '=/::'`.
 * Working directory: '/var/tmp/portage/webrsync-TpMqGO'

Reproducible: Always

Steps to Reproduce:
1. Prep a clean chroot on a 486 using stage3-i486-openrc-20250120T170329Z.tar.xz as per the x86 Handbook.
2. Attempt emerge-webrsync
Actual Results:  
(chroot)root@vicious ~ # emerge-webrsync 
 * PGP verification method: gemato
 * Fetching most recent snapshot ...
 * Trying to retrieve 20250123 snapshot from http://distfiles.gentoo.org ...
 * Fetching file gentoo-20250123.tar.xz.md5sum ...
--2025-01-24 14:03:57--  http://distfiles.gentoo.org/snapshots/gentoo-20250123.tar.xz.md5sum
Resolving distfiles.gentoo.org... 79.127.206.207, 79.127.206.235, 2a02:6ea0:c400::53, ...
Connecting to distfiles.gentoo.org|79.127.206.207|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 57 [application/x-xz]
Saving to: ‘/var/tmp/portage/webrsync-uHbIz7/gentoo-20250123.tar.xz.md5sum’

/var/tmp/portage/we 100%[===================>]      57  --.-KB/s    in 0.001s  

2025-01-24 14:04:00 (88.8 KB/s) - ‘/var/tmp/portage/webrsync-uHbIz7/gentoo-20250123.tar.xz.md5sum’ saved [57/57]

 * Fetching file gentoo-20250123.tar.xz.gpgsig ...
--2025-01-24 14:04:00--  http://distfiles.gentoo.org/snapshots/gentoo-20250123.tar.xz.gpgsig
Resolving distfiles.gentoo.org... 79.127.206.207, 79.127.206.235, 2a02:6ea0:c400::53, ...
Connecting to distfiles.gentoo.org|79.127.206.207|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 963 [application/x-xz]
Saving to: ‘/var/tmp/portage/webrsync-uHbIz7/gentoo-20250123.tar.xz.gpgsig’

/var/tmp/portage/we 100%[===================>]     963  --.-KB/s    in 0.001s  

2025-01-24 14:04:00 (1.34 MB/s) - ‘/var/tmp/portage/webrsync-uHbIz7/gentoo-20250123.tar.xz.gpgsig’ saved [963/963]

 * Fetching file gentoo-20250123.tar.xz ...
--2025-01-24 14:04:01--  http://distfiles.gentoo.org/snapshots/gentoo-20250123.tar.xz
Resolving distfiles.gentoo.org... 79.127.206.235, 79.127.206.207, 2a02:6ea0:c400::54, ...
Connecting to distfiles.gentoo.org|79.127.206.235|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 46870224 (45M) [application/x-xz]
Saving to: ‘/var/tmp/portage/webrsync-uHbIz7/gentoo-20250123.tar.xz’

/var/tmp/portage/we 100%[===================>]  44.70M   968KB/s    in 62s     

2025-01-24 14:05:03 (734 KB/s) - ‘/var/tmp/portage/webrsync-uHbIz7/gentoo-20250123.tar.xz’ saved [46870224/46870224]

 * Checking digest ...
 * Checking signature ...
[   INFO] Refreshing keys...
[167321.859857] traps: gpg[4094] trap invalid opcode ip:b7e8ba0e sp:bff7e3e0 error:0 in libsqlite3.so.0.8.6[b7db0000+14a000]
[  ERROR] OpenPGP keyring refresh failed:
gpg: key 9E6438C817072058: 84 signatures not checked due to missing keys

 * ERROR: /:: failed:
 *   signature verification failed
 * 
 * If you need support, post the output of `emerge --info '=/::'`,
 * the complete build log and the output of `emerge -pqv '=/::'`.
 * Working directory: '/var/tmp/portage/webrsync-uHbIz7'
(chroot)root@vicious ~ # cat /proc/cpuinfo 
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 4
model           : 15
model name      : Am5x86-WB
stepping        : 4
fdiv_bug        : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu cpuid vmmcall
bugs            : sysret_ss_attrs itlb_multihit
bogomips        : 66.35
clflush size    : 32
cache_alignment : 32
address sizes   : 32 bits physical, 32 bits virtual
power management:

(chroot)root@vicious ~ # 

Expected Results:  
emerge-webrsync completes and I can proceed with the install.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-25 11:24:35 UTC
Thanks. We discussed it on IRC and amonakov confirmed it's rdtsc (https://github.com/sqlite/sqlite/blob/dea434ea6513a3f91bf15ce4106db0c54a9d6161/src/hwtime.h#L20).

Will fix shortly.
Comment 2 Larry the Git Cow gentoo-dev 2025-01-25 12:49:27 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2b5e0d06d46241cc2d8c58b7e4a32527534cb4b1

commit 2b5e0d06d46241cc2d8c58b7e4a32527534cb4b1
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2025-01-25 12:12:48 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-01-25 12:48:56 +0000

    dev-db/sqlite: Don't use rdtsc on i486
    
    If -DSQLITE_ENABLE_STMT_SCANSTATUS is passed, rdtsc is used for profiling
    purposes, but that's not available on i486 CPUs (e.g. Soekris 4501 / AMD Elan
    in the linked bug).
    
    Just look for i586 instead of i386. For the i386/i486 case, it's fine if we
    use the stub implementation. This feels cleaner than toggling functionality
    in the ebuild, even if it's unlikely anyone on i486 is going to use that.
    
    Thanks to amonakov who found the problem quickly and the relevant part of SQLite.
    
    SQLITE_ENABLE_STMT_SCANSTATUS was first enabled with 6d8922b1541e86d62546808b1edca6fe422fc560
    (grafted from migration), but I suspect the reason nobody noticed this before is
    (apart from i486 being rare) that only fairly recent gnupg-2.4.x starts to use
    SQLite (and we default-enable USE=tofu in-line with some upstream reocmmendations).
    
    Bug: https://bugs.gentoo.org/948671
    Signed-off-by: Sam James <sam@gentoo.org>

 ...e-3.47.2-hwtime.h-Don-t-use-rdtsc-on-i486.patch | 31 ++++++++++++++++++++++
 ...qlite-3.47.2.ebuild => sqlite-3.47.2-r1.ebuild} |  1 +
 ...qlite-3.48.0.ebuild => sqlite-3.48.0-r1.ebuild} |  4 +++
 dev-db/sqlite/sqlite-9999.ebuild                   |  6 ++++-
 4 files changed, 41 insertions(+), 1 deletion(-)
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-25 12:54:24 UTC
Once that change lands on mirrors, will ask if we can rebuild the i486 stage.
Comment 4 Larry the Git Cow gentoo-dev 2025-01-25 13:00:03 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=50d40e2d5e4a717ea3c15729353b4ae929383b01

commit 50d40e2d5e4a717ea3c15729353b4ae929383b01
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2025-01-25 12:59:21 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-01-25 12:59:21 +0000

    dev-db/sqlite: add upstream bug reference wrt rdtsc
    
    Bug: https://bugs.gentoo.org/948671
    Signed-off-by: Sam James <sam@gentoo.org>

 .../sqlite/files/sqlite-3.47.2-hwtime.h-Don-t-use-rdtsc-on-i486.patch   | 2 ++
 1 file changed, 2 insertions(+)
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-26 11:26:09 UTC
Rebuild started
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-26 14:21:22 UTC
Looks like it's done (stage3-i486-openrc-20250126T093335Z.tar.xz). Let us know if any other issues. Thanks!