This question already has an answer here:
I was receiving an error earlier from a fresh install of the Ubuntu server. Normally I grab either ubuntu server or the mini install and go from there myself.
This time when I started trying to use packages using
apt-get install or
apt-get update I would get an error:
Reading package list... Error! E: Read error - read ( 21: Is a directory ) E: The package lists or status file could not be parsed or opened.
I wasn't entirely sure what this meant so I searched around google and came up with a number of different solutions, some involving synaptic while others involved dpkg. I even started removing all of the 'unstable' repositories from
/etc/sources/list.d leaving only a few behind.
Either way I got hasty and mad and deleted the
/var/lib/dpkg/ contents and I didn't make a backup. (I'm running it on a virtual machine so it's not a big deal I could just reinstall but I'd rather understand the actual problem).
In the case that I completely screwed up
dpkg and deleted essential files, is there any easy way to repair this?