mishamosher / CentOS-WSL

A GitHub Actions automated CentOS RootFS to use with WSL
MIT License
1.32k stars 207 forks source link

CentOS Stream 9 on WSL1: error on importing (any) GPG key #14

Open changhe3 opened 2 years ago

changhe3 commented 2 years ago
# dnf update
CentOS Stream 9 - BaseOS                    1.4 MB/s | 5.8 MB     00:04
CentOS Stream 9 - AppStream                 5.4 MB/s |  15 MB     00:02
CentOS Stream 9 - Extras packages           7.0 kB/s | 8.5 kB     00:01
Dependencies resolved.
============================================================================ Package                  Arch    Version                  Repository  Size
============================================================================Installing:
 kernel                   x86_64  5.14.0-134.el9           baseos     1.5 M
Upgrading:
 NetworkManager           x86_64  1:1.39.10-1.el9          baseos     2.1 M
 NetworkManager-libnm     x86_64  1:1.39.10-1.el9          baseos     1.7 M
 NetworkManager-team      x86_64  1:1.39.10-1.el9          baseos      36 k
 NetworkManager-tui       x86_64  1:1.39.10-1.el9          baseos     229 k
 ca-certificates          noarch  2022.2.54-90.0.el9       baseos     856 k
 cockpit-bridge           x86_64  273-1.el9                baseos     269 k
 cockpit-system           noarch  273-1.el9                baseos     3.6 M
 cockpit-ws               x86_64  273-1.el9                baseos     783 k
 dhcp-client              x86_64  12:4.4.2-17.b1.el9       baseos     790 k
 dhcp-common              noarch  12:4.4.2-17.b1.el9       baseos     129 k
 dracut                   x86_64  057-10.git20220721.el9   baseos     452 k
 dracut-config-generic    x86_64  057-10.git20220721.el9   baseos      11 k
 dracut-network           x86_64  057-10.git20220721.el9   baseos      79 k
 dracut-squash            x86_64  057-10.git20220721.el9   baseos      12 k
 kernel-tools             x86_64  5.14.0-134.el9           baseos     1.7 M
 kernel-tools-libs        x86_64  5.14.0-134.el9           baseos     1.5 M
 kexec-tools              x86_64  2.0.24-5.el9             baseos     480 k
 libselinux               x86_64  3.4-3.el9                baseos      86 k
 libselinux-utils         x86_64  3.4-3.el9                baseos     182 k
 lshw                     x86_64  B.02.19.2-9.el9          baseos     328 k
 openssl                  x86_64  1:3.0.1-38.el9           baseos     1.2 M
 openssl-libs             x86_64  1:3.0.1-38.el9           baseos     2.1 M
 python3-libselinux       x86_64  3.4-3.el9                appstream  186 k
 selinux-policy           noarch  34.1.38-1.el9            baseos      62 k
 selinux-policy-targeted  noarch  34.1.38-1.el9            baseos     6.7 M
 setup                    noarch  2.13.7-7.el9             baseos     146 k
Installing dependencies:
 kernel-core              x86_64  5.14.0-134.el9           baseos      45 M
 kernel-modules           x86_64  5.14.0-134.el9           baseos      32 M

Transaction Summary
============================================================================Install   3 Packages
Upgrade  26 Packages

Total download size: 104 M
Is this ok [y/N]: y
Downloading Packages:
(1/29): kernel-5.14.0-134.el9.x86_64.rpm    1.9 MB/s | 1.5 MB     00:00
(2/29): NetworkManager-1.39.10-1.el9.x86_64 6.0 MB/s | 2.1 MB     00:00
(3/29): NetworkManager-libnm-1.39.10-1.el9. 4.9 MB/s | 1.7 MB     00:00
(4/29): NetworkManager-team-1.39.10-1.el9.x 463 kB/s |  36 kB     00:00
(5/29): NetworkManager-tui-1.39.10-1.el9.x8 2.1 MB/s | 229 kB     00:00
(6/29): ca-certificates-2022.2.54-90.0.el9. 4.0 MB/s | 856 kB     00:00
(7/29): cockpit-bridge-273-1.el9.x86_64.rpm 2.4 MB/s | 269 kB     00:00
(8/29): cockpit-system-273-1.el9.noarch.rpm 6.0 MB/s | 3.6 MB     00:00
(9/29): cockpit-ws-273-1.el9.x86_64.rpm     5.5 MB/s | 783 kB     00:00
(10/29): dhcp-client-4.4.2-17.b1.el9.x86_64 4.7 MB/s | 790 kB     00:00
(11/29): dhcp-common-4.4.2-17.b1.el9.noarch 1.3 MB/s | 129 kB     00:00
(12/29): dracut-057-10.git20220721.el9.x86_ 4.3 MB/s | 452 kB     00:00
(13/29): dracut-config-generic-057-10.git20 178 kB/s |  11 kB     00:00
(14/29): dracut-network-057-10.git20220721. 958 kB/s |  79 kB     00:00
(15/29): kernel-modules-5.14.0-134.el9.x86_ 8.6 MB/s |  32 MB     00:03
(16/29): dracut-squash-057-10.git20220721.e  25 kB/s |  12 kB     00:00
(17/29): kernel-tools-5.14.0-134.el9.x86_64 4.7 MB/s | 1.7 MB     00:00
(18/29): kernel-tools-libs-5.14.0-134.el9.x 3.8 MB/s | 1.5 MB     00:00
(19/29): kexec-tools-2.0.24-5.el9.x86_64.rp 4.3 MB/s | 480 kB     00:00
(20/29): libselinux-3.4-3.el9.x86_64.rpm    1.0 MB/s |  86 kB     00:00
(21/29): libselinux-utils-3.4-3.el9.x86_64. 2.5 MB/s | 182 kB     00:00
(22/29): lshw-B.02.19.2-9.el9.x86_64.rpm    3.4 MB/s | 328 kB     00:00
(23/29): openssl-3.0.1-38.el9.x86_64.rpm    5.4 MB/s | 1.2 MB     00:00
(24/29): openssl-libs-3.0.1-38.el9.x86_64.r 8.7 MB/s | 2.1 MB     00:00
(25/29): selinux-policy-34.1.38-1.el9.noarc 841 kB/s |  62 kB     00:00
(26/29): setup-2.13.7-7.el9.noarch.rpm      1.9 MB/s | 146 kB     00:00
(27/29): python3-libselinux-3.4-3.el9.x86_6 2.3 MB/s | 186 kB     00:00
(28/29): kernel-core-5.14.0-134.el9.x86_64. 7.3 MB/s |  45 MB     00:06
(29/29): selinux-policy-targeted-34.1.38-1. 4.2 MB/s | 6.7 MB     00:01
----------------------------------------------------------------------------Total                                        13 MB/s | 104 MB     00:08
CentOS Stream 9 - BaseOS                    1.6 MB/s | 1.6 kB     00:00
Importing GPG key 0x8483C65D:
 Userid     : "CentOS (CentOS Official Signing Key) <security@centos.org>"
 Fingerprint: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
Is this ok [y/N]: y
Key imported successfully
error: sqlite failure: CREATE TABLE IF NOT EXISTS 'Packages' (hnum INTEGER PRIMARY KEY AUTOINCREMENT,blob BLOB NOT NULL): locking protocol
error: cannot open Packages index using sqlite - No such file or directory (2)
error: cannot open Packages database in /var/lib/rpm
Import of key(s) didn't help, wrong key(s)?
error: sqlite failure: CREATE TABLE IF NOT EXISTS 'Packages' (hnum INTEGER PRIMARY KEY AUTOINCREMENT,blob BLOB NOT NULL): locking protocol
error: cannot open Packages index using sqlite - No such file or directory (2)
error: cannot open Packages database in /var/lib/rpm
error: sqlite failure: CREATE TABLE IF NOT EXISTS 'Packages' (hnum INTEGER PRIMARY KEY AUTOINCREMENT,blob BLOB NOT NULL): locking protocol
error: cannot open Packages index using sqlite - No such file or directory (2)
error: cannot open Packages database in /var/lib/rpm
error: sqlite failure: CREATE TABLE IF NOT EXISTS 'Packages' (hnum INTEGER PRIMARY KEY AUTOINCREMENT,blob BLOB NOT NULL): locking protocol
error: cannot open Packages index using sqlite - No such file or directory (2)
error: cannot open Packages database in /var/lib/rpm
error: sqlite failure: CREATE TABLE IF NOT EXISTS 'Packages' (hnum INTEGER PRIMARY KEY AUTOINCREMENT,blob BLOB NOT NULL): locking protocol
error: cannot open Packages index using sqlite - No such file or directory (2)
error: cannot open Packages database in /var/lib/rpm
error: sqlite failure: CREATE TABLE IF NOT EXISTS 'Packages' (hnum INTEGER PRIMARY KEY AUTOINCREMENT,blob BLOB NOT NULL): locking protocol
error: cannot open Packages index using sqlite - No such file or directory (2)
error: cannot open Packages database in /var/lib/rpm
error: sqlite failure: CREATE TABLE IF NOT EXISTS 'Packages' (hnum INTEGER PRIMARY KEY AUTOINCREMENT,blob BLOB NOT NULL): locking protocol
error: cannot open Packages index using sqlite - No such file or directory (2)
error: cannot open Packages database in /var/lib/rpm
error: sqlite failure: CREATE TABLE IF NOT EXISTS 'Packages' (hnum INTEGER PRIMARY KEY AUTOINCREMENT,blob BLOB NOT NULL): locking protocol
error: cannot open Packages index using sqlite - No such file or directory (2)
error: cannot open Packages database in /var/lib/rpm
error: sqlite failure: CREATE TABLE IF NOT EXISTS 'Packages' (hnum INTEGER PRIMARY KEY AUTOINCREMENT,blob BLOB NOT NULL): locking protocol
error: cannot open Packages index using sqlite - No such file or directory (2)
error: cannot open Packages database in /var/lib/rpm
Killed
changhe3 commented 2 years ago

update-crypto-policies --set DEFAULT:SHA1 fix the problem temporarily but the problem persists when you need to import another key.

mishamosher commented 2 years ago

Are you using WSL version 1? You can always run DNF with the --nogpgcheck parameter to skip GPG key checks.

Also, you can try the solutions described in:

changhe3 commented 2 years ago

switch to wsl 2 fixes the issue, but for wsl 1 aforementioned "solution" doesn't really seem to do anything since I can sort of "fix" the problem even just by killing the dnf process and restart it. It's super weird...

changhe3 commented 2 years ago

one possible workaround (if you are stuck with WSL1) is to comment out gpgcheck=1 in /etc/dnf/dnf.conf.