You are not logged in.
Pages: 1
Is there a utility to get pacman to synchronise its database with packages that are actually installed?
I've recently reinstalled Arch but kept the previous /var partition. Consequentially, pacman thinks packages are installed when they're not which leads to apps sometimes failing to run. Reinstalling the app is not necessarily successful, as package dependancies may not be met for similar reasons.
Is a complete Arch reinstallation the only way to solve this issue?
Offline
hm.... you should be able to do this with a script.... Penguin will show up with bash magic, I'm sure but if you want to try it yourself, try somethng like this (UNTESTED):
pacman -Q | cut -d ' ' -f 1 >tempfile
#you may need to replace newlines with spaces in tempfile using sed
pacman -Sy
pacman -S $(cat tempfile)
Notes:
pacman -Q #list installed packages
pacman -Q | cut -d ' ' -f 1 #only package names
Dusty
Offline
Here's a one-liner:
pacman -Sy `pacman -Q | sed 's/ .*/ /' | tr -d 'n'`
sed does the same thing as Dusty's cut and tr eliminates newlines.
EDIT: ...and this fails if pacman -Q does not list the actually installed packages. I guess you need a way to fix /var/lib/pacman/local to match the currently installed pkgs.
Offline
[..]... Penguin will show up with bash magic..[...]
BAM!
#!/bin/bash
pacman -Q | cut -d' ' -f1 | paste -s | sed 's|s| |g' >filelist
for e in `cat filelist`; do
search=`find /var/abs/ -type d -name $e`
[ ! -z $search ] && echo $e >>doable
done
pacman -Sy --noconfirm `cat doable`
make sure you have an abs tree on your system...
Offline
I don't know enough bash to give you the details, but you could loop your way through /var/lib/pacman/local with
pacman -Q <pkgname>
and if the response is
Package "<pkgname>" was not found.
delete it.
Offline
The locally installed apps are a special case - the main problem is how to identify the packages in pacman's now incorrect database with the contents of /usr/bin and then automatically reinstall the missing packages.
Offline
Pacman keeps the database of installed packages in /var/lib/pacman/local. You could make a backup of /var/lib/pacman/local and check which packages are installed before the date you did the reinstall. Remove them from the database, then reinstall them with pacman.
This sorts the packages by modification time:
ls -lt /var/lib/pacman/local/
Offline
Pages: 1