Pacman error "invalid or corrupted package"

Hi there,

I recently tried to update my pacman files.
And I get prompt with “invalid or corrupted package”
But I do not know what file(s) have been corrupted.
I followed the guidelines of a previous forum post but I have gotten no change.
From trying to reset my mirrors, debug pacman, and clear my cache.
I have also lost my start menu (whiskers) from my taskbar as well as the function of my start menu button.
If anyone could point me in the right direction.
Currently running XFCE 5.9.16-1

You are probably connected to a bad mirror.

Try sudo pacman-mirrors -f5 and then try updating again.

I hit the same issue yesterday, and doing this solved it for me.

The error is still occurring.

I also tried these;
sudo pacman-mirrors --fasttrack && sudo pacman -Syyu
sudo pacman-mirrors --country all --api --protocols all --set-branch stable && sudo pacman -Syyu

And still receiving error

While trying to update pacman here is the terminal.

Desktop]$ sudo pacman -Syu
[sudo] password for alek:
:: Synchronizing package databases…
core is up to date
extra is up to date
community is up to date
multilib is up to date
:: Starting full system upgrade…
error: could not open file /var/lib/pacman/local/libibus-1.5.23+3+gaa558de8-1/desc: No such file or directory
resolving dependencies…
looking for conflicting packages…
warning: could not fully load metadata for package libibus-1.5.23+3+gaa558de8-1
error: failed to prepare transaction (invalid or corrupted package)

https://wiki.archlinux.org/index.php/Pacman/Restore_local_database

I am unable to install the pacutils since it wants to update everything else and comes back as same error.

and if I try to use sudo pacman -Syyu
i get many errors of invalid or corrupt then I get this at the end;
Errors occurred, no packages were upgraded.

Would there be a way to re-install my pacman with my .iso ?
if so what command line would I use. (or link to forum)

Chroot

NOTE: A user should not normally manually do anything in /var/lib/pacman/local. This is the meta data for the software installed on the system. There are 3 files in each directory (desc, files, mtree).

The archived manjaro entry below suggests that just touching/creating the file is enough. Check to see if the directory is there and which files are missing. It might be as simple as:

sudo -i
cd /var/lib/pacman/local/libibus-1.5.23+3+gaa558de8-1/
touch desc

Read the entry:

If that doesn’t work, try:

# Does the package exist in cache
ls -l /var/cache/pacman/pkg/libibus*  

# If yes 
# NOTE:  it might not be, if you cleared this cache. There's a systemd timer that
# takes care of keeping 3 versions of a package by default. 
pacman -U --dbonly /var/cache/pacman/pkg/libibus-1.5.23+3+gaa558de8-1-x86_64.pkg.tar.zst

#
pacman -Syyu
1 Like

It can’t find any of the files with these commands

pacman -U --dbonly /var/cache/pacman/pkg/libibus-1.5.23+3+gaa558de8-1-x86_64.pkg.tar.zst
loading packages...
error: '/var/cache/pacman/pkg/libibus-1.5.23+3+gaa558de8-1-x86_64.pkg.tar.zst': could not find or read package

when I try to install or update I get this:

[Feather ~]# pacman -Syyu
:: Synchronizing package databases...
 core                  167.6 KiB   460 KiB/s 00:00 [######################] 100%
 extra                1993.3 KiB  1154 KiB/s 00:02 [######################] 100%
 community               6.4 MiB  1855 KiB/s 00:04 [######################] 100%
 multilib              181.8 KiB  6.83 MiB/s 00:00 [######################] 100%
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...

Packages (221) adobe-source-code-pro-fonts-2.038ro+1.058it+1.018var-1
               alsa-card-profiles-14.2-1  amd-ucode-20210109.r1812.d528862-1
               archlinux-appstream-data-20201223-1  boost-libs-1.75.0-2
               botan-2.17.3-1  ca-certificates-mozilla-3.60.1-1
               cantarell-fonts-1:0.301-1  confuse-3.3-3  cronie-1.5.5-2
               cups-filters-1.28.7-1  dee-1.2.7-10  dhcpcd-9.4.0-1
               elfutils-0.182-1  enchant-2.2.13-2  exo-4.16.0-1
               flatpak-1.10.0-1  garcon-4.16.1-1  gcr-3.38.1-1  gdbm-1.19-1
               git-2.30.0-1  glib2-2.66.4-2  glslang-11.1.0-1  gmp-6.2.1-1
               gpgme-1.15.1-1  gptfdisk-1.0.6-1  gssproxy-0.8.4-1
               gst-plugins-bad-libs-1.18.3-1  gst-plugins-base-1.18.3-1
               gst-plugins-base-libs-1.18.3-1  gst-plugins-good-1.18.3-1
               gst-plugins-ugly-1.18.3-1  gstreamer-1.18.3-1
               gtk-update-icon-cache-1:4.0.1-2  gtk3-1:3.24.24-2  gvfs-1.46.2-1
               gvfs-afc-1.46.2-1  gvfs-gphoto2-1.46.2-1  gvfs-mtp-1.46.2-1
               gvfs-nfs-1.46.2-1  gvfs-smb-1.46.2-1  harfbuzz-2.7.4-1
               harfbuzz-icu-2.7.4-1  haveged-1.9.14-1  hwloc-2.4.0-1
               iana-etc-20201229-1  icu-68.2-1  imagemagick-7.0.10.58-1
               inxi-3.2.02.2-1  iproute2-5.10.0-2  jdk8-openjdk-8.u275-1
               jre8-openjdk-8.u275-1  jre8-openjdk-headless-8.u275-1
               kauth-5.78.0-1  kcoreaddons-5.78.0-1  kitemmodels-5.78.0-1
               kmod-28-1  kvantum-qt5-0.18.0-1  kwindowsystem-5.78.0-1
               lib32-glib2-2.66.4-2  lib32-gmp-6.2.1-1  lib32-harfbuzz-2.7.4-1
               lib32-icu-68.2-1  lib32-krb5-1.18.3-1  lib32-libcap-2.46-1
               lib32-libdrm-2.4.104-1  lib32-libepoxy-1.5.5-1
               lib32-libpcap-1.10.0-1  lib32-libpulse-14.2-1
               lib32-libtiff-4.2.0-1  lib32-libusb-1.0.24-1
               lib32-libva-mesa-driver-20.3.3-1  lib32-libxml2-2.9.10-3
               lib32-llvm-libs-11.0.1-1  lib32-lz4-1.9.3-1  lib32-mesa-20.3.3-1
               lib32-mesa-vdpau-20.3.3-1  lib32-mpg123-1.26.4-1
               lib32-nss-3.60.1-1  lib32-ocl-icd-2.2.14-1
               lib32-vulkan-icd-loader-1.2.166-1  lib32-vulkan-intel-20.3.3-1
               lib32-vulkan-radeon-20.3.3-1  lib32-zstd-1.4.8-1
               libarchive-3.5.1-1  libcap-2.46-1  libdrm-2.4.104-1
               libebml-1.4.1-1  libelf-0.182-1  libepoxy-1.5.5-1
               libevdev-1.10.1-1  libgexiv2-0.12.1-4  libgpg-error-1.41-1
               libical-3.0.8-3  libmfx-20.5.1-1  libmicrohttpd-0.9.72-1
               libmm-glib-1.14.10-1  libmpc-1.2.1-1
               libnm-1.28.1dev+7+g3f5df3cdc6-1  libpcap-1.10.0-1
               libproxy-0.4.17-1  libpulse-14.2-1  libqmi-1.26.8-1
               libsynctex-2020.54586-9  libusb-1.0.24-2
               libva-mesa-driver-20.3.3-1  libx11-1.7.0-3
               libxfce4util-4.16.0-1  libxml2-2.9.10-8  libxnvctrl-460.27.04-1
               lilv-0.24.12-1  linux-firmware-20210109.r1812.d528862-1
               llvm-libs-11.0.1-1  logrotate-3.18.0-1  man-pages-5.10-1
               manjaro-alsa-20210109-1  manjaro-settings-manager-0.5.6-11
               manjaro-settings-manager-notifier-0.5.6-11
               matcha-gtk-theme-20210112-1  md4c-0.4.7-1  mesa-20.3.3-1
               mesa-vdpau-20.3.3-1  mhwd-nvidia-460.32.03-1
               mhwd-nvidia-390xx-390.141-1  mkinitcpio-busybox-1.32.1-2
               mobile-broadband-provider-info-20201225-1
               modemmanager-1.14.10-1  mono-6.12.0.107-1  mousepad-0.5.1-1
               nano-5.5-1  ndctl-71.1-1  nettle-3.7-1
               networkmanager-1.28.1dev+7+g3f5df3cdc6-1  noto-fonts-20201226-1
               nss-3.60.1-1  oath-toolkit-2.6.5-1  ocl-icd-2.2.14-1
               openexr-2.5.4-1  openjpeg2-2.4.0-1  openresolv-3.12.0-1
               p7zip-17.03-1  papirus-icon-theme-20210101-1
               perl-alien-build-2.38-1  perl-file-listing-6.14-1
               perl-http-cookies-6.10-1  perl-http-message-6.27-1
               perl-libwww-6.52-1  perl-net-http-6.20-1  pipewire-0.3.19-1
               poppler-21.01.0-1  poppler-glib-21.01.0-1  poppler-qt5-21.01.0-1
               psmisc-23.3-4  pulseaudio-14.2-1  pulseaudio-bluetooth-14.2-1
               pulseaudio-equalizer-14.2-1  pulseaudio-jack-14.2-1
               pulseaudio-lirc-14.2-1  pulseaudio-zeroconf-14.2-1
               python-msgpack-1.0.2-2  python-packaging-20.8-2
               python-pillow-8.1.0-1  python-pip-20.2.4-1
               python-psutil-5.8.0-1  python-ptyprocess-0.7.0-1
               python-pyqt5-5.15.2-3  python-reportlab-3.5.59-1
               python-resolvelib-0.5.4-1  python-setuptools-1:51.1.2-1
               python-shiboken2-5.15.2-4  python-urllib3-1.26.1-1
               qpdf-10.1.0-1  qt5-base-5.15.2-2  qt5-location-5.15.2-2
               raptor-2.0.15-15  rav1e-0.4.0-1  rsync-3.2.3-3  s-nail-14.9.20-1
               samba-4.13.3-2  serd-0.30.8-1
               shared-mime-info-2.0+57+gc1d1c70-1  smbclient-4.13.3-2
               sord-0.16.8-1  sratom-0.6.8-1  sudo-1.9.5.p2-0.1  tcl-8.6.11-1
               terminus-font-4.49.1-1  thunar-4.16.2-1  thunar-volman-4.16.0-1
               thunderbird-78.7.0-0.1  tracker3-3.0.3-1  tumbler-4.16.0-1
               tzdata-2020f-1  vte-common-0.62.2-1  vte3-0.62.2-1
               vulkan-icd-loader-1.2.166-1  vulkan-intel-20.3.3-1
               vulkan-radeon-20.3.3-1  wavpack-5.3.0-2  webkit2gtk-2.30.4-3
               wget-1.21.1-1  wxgtk-common-3.0.5.1-2  wxgtk3-3.0.5.1-2
               xapp-2.0.6-1  xf86-video-intel-1:2.99.917+916+g31486f40-1
               xfce4-appfinder-4.16.0-1  xfce4-cpufreq-plugin-1.2.3-1
               xfce4-cpugraph-plugin-1.2.0-1  xfce4-fsguard-plugin-1.1.2-1
               xfce4-genmon-plugin-4.1.0-2  xfce4-mount-plugin-1.1.5-1
               xfce4-notes-plugin-1.8.1.r235.g0ad1e5f-1  xfce4-panel-4.16.0-1
               xfce4-power-manager-4.16.0-1  xfce4-screenshooter-1.9.8-1
               xfce4-sensors-plugin-1.3.95-1  xfce4-session-4.16.0-1
               xfce4-settings-4.16.0-1  xfce4-smartbookmark-plugin-0.5.2-1
               xfce4-taskmanager-1.4.0-1  xfce4-terminal-0.8.10-1

Total Download Size:    650.34 MiB
Total Installed Size:  2804.85 MiB
Net Upgrade Size:        26.25 MiB

:: Proceed with installation? [Y/n] 

Then I get an error with every file and have to hie ENTER to remove it all, ends with this

Errors occurred, no packages were upgraded.

Must of removed the install cache located at /var/cache/pacman/pkg/. Should always try to keep the default of 3 versions. I don’t think the mirrors have this version, otherwise you could do a wget to fetch it.

Which error, the “could not load metadata” or “invalid or corrupted package”.
And on every file? Yikes!

Did something happen to /var/lib/pacman/local on your system? Then @FadeMind was right, find a way to restore (backup?) or rebuild it.

I have no idea what happened, one day I went to update my pacman files and got an error.
Tried a few things from google search and nothing changed.

would this resolve the issue? (I have an ISO on a USB)

Or would I need different/more commands

thanks for all the help

If you don’t have issues with booting your system then no, this is not what you need to do.
So please disregard the rest in that case.

As far as I can see, his information is incorrect anyway.
He did chroot into the system, but then proceeded to use /mnt/boot as the target directory.
From within chroot (where he is), that directory is not /mnt/boot but /boot - the parameter is not needed.
This would be the way to do it without chroot.
and
The command is now different - it’s manjaro-chroot now.

But I could be wrong.

I’d rather go with this information here - or look in the wiki how to chroot

That was not for finding the files.
That was to install the file after you looked for and found it (it’s name).

To find what is there is what the:

# Does the package exist in cache
ls -l /var/cache/pacman/pkg/libibus*  

was for
If that command finds one or more - use that name in the
pacman -U --dbonly ...
command that was given as an example.

Once I boot in a USB live session and get into the chroot via

manjaro-chroot -a

can I follow these commands? (but with sda or sda2?)

  • Boot into Manjaro installer
  • Open terminal
  • sudo manjaro-chroot -a (and select system to mount)
  • grub-install /dev/sda (it’s sda for me; make sure you choose the right drive!)
  • grub-install --recheck /dev/sda
  • update-grub
  • exit
  • reboot

I figure that my partition is sda2

[alek@Feather Desktop]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
├─sda1 8:1 0 300M 0 part /boot/efi
├─sda2 8:2 0 922.4G 0 part /
└─sda3 8:3 0 8.8G 0 part [SWAP]

or do I write

pacman -Syyu

to re-install from live session

Just want to ensure I write the correct commands while in root (since I have only been using linux for ~6 months)

As you can see, I started my post with:

If you don’t have issues with booting your system then no, this is not what you need to do.
So please disregard the rest in that case.

I now have the little problem that I don’t understand
why you would want to re-install the bootloader at all
when the problem that was so far talked about here isn’t at all about the system not booting.

It was you who suddenly brought that up.
I thought your issue was not being able to update.

re-installing grub will fix nothing in that regard

If the system boots, you can fix it from there.

chroot will only add one more layer of complexity

This is the error I get when trying to update or install from my pacman

Error

and I tried this link (everything above nuclear option)

however I can’t get any commands to work, it needs pacman-key --init but I get this error every time.

[alek@Feather Desktop]$ sudo pacman-key --populate archlinux manjaro
==> ERROR: You do not have sufficient permissions to read the pacman keyring.
==> Use ‘pacman-key --init’ to correct the keyring permissions.
[alek@Feather Desktop]$ sudo pacman-key --init
gpg: symbol lookup error: gpg: undefined symbol: gpgrt_access, version GPG_ERROR_1.0
chmod: cannot access ‘/etc/pacman.d/gnupg//trustdb.gpg’: No such file or directory
gpg: symbol lookup error: gpg: undefined symbol: gpgrt_access, version GPG_ERROR_1.0
gpg: symbol lookup error: gpg: undefined symbol: gpgrt_access, version GPG_ERROR_1.0
gpg: symbol lookup error: gpg: undefined symbol: gpgrt_access, version GPG_ERROR_1.0
==> Updating trust database…
gpg: symbol lookup error: gpg: undefined symbol: gpgrt_access, version GPG_ERROR_1.0
==> ERROR: Trust database could not be updated.

No idea how something like that can even happen on it’s own.
Perhaps you added a custom repository to pacman?
anyway …
This here - the posts by @linux-aarhus - should do the trick.
You need to be online during this procedure.

Summary of the steps, in order:

  • edit the file /etc/pacman.conf

sudo nano /etc/pacman.conf

find the line that says:

SigLevel = Required DatabaseOptional

and change that to:

SigLevel = Required DatabaseNever

mind the spelling! DatabaseNever
save the file

then - as he said in the next post:

Maybe I should have mentioned that I went through the whole #! bang - that is

remove the database files as root

(I have changed all the following commands to use sudo)

  • remove the database files

sudo rm -f /var/lib/pacman/sync/*

  • remove pacman pgp folder

sudo rm -rf /etc/pacman.d/gnupg

  • remove package cache
    (perhaps you can skip this step, just this one step though, so you still have the package cache in case you need it)

sudo pacman -Scc

  • init key database

sudo pacman-key --init

  • populate database

sudo pacman-key --populate manjaro archlinux

  • refresh pacman keys

sudo pacman-key --refresh

  • now try updating:

sudo pacman-mirrors -f5
sudo pacman -Syyu

Do not run this - you are using an EFI system as evident by the next part

The linked comment - was solving a completely different issue - but is usable when you start getting gpg related errors.

What is most important is that this whole topic is looking like an xyproblem where everyone is pouring water on fire - but not solving the initial cause - the little guy with the matches and a can of gasoline.

I changed the line to DatabaseNever (with proper spelling)
and I still get error with command

sudo pacman-key --init

[alek@Feather Desktop]$ sudo nano /etc/pacman.conf
[sudo] password for alek:
[alek@Feather Desktop]$ sudo rm -f /var/lib/pacman/sync/*
[alek@Feather Desktop]$ sudo rm -rf /etc/pacman.d/gnupg
[alek@Feather Desktop]$ sudo pacman-key --init
gpg: symbol lookup error: gpg: undefined symbol: gpgrt_access, version GPG_ERROR_1.0
chmod: cannot access ‘/etc/pacman.d/gnupg//trustdb.gpg’: No such file or directory
gpg: symbol lookup error: gpg: undefined symbol: gpgrt_access, version GPG_ERROR_1.0
gpg: symbol lookup error: gpg: undefined symbol: gpgrt_access, version GPG_ERROR_1.0
gpg: symbol lookup error: gpg: undefined symbol: gpgrt_access, version GPG_ERROR_1.0
==> Updating trust database…
gpg: symbol lookup error: gpg: undefined symbol: gpgrt_access, version GPG_ERROR_1.0
==> ERROR: Trust database could not be updated.
[alek@Feather Desktop]$

That error message is the only thing I can have a go on.
It is apparently related to the package libpgp-error
So - since you still have your pacman cache, try to reinstall it.
First, look whether it is there:

ls -al /var/cache/pacman/pkg/libgpg*

If it is, try installing it, using the actual filename that command just gave you:

sudo pacman -U /var/cache/pacman/pkg/libgpg-error_xxx.tar.zst

Did it work?
If it did, continue going through the list of commands.

maybe @linux-aarhus has another idea - what I posted here was previously posted by him