Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

So I just did this on my up-to-date Arch system:

[anna@home ~]$ sudo rm -rf /usr/
^C[anna@home ~]$ ^C
[anna@home ~]$ ^C

I terminated the rm very quickly. I can't find anything wrong with /usr/ by eye.

What options are there to see if any damage was done? Is there some pacman integrity check that I should run? Any specific files I should check to make sure that the system can start again?

From now on, I'll keep backups of the entire system.

share|improve this question
2  
Reinstall all packages. I don't know arch, but on debian, I'd do apt-get install --reinstall list-of-all-packages-here, you should do the arch equivalent. –  Dennis Kaarsemaker Jul 13 '13 at 14:40
    
I can't find anything wrong with /usr/ by eye. Considering there are thousands of files in there, you'd only notice by eyeballing if a noticable percentage were gone. But it might only take one to cause problems. :( –  goldilocks Jul 13 '13 at 14:44
    
@goldilocks That basically meant that at least something is left in /usr/bin and /usr/lib. –  Anna Jul 13 '13 at 14:46

2 Answers 2

up vote 4 down vote accepted

I think Dennis Kaarsemaker wrote the right thing: reinstall all packages.

A few minutes googling revealed this Arch wiki article, with a section on reinstalling all packages. Since you didn't delete /var/cache/pacman/pkg, the process should happen locally. The command looks like this:

pacman -Qenq | pacman -S -

pacamn -Qeng only lists "explicitly installed", "native" packages by group. It may miss some packages from "extra" or "community" repositories, or any AUR packages you had installed. I'm personally afraid to try this, because my Arch installs are working, but

pacman -Qn | awk '{print $1}' | pacman -S -

might reinstall every single package it can. I'm not sure how it would handle a dependency that gets installed explictly later in the process. You might end up reinstalling packages that have already gotten re-installed as a dependency.

If you managed to delete pacman, I think the process just might involve a partial "new install" using the Arch install ISO, but I'm scared to recommend that.

share|improve this answer
    
Thanks. pacman is fortunately still there. –  Anna Jul 13 '13 at 15:19
    
@Anna - please update your question if and when you try something, so that at least I know what to do for my Arch installations. I think you've hit a corner case - not many people have done what you've done, at least publically. Upvoted answers might be wrong answers in your situation. –  Bruce Ediger Jul 13 '13 at 16:07
    
I tried to reinstall everything with your first command and ended up with 8000 lines of "xorg-server-devel: /usr/include/xorg/xorg-server.h exists in filesystem" (with different package names and filenames). pacman -Qo says that no package owns those files. –  Anna Jul 13 '13 at 16:41
    
All of those files except for four lie in /usr/. Most exist, though. –  Anna Jul 13 '13 at 16:43
    
It turns out that only a couple packages (kdebase-runtime kdeutils-kwallet make mercurial oxygen-icons-svg xorg-server-common xorg-server-devel) contained those 8000 files. I reinstalled them successfully using --force and am again reinstalling all the packages with your first command now. –  Anna Jul 13 '13 at 17:10

If you don't want to (re)install all packages you can do a trick: check /var/lib/pacman/local's subdirectories, and their files, which contains all installed files per package.

So a simple, not tested (and not perfect) script:

cd /var/lib/pacman
for package in *; do
    for file in $(grep ^usr ${package}/files); do
        [ -e "/${file}" ] || echo Bad package: ${package}
    done
done

You can improve this script (maybe if ${file} doesn't exist, run pacman -S ${package} and continue) but I think the main idea isn't too bad :)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.