error: could not open file /var/lib/pacman/local/.../{desc,files,mtree}: No such file or directory

Your local package database and/or metadata may become corrupted if an update process is interrupted, for example if you hard power off during an update.

Metadata corruption will generally manifest in a message similar to:

error: could not open file /var/lib/pacman/local/$pkgname-$pkgver-$pkgrel/desc: No such file or directory
error: could not open file /var/lib/pacman/local/$pkgname-$pkgver-$pkgrel/files: No such file or directory
error: could not open file /var/lib/pacman/local/$pkgname-$pkgver-$pkgrel/mtree: No such file or directory

during a package operation (install, update, etc.).

Note: $pkgname is the package name, $pkgver the version, $pkgrel the release

Fixing this issue involves manually creating a replacement file to allow package operations to continue, then putting the correct metadata back in place.

Step 1

Note the package for which metadata has been corrupted. It's the $pkgname part of the path.

Step 2

Create a temporary replacement file for any files which are currently missing, e.g.:

sudo touch /var/lib/pacman/local/$pkgname-$pkgver-$pkgrel/{desc,files,mtree}

This path must exactly match the text from the error message. For example, for

error: could not open file /var/lib/pacman/local/smbclient-4.10.2-0/desc: No such file or directory

you must type:

sudo touch /var/lib/pacman/local/smbclient-4.10.2-0/desc

Step 3

Reinstall the package.

The replacement file is blank and must be replaced with the correct content. The easiest way to do this is simply reinstall the package:

sudo pacman -S $pkgname

where $pkgname is the package you noted down previously.

For example, for

error: could not open file /var/lib/pacman/local/smbclient-4.10.2-0/desc: No such file or directory

you must type:

sudo pacman -S smbclient

If you see errors about other missing metadata files simply repeat Step 2.

Step 4

Continue with your life and be glad you're running Linux where an interrupted update doesn't simply kill your OS and require a reinstallation (unlike another OS I could mention...).

13 Likes
2020 Full system upgrade failed
Error: could not open file /var/lib/pacman/local/languagetool-4-5-1/desc: No such file or direcotry
Cannot open pamac because of missing library libalpm.so.11
pacman update issue with "No Such file or Directory"
No kernel for booting after 2020-04-18 update
[Stable Update] 2019-07-17 - Kernels, KDE, Browsers, Systemd, Octopi, LibreOffice
[Testing Update] 2019-07-29 - Kernels, XFCE 4.14-pre3, Haskell
Invalid or Corrupted Package while Trying to Do Full System Upgrade
Errors updating Manjaro Lysia 20.0.2 unstable
Problem installing from Aur
Stumped: Pacman Lazarus directory not found
Unable to Update - corrupted package error
Problem with update my system.
Boot vmlinuz not found after hibernation
Input/output error with pacman
Cant update Manjaro KDE anymore :(
pacman -Syu: failed to prepare transaction (invalid or corrupted package)
Invalid or corrupted files when updating
Can't update system
[FAILED] Failed to start TLP system startup/shutdown and Update problem
Network connection problem
When trying to upgrade using -Syyu I get the following error messages:
When trying to upgrade using -Syyu I get the following error messages:
pamac wrong kernel
Ran across an error after running the general update command at the terminal
Can't update/install anymore after latest update.
[Resuelto/Solved] Errores al actualizar manjaro con pacman
"Bad Message" error, whenever installing any package.
Error: could not open file /var/lib/pacman/local/languagetool-4-5-1/desc: No such file or direcotry
[Solved] Wifi 'device not ready' after crashed update

Forum kindly sponsored by