skip to Main Content

I want to make a work env by Dockerfile From ArchLinux

docker build -t xiaoduoge/workenv .

RUN yes | pacman --sync --refresh
RUN yes | pacman --sync --needed archlinux-keyring
RUN yes | pacman-key --init
RUN yes | pacman -Syyu

but have the following error

:: Import PGP key 139B09DA5BF0D338, "David Runge [email protected]"? [Y/n] y
checking package integrity…
error: expat: key "991F6E3F0765CF6295888586139B09DA5BF0D338" is unknown
:: Import PGP key 991F6E3F0765CF6295888586139B09DA5BF0D338? [Y/n] y
:: File /var/cache/pacman/pkg/expat-2.5.0-1-x86_64.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n] y
:: File /var/cache/pacman/pkg/pambase-20221020-1-any.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n] y
:: File /var/cache/pacman/pkg/libcap-2.66-1-x86_64.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n] y
:: File /var/cache/pacman/pkg/gnupg-2.2.40-1-x86_64.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n] y
:: File /var/cache/pacman/pkg/shadow-4.11.1-3-x86_64.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n] y
error: failed to commit transaction (invalid or corrupted package)
Errors occurred, no packages were upgraded.
The command ‘/bin/sh -c yes | pacman -Syyu’ returned a non-zero code: 1

so what should I do to solve the problems?

2

Answers


  1. Chosen as BEST ANSWER

    I use these commands and solve my problems:

    RUN yes | pacman-key --init
    
    RUN yes | sudo pacman -Sy archlinux-keyring
    
    RUN yes | sudo pacman-key --populate archlinux
    
    RUN yes | sudo pacman -Syyu
    

  2. You have to manually sync the package database and upgrade the archlinux-keyring package before your system upgrade:

    pacman -Sy archlinux-keyring && pacman -Su
    

    This command is not considered a partial upgrade since it syncs the package database and upgrades the keyring package first.

    Source and further details in the Arch Wiki.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search