Alexpux / MSYS2-pacman

MSYS2 port of Arch Linux packman package manager.
GNU General Public License v2.0
164 stars 34 forks source link

Cannot update older msys2 - "key ... could not be looked up remotely"? #63

Closed sdaau closed 4 years ago

sdaau commented 4 years ago

I have a MSYS2 installation that I haven't updated for at least a year or so; so I tried it today, and I got:

$ pacman -Syu
:: Synchronizing package databases...
 mingw32                  472.5 KiB  34.5K/s 00:14 [#####################] 100%
 mingw32.sig              438.0   B  0.00B/s 00:00 [#####################] 100%
error: mingw32: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown
error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely
error: failed to update mingw32 (invalid or corrupted database (PGP signature))
 mingw64                  475.0 KiB  39.8K/s 00:12 [#####################] 100%
 mingw64.sig              438.0   B  0.00B/s 00:00 [#####################] 100%
error: mingw64: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown
error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely
error: failed to update mingw64 (invalid or corrupted database (PGP signature))
 msys                     189.8 KiB  26.8K/s 00:07 [#####################] 100%
 msys.sig                 438.0   B  0.00B/s 00:00 [#####################] 100%
error: msys: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" is unknown
error: key "4A6129F4E4B84AE46ED7F635628F528CF3053E04" could not be looked up remotely
error: failed to update msys (invalid or corrupted database (PGP signature))
error: failed to synchronize all databases

I found posts like: Problem refreshing pacman keys / Pacman & Package Upgrade Issues / Arch Linux Forums - so tried as in there:

$ pacman-key --init

$ pacman-key --populate msys2
==> Appending keys from msys2.gpg...
==> Locally signing trusted keys in keyring...
  -> Locally signing key D55E7A6D7CE9BA1587C0ACACF40D263ECA25678A...
  -> Locally signing key 123D4D51A1793859C2BE916BBBE514E53E0D0813...
  -> Locally signing key B91BCF3303284BF90CC043CA9F418C233E652008...
  -> Locally signing key 9DD0D4217D75A33B896159E6DA7EF2ABAEEA755C...
==> Importing owner trust values...
==> Updating trust database...
gpg: no need for a trustdb check

$ pacman-key --refresh-keys
gpg: refreshing 8 keys from hkps://hkps.pool.sks-keyservers.net
gpg: keyserver refresh failed: General error
==> ERROR: A specified local key could not be updated from a keyserver.

Can I somehow fix this and upgrade this MSYS2 installation without reinstalling?

jack6th commented 4 years ago

Same problem. I solved it.
I use 32bit msys2 rather than 64bit.
There is no new keyring package for 32bit. But 64bit package also works.
Perhaps it should be provided.
Because without it 32-bit msys2 user cannot search or update packages any more.

Per
https://www.msys2.org/news/#2020-05-17-32-bit-msys2-no-longer-actively-supported

2020-05-17 - 32-bit MSYS2 no longer actively supported 32-bit mingw-w64 packages are still supported, this is about the POSIX emulation layer, i.e. the runtime, Bash, MinTTY...

Per https://www.msys2.org/news/#2020-06-29-new-packagers

curl -O http://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz
curl -O http://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig
pacman-key --verify msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz{.sig,}
pacman -U --config <(echo) msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz
pacman-key --init
pacman-key --populate msys2
sdaau commented 4 years ago

Many thanks, @jack6th - that seems to have worked great; I just had some sort of a hiccup here:

$ pacman-key --verify msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz{.sig,}
==> Checking msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig...
gpg: assuming signed data in 'msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz'
gpg: Signature made Mon, Jun 29, 2020  7:36:14 AM CEST
gpg:                using DSA key AD351C50AE085775EB59333B5F92EFC1A47D45A1
gpg: Good signature from "Alexey Pavlov (Alexpux) <alexpux@gmail.com>" [full]
==> Checking msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz...
gpg: [don't know]: invalid packet (ctb=3f)
gpg: no signature found
gpg: the signature could not be verified.
Please remember that the signature file (.sig or .asc)
should be the first file given on the command line.
==> ERROR: The signature identified by msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz could not be verified.

Apparently, this is enough for me (maybe I had a too old pacman-key in my case):

$ pacman-key --verify msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig
==> Checking msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig...
gpg: assuming signed data in 'msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz'
gpg: Signature made Mon, Jun 29, 2020  7:36:14 AM CEST
gpg:                using DSA key AD351C50AE085775EB59333B5F92EFC1A47D45A1
gpg: Good signature from "Alexey Pavlov (Alexpux) <alexpux@gmail.com>" [full]

But after the procedure you listed, now pacman -Syu process starts fine on my machine:

$ pacman -Syu
:: Synchronizing package databases...
 mingw32 is up to date
 mingw64 is up to date
 msys is up to date
:: Starting core system upgrade...
warning: terminate other MSYS2 programs before proceeding
resolving dependencies...
looking for conflicting packages...

Packages (7) bash-4.4.023-2  filesystem-2020.02-5  mintty-1~3.2.0-1
             msys2-runtime-3.1.6-1  pacman-5.2.2-1  pacman-mirrors-20200329-1
             zstd-1.4.5-2

Total Download Size:    16.35 MiB
Total Installed Size:   57.61 MiB
Net Upgrade Size:      -12.88 MiB

:: Proceed with installation? [Y/n] y

... so let's hope it finishes fine! :)

Since this seems to work, I'll close this issue.


EDIT: one more comment - all seems to work, just note that after the above "core system upgrade" is done, and you've closed the MSYS2 terminal window as recommended - MSYS2 will afterwards fail to start (clicking the shortcuts will not start any terminal window), until you reboot Windows; after you've rebooted windows, MSYS2 terminal will start, and then you can do again pacman -Syu (or just -Su) for the "full system upgrade", and it will work fine.

ayunami2000 commented 4 years ago

@sdaau Instead of rebooting Windows, you can just go to task manager and kill msys2, dirmnger, and gpg-agent. Reference