You are not logged in.

#1 2017-09-29 02:59:36

dmartins
Member
Registered: 2006-09-23
Posts: 360

[SOLVED] Corrupted pacman database

Hi all,

My PC froze during a package upgrade (running pacman -Syu) and the pacman database for the thunderbird package has been left in an inconsistent state. Other posts have suggested running pacman -S or pacman -U with the --force option to reinstall the package and fix the database but this is not working. I am looking for other suggestions on how to restore the missing database files.

Thanks,
Dan

$ pacman -Dk
error: 'thunderbird-52.3.0-2': description file is missing
error: 'thunderbird-52.3.0-2': file list is missing

$ sudo pacman -S --force thunderbird
warning: thunderbird-52.3.0-2 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...
error: could not open file /var/lib/pacman/local/thunderbird-52.3.0-2/desc: No such file or directory
warning: could not fully load metadata for package thunderbird-52.3.0-2
error: failed to prepare transaction (invalid or corrupted package)

$ sudo pacman -U --force thunderbird-52.3.0-2-x86_64.pkg.tar.xz 
loading packages...
warning: thunderbird-52.3.0-2 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...
error: could not open file /var/lib/pacman/local/thunderbird-52.3.0-2/desc: No such file or directory
warning: could not fully load metadata for package thunderbird-52.3.0-2
error: failed to prepare transaction (invalid or corrupted package)

$ ls -l /var/lib/pacman/local/thunderbird-52.3.0-2/
total 12
-rw-r--r-- 1 root root 11112 Sep 18 10:34 mtree

The last entry in pacman.log for thunderbird is the upgrade to the previous version, suggesting that thunderbird-52.3.0-2 did not fully install.

[2017-09-09 11:10] [ALPM] upgraded thunderbird (52.2.1-1 -> 52.3.0-1)

I  have also tried forcing a downgrade to the previously installed version but it results in the same error

$ sudo pacman -U --force thunderbird-52.3.0-1-x86_64.pkg.tar.xz 
loading packages...
warning: downgrading package thunderbird (52.3.0-2 => 52.3.0-1)
resolving dependencies...
looking for conflicting packages...
error: could not open file /var/lib/pacman/local/thunderbird-52.3.0-2/desc: No such file or directory
warning: could not fully load metadata for package thunderbird-52.3.0-2
error: failed to prepare transaction (invalid or corrupted package)

Last edited by dmartins (2017-09-29 03:10:42)

Offline

#2 2017-09-29 03:10:20

dmartins
Member
Registered: 2006-09-23
Posts: 360

Re: [SOLVED] Corrupted pacman database

Just after submitting my initial post, I had an idea that the forced reinstall might be failing just because the two database files were not present in the filesystem. I created empty files at the appropriate locations, then did another pacman -U --force, and this time pacman was able to reinstall the package. The database has been updated with the right information now.

I'll leave this post here and mark it solved in case it can be of use to anyone in the future..

Create empty files using touch:

$ sudo touch /var/lib/pacman/local/thunderbird-52.3.0-2/desc
$ sudo touch /var/lib/pacman/local/thunderbird-52.3.0-2/files

Then force a reinstall:

$ sudo pacman -U --force thunderbird-52.3.0-2-x86_64.pkg.tar.xz 
loading packages...
warning: thunderbird-52.3.0-2 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Package (1)  Old Version  New Version  Net Change

thunderbird  52.3.0-2     52.3.0-2     105.48 MiB

Total Installed Size:  105.48 MiB

:: Proceed with installation? [Y/n] 
(1/1) checking keys in keyring                     [######################] 100%
(1/1) checking package integrity                   [######################] 100%
(1/1) loading package files                        [######################] 100%
(1/1) checking for file conflicts                  [######################] 100%
(1/1) checking available disk space                [######################] 100%
:: Processing package changes...
(1/1) reinstalling thunderbird                     [######################] 100%
:: Running post-transaction hooks...
(1/3) Updating icon theme caches...
(2/3) Arming ConditionNeedsUpdate...
(3/3) Updating the desktop file MIME type cache...

Offline

Board footer

Powered by FluxBB