Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can anyone tell me how I can undo a sudo rm -r /var/run mistake?

I can't use sftp and mysql now.

share|improve this question

migrated from Jan 1 '10 at 15:30

This question came from our site for professional and enthusiast programmers.

@BlueNovember: I'd edited that over on stackoverflow (… ).. , deleted here before noticing your question .. sorry for breaking the context. I figured the people on serverfault were most likely to have been in this "pit of doom" situation. – lexu Jan 1 '10 at 15:41
Ah, hence the confusion. Comment removed. =) – RJFalconer Jan 1 '10 at 15:53
up vote 3 down vote accepted

You can... reinstall debian!

There's a reason you should be careful with anything starting with "sudo rm", and this is it :P

share|improve this answer
sudo rm -r, actually. – Malfist Jan 1 '10 at 16:00
-f especially, but when you're deleting ANYTHING as root you should be bloody careful :P – Phoshi Jan 1 '10 at 16:13
You can always reinstall, but I personally would go to a lot of drudge work to avoid it... – dmckee Jan 1 '10 at 17:31
You can fix things like this by reinstalling, but you can also dive in and try and put it all back together. You'll learn alot more about your system that way, and be motivated never to ever make that mistake again. – Adam Luchjenbroers Jan 2 '10 at 0:34
yp, try mykhal's answer. I don't think you need to reinstall like if you had to learn a lesson?!?! – Robert Cutajar - Robajz Sep 7 '13 at 20:17

reinstalling debian is not necessary. in /var/run are stored temporary pid files.. just try if restart of broken services works, if not, do dpkg -S /var/run to see, which packages installed some subdirectories there (dpkg -L <PACKAGENAME> | grep /var/run), eventually you might want to try dpkg-reconfigure <PACKAGENAME>. then restart services (/etc/init.d/... restart) or entire debian.

share|improve this answer
See now, this is what happens when you know how your package manager works... – dmckee Jan 1 '10 at 17:30
This is so much easier than re-installing the whole OS and worked for me. Also, I had SELinux running in enforcing and had to run a restorecond as well. – Sebastian Carroll May 2 '15 at 10:31

I had a simular problem, i must have removed this directory; and received :

Can't open /var/run/ to signal atd. No atd running?

When running

at -m now -f ./run_my_file

I was able to fix it remaking the directory and restarting the atdeamon (atd)

sudo mkdir /var/run
sudo atd

Goodluck, we all make mistakes :)

ps. probably not the most solid-proof solution, but it worked !

share|improve this answer
sudo mkdir /var/run

If something complains about a subdirectory missing, create it in the same way. But packages are supposed to be robust against that now, because /var/run can be on a temporary file system. Worst case, reinstall the package in question.

share|improve this answer

Your Answer


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.