Whenever I try to run any apt-get command, it gives me this error message:
dpkg: error: corrupt info database format file '/var/lib/dpkg/info/format'
E: Sub-process /usr/bin/dpkg returned an error code (2)
Please advice how to rectify this.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
Delete that "format" file, or if you're paranoid, back it up (move it to the RAM disk):
sudo mv /var/lib/dpkg/info/format /dev/shm
Mine only contains the number
1 and a carriage return (
\n), resulting in a two byte file. You can create this from the command line:
sudo printf "1\n" > /var/lib/dpkg/info/format
If it fails, then simply restore your backed up "format" file over the top of the new one you created.
sudo mv /dev/shm/format /var/lib/dpkg/info/