Posted in Computers, Linux, Ubuntu

Help! Deleted /var folder contents

How did it happen?

Thinking that it would help me free up space on my /var partition, I logged on as root and did: rm -R *
It took a few seconds, and gave me an error about being unable to delete the “lock” and another folder.

Shortly after that, I tried to do an update using aptitude and apt-get, but get this error:

What am I to do?
Well, for starters – learn my lesson: Never, EVER delete anything from those system partitions without knowing what I’m deleting. Next time, a quick Google search should help me clean out my /var folder.

Next thing that I’ll do is run the Ubuntu Live CD and try to recover the system from there. I’ll add results later.


After searching the Internet and browsing the Ubuntu forums without much luck, I found a post which helped me get apt-get and aptitude working.

What I did: Create each folder that apt-get and aptitude were asking for.
For the /var/lib/dpkg/status (status) file, I had to “touch” a new file. It was then that sudo aptitude update worked.
# sudo touch /var/lib/dpkg/status

Now – the only problem so far is that the system no longer “remembers” the programs that are installed, but at least apt-get and aptitude are operational once again. From further readings, it seems that after deleting the contents of /var, a reinstall of the operating system may be necessary. This doesn’t cause much of an inconvenience for me, since I’ve been thinking of doing so for quite a few days now.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s