1

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

I can't use sftp and mysql now.

2
  • @BlueNovember: I'd edited that over on stackoverflow ( stackoverflow.com/questions/1988866/… ).. , 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, 2010 at 15:41
  • Ah, hence the confusion. Comment removed. =)
    – RJFalconer
    Jan 1, 2010 at 15:53

4 Answers 4

3

You can... reinstall debian!

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

5
  • sudo rm -r, actually.
    – Malfist
    Jan 1, 2010 at 16:00
  • 2
    -f especially, but when you're deleting ANYTHING as root you should be bloody careful :P
    – Phoshi
    Jan 1, 2010 at 16:13
  • 2
    You can always reinstall, but I personally would go to a lot of drudge work to avoid it... Jan 1, 2010 at 17:31
  • 2
    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. Jan 2, 2010 at 0:34
  • yp, try mykhal's answer. I don't think you need to reinstall like if you had to learn a lesson?!?! Sep 7, 2013 at 20:17
8

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.

2
  • See now, this is what happens when you know how your package manager works... Jan 1, 2010 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. May 2, 2015 at 10:31
1

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

Can't open /var/run/atd.pid 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 !

0
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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