Cristian
Cristian

Reputation: 1670

Cannot upgrade Arch Linux (pacman -Syu not working)

I am running sudo pacman -Syu on my Arch Linux and I am getting the following:

cristian@localhost:~$ sudo pacman -Syu
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date
 xenlism-arch is up to date
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...
error: failed to prepare transaction (could not satisfy dependencies)
:: package-query: requires pacman<4.3

What's the solution to fix this?

UPDATE

I have tried both solutions sugested by @jham. I have completely removed yaourt and package-query. At pacman -Qi pacman at 'required by' I have none. I also commented multilib and xenlism-arch from pacman.conf. When I do pacman -Syu I get the following:

:: Proceed with installation? [Y/n] 
(244/244) checking keys in keyring                              [###################################] 100%
(244/244) checking package integrity                            [###################################] 100%
error: confuse: signature from "Thorsten Töpper <[email protected]>" is unknown trust
:: File /var/cache/pacman/pkg/confuse-2.8-2-x86_64.pkg.tar.xz is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n] 
error: failed to commit transaction (invalid or corrupted package)
Errors occurred, no packages were upgraded.

Upvotes: 35

Views: 42177

Answers (7)

Miguel Tom&#225;s
Miguel Tom&#225;s

Reputation: 1911

The following is for ArchLinux however applies to other Linux distros too. To correct an invalid KEY one needs to do the following:

rm -fr /etc/pacman.d/gnupg
pacman-key --init
pacman-key --populate archlinux

say the key throwing an error is in Blackarch then is also needed to :

sudo pacman-key --populate blackarch

and finally

sudo pacman -Sy archlinux-keyring
sudo pacman-key --populate archlinux
sudo pacman-key --refresh-keys

Upvotes: 1

Guray
Guray

Reputation: 143

If you still have an error. Try this:

sudo find /var/cache/pacman/pkg/ -iname "*.part" -exec rm {} \;

It removes .part files, which causes the "invalid or corrupted package" error. After you remove them, run this:

sudo pacman -Syyu

This should solve the problem, if there is no any missing key.

Upvotes: 2

dotbit
dotbit

Reputation: 5025

failed to prepare transaction (invalid or corrupted database)

Here it was due to the actual (faulty) mirror servers delivering junk.

comment out those standard servers and use a quality server e.g.

ftp://ftp5.gwdg.de/pub/linux/archlinux/community/os/x86_64/

Too bad that /etc/pacman.conf is so poorly commented, as if to deliberatly be unhelpful and feckless, always being vague, never concretely helpful. this was the last error in an seemingly endless ordain of errors from pacman. keys are unmanagable, servers are a mess, libs spell chaos. Took me more than 1 day to get through this horrific Arch experience.

Upvotes: 0

Ajay Mishra
Ajay Mishra

Reputation: 11

I am using Manjaro and after a long search, I was able to fix the issue by following these simple commands.

NOTE: You must run pacman-key --init before first using pacman; the local keyring can then be populated with the keys of all official Manjaro Linux packagers with pacman-key --populate archlinux manjaro.

Upvotes: 1

Denis Chevalier
Denis Chevalier

Reputation: 101

I just happened to have the same problem, and solved it the following way:

$ sudo pacman -Rdd package-query # Purge the conflicting package-query
$ sudo pacman -Syu               # There it works

# Now reinstall package-query
$ git clone https://aur.archlinux.org/package-query.git
$ cd package-query && makepkg -si

Upvotes: 7

hak8or
hak8or

Reputation: 528

For anyone else coming in here that didn't find the solution by rorido working, try users Bernhard Fürst's or Jham's answer of just pacman -S package-query which worked for me without issues.

Also, if you are still getting issues like this with libalpm.so.8: cannot open shared object file: No such file or directory then you have to manually reinstall package-query and yaourt.

sudo pacman-db-upgrade
yaourt -R package-query yaourt

git clone https://aur.archlinux.org/package-query.git
cd package-query
makepkg -si
cd ..
git clone https://aur.archlinux.org/yaourt.git
cd yaourt
makepkg -si
cd ..

Upvotes: 2

rodrigo
rodrigo

Reputation: 98398

I just had this very same error. The problem seems to be that there are new keys in the archlinux-keyring package, and new packages (confuse) signed with those keys. Since both packages are updated in the same transaction, well the new keys cannot be used until the update is finished, but the transaction will not start until the packages are checked...

The solution would be to update the archlinux-keyring by itself:

pacman -S archlinux-keyring

And then do the rest:

pacman -Su

If that fails, you could try running through the keys manually, with:

pacman-key --populate

but usually, it is not necessary.

Upvotes: 64

Related Questions