You are not logged in.
Pages: 1
Hi,
After 15 years of using Linux and Unix, I have had my major blunder: starting a rm -rf /usr/lib command, when I just wanted to erase a temporary .so file I had put there for some purpose. I stopped the obnoxious command, but too late, and some files have already been deleted. Pacman and yaourt are broken (needs dependencies like libfetch.so). This is not that a big issue though, since my personal stuff is intact (and backed up anyway).
Now I have to think the strategy that will allow me to fix my system:
Can I fix the system at this stage or do I need to reinstall?
Can I generate a list of installed packages (repository and AUR) even if pacman is broken (ala pacman -Qa and pacman -Qma but another way) and my pakg cache is empty?
In case I need to repair pacman, I was considering using an Archboot image and copy the lib files necessary to pacman to work in /usr/lib. Would that work?
If you have further recommendations, please let me know what is best. Thanking you in advance
Offline
Better later than never. Sometimes it's worth to make system backups.
Well, I'd chroot into the system from an arch install cd and reinstall pacman first. After that, I have no idea...
Offline
Download (with wget, curl...) the pacman package directly (and all the deps that you find missing), untar them in / taking care of the spurious files like .PKGINFO
then you can reinstall every package you find that doesn't work because of missing libs (if you have time you can go 'pacman -S $(pacman -Qq)' )
Remember that you need to avoid non repo packages, like AUR ones, because pacman won't find them
The Linux philosophy is 'laugh in the face of danger'. Oops. Wrong one. 'Do it yourself'. That's it. - Linus Torvalds
Offline
There's a script somewhere in the Arch wiki that will rebuild a package list if you lose pacman, but I don't remember whereabouts it is, sorry!
Edit: Try this - https://bbs.archlinux.org/viewtopic.php?pid=670876
Last edited by chemicalfan (2011-08-18 10:42:23)
Offline
As usual the Arch community is great and very helpful. Thanks a lot guys!
Offline
Edit: Try this - https://bbs.archlinux.org/viewtopic.php?pid=670876
Many thanks. That is very interesting. My perl is rusty, but as far as I understand, not only it detects installed files and from which packages they belong, but it also gives a percentage of files installed for each package. Therefore, I should be able to detect my "broken" packages, since they would have a score comprised between 0 and 100%. Am I correct?
Offline
There's a script somewhere in the Arch wiki that will rebuild a package list if you lose pacman, but I don't remember whereabouts it is, sorry!
Edit: Try this - https://bbs.archlinux.org/viewtopic.php?pid=670876
The particular script you reference is useful when /var/lib/pacman/local is compromised. The link to Xyne's script is far more useful in this scenario. Neat.
edit: So, after looking at Xyne's script more closely, he's trying to do something similar to what the lost-db script does. Still not quite useful here. I've taken his idea and created the following snippet which compares the local DB's filelists to the filesystem. You can specify a tolerance and only return packages which are below this tolerance, e.g. a tolerance of 90 means only show packages where <=90% of the files are present. You may get some false positives when this isn't run as root, but you can start with a tolerance of 100 and work your way down from there.
#!/bin/bash
declare curpkg= pkg= file=
declare -i tolerance=$1 filecount= hitcount=
summary() {
local ratio=
# boring
if (( hitcount == filecount )); then
return
fi
# under tolerance
ratio=$(( hitcount * 100 / filecount % 100 ))
if (( ratio < tolerance )); then
printf '%-30s %-10s (%s%%)\n' "$pkg" "$hitcount/$filecount" "$ratio"
fi
}
pacman -Ql | while read pkg file; do
if [[ -z $curpkg || $pkg != "$curpkg" ]]; then
summary "$pkg" "$hitcount" "$filecount"
curpkg=$pkg
hitcount=0
filecount=0
fi
# skip directories
[[ $file = */ ]] && continue;
(( ++filecount ))
[[ -e "$file" || -L "$file" ]] && (( ++hitcount ))
done
Example output...
$ filecheck 100
feh 78/80 (97%)
linux-rampage-headers 1170/1171 (99%)
namcap 46/49 (93%)
Here, feh and namcap are false positives because I'm not root. I really did delete a file from my kernel package so I can account for that.
Last edited by falconindy (2011-08-18 15:57:07)
Offline
Amazing! Many thanks, that would be very useful for me indeed.
Offline
Very nice, falconindy, thanks for that. Want to put it in the wiki, aur or someplace more accessible than the Newbie Corner?
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
Offline
Probably not worth making a fuss over this, as pacman -Qkq does something similar. oops.
A pacman dev forgets the options to pacman? Scandalous!
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
Hi all!
I am the original poster and wanted to thank everybody for their help, I have been able to repair my system yesterday and it seems to work fine now. I shall see if I have other issues in the near future, but do not feel the need to reinstall from scratch at this stage.
Just one thing that was a bit difficult:
pacman -S $(pacman -Qq)
works, however it fails when there are AUR packages installed. Is there a way to exclude non-AUR packages? I know that pacman -Qm lists these local packages, but I would need the complementary. I looked at pacman options but did not find something like this. Is it possible to restrict by repository, maybe?
Last edited by zebulon (2011-08-19 07:58:30)
Offline
These are from my backup scripts. I copied them from someone else.
This should create a file listing the installed packages without the AUR packages. It just lists packages by name, without version numbers.
pacman -Qqe | grep -Fvx "$(pacman -Qqm)" > package_list
Creating a file listing just the AUR packages:
pacman -Qqm > aur_list
Offline
Thanks a lot thisoldman.
Offline
A most useful read: http://simson.net/ref/ugh.pdf
For deleting I use file managers, unless the case is very special. Precisely for a reason like this.
Offline
Pages: 1