Broken Pacman

Hello there! I broke my archbang recently. Let me tell you how it went. I was doing upgrade via pacman and suddenly electricity failure and it shut down immediately.

For those who don’t know what pacman is: Pacman is a package manager for Arch Linux (Linux distribution) as apt-get is for Ubuntu.

On next boot, many apps like chromium etc. stopped working.

Running chromium from console revealed:

/usr/lib/chromium/chromium: error while loading shared libraries: /usr/lib/libpulse.so.0: file too short

Firefox gave some security error something like “Your connection is not secure“.

The owner of http://www.google.co.in has configured their website improperly. To protect your information from being stolen, Firefox has not connected to this website.
http://www.google.co.in uses an invalid security certificate. The certificate is not trusted because the issuer certificate is unknown. The server might not be sending the appropriate intermediate certificates. An additional root certificate may need to be imported. (Error code: sec_error_unknown_issuer)

 

Then I thought of doing an update via pacman, but running any pacman command result into an exec error:

zsh: exec format error: pacman

On another reboot, I noticed a message (kernel messages): “failed to start intializes pacman keyring“. So at this point, I realized that there is something wrong with the keyring.

Then tried many things like:

pacman -Syyuu

pacman -S pacman

pacman -Scc

Removed /var/lib/pacman/db.lck

Removed /var/lib/pacman/sync

Then I got a link: https://wiki.archlinux.org/index.php/pacman#pacman_is_broken_beyond_repair

It contained a link to a post: https://bbs.archlinux.org/viewtopic.php?id=95007

It said to manually configure the packages: openssl, libarchive, libfetch, pacman

So I downloaded the .pkg.tar.xz files and fired the command below:

sudo tar -xvpf ${pkgname} -C / –exclude .PKGINFO –exclude .INSTALL

where ${pkgname} should be replaced by the package_name.pkg.tar.xz e.g. openssl, pacman etc.

So this overrode the existing binaries, I guess and pacman started working.

But while installing something via pacman like “pacman -S pacman“, then it gave error like:

:: Proceed with installation? [Y/n] Y
(1/1) checking keys in keyring
[######################] 100%
downloading required keys…
:: Import PGP key 20235p273o23o4-somekeyhere, “<Some-name> <some-email>”, created: 2011-06-06? [Y/n] Y

:: File /var/cache/pacman/pkg/pacman-5.0.1-2-x86_64.pkg.tar.xz 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 (PGP signature))
Errors occurred, no packages were upgraded.

So it was importing very old keys.

Tried: pacman-key –populate archlinux

Got: 

==> Appending keys from archlinux.gpg…
gpg: no valid OpenPGP data found.
==> Updating trust database…
gpg: no need for a trustdb check

Then tried:
sudo rm -rf /etc/pacman.d/gnupg
sudo pacman-key –init

These were working but attempting installing something still gave that PGP error thing.

 

What solved my problem?

sudo pacman-key –refresh-keys

Followed:
http://www.cupoflinux.com/SBB/index.php?topic=2959.0

Then pacman started installing things but it still gave some errors while doing that:

(1/1) upgrading gnome-terminal                     [######################] 100%
ldconfig: File /usr/lib/libssh.so is empty, not checked.
ldconfig: File /usr/lib/libass.so is empty, not checked.
ldconfig: File /usr/lib/liboslquery.so is empty, not checked.

and a long list of errors like above.
Those errors mean that you have a missing installation of certain packages. If you find and reinstall those packages by:

pacman -Syyf <PACKAGE_NAME_HERE>

you’ll reinstall and dismiss those errors. But -f option is no longer supported, one may use –force instead. https://bbs.archlinux.org/viewtopic.php?id=85480

 

Hence I used the following command:

sudo pacman -Qnq | pacman -S –force –

https://bbs.archlinux.org/viewtopic.php?id=209493

What it did was to find and reinstall all the installed packages (around 1GB of downloading).

Finally got everything working.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s