I seem to have somehow corrupted my /var/lib/dpkg/available file, and I don’t see a way out of it. As a result I can’t install or update anything, and it might have gotten the better of me.
dpkg: parse error, in file `/var/lib/dpkg/available' near line 1:
EOF after field name `'
E: Sub-process /usr/bin/dpkg returned an error code (2)
A package failed to install. Trying to recover:
dpkg: parse error, in file `/var/lib/dpkg/available' near line 1:
EOF after field name `'
There’s an available-old file in that same directory, but a quick swap wasn’t any good. If I open the files in nano, they look garbled. Of course, that doesn’t necessarily mean they’re damaged, but that’s what I suspect.
I looked around for a solution, but didn’t find much.
No problem. My Killdisk v4.1 disc is working overtime these days. 😉
Hello K.Mandla,
Have you tried dselect update ?
No, I hadn’t seen anything about dselect update. If I can reproduce the garbled files I’ll try that, and see if it helps. I’m not really sure what happened in the first place, which makes it kind of mysterious. Usually, when I break something, I have an idea how I did it. 😉
Hi, just create an empty /var/lib/dpkg/available, it will be rebuilt, at least here (sid).
awesome i ended up google this saw the simple response “just delete it” worked great computer crashed when doing an update for me causig this.
@eric: it’s actually pretty different to create an empty file than deleting it
so, proper course of action:
> sudo mv /var/lib/dpkg/available /var/lib/dpkg/available.oldBusted
> sudo touch /var/lib/dpkg/available
> sudo apt-get update (or something else, this isnt the important part)
Tested just now and works just fine, thanks tesseracter for the summary.
Try the following:
dpkg –clear-avail
aptitude update
This will download a new copy of available packages,
hopefully removing corruption in the process.
That’s dpkg dash dash clear-avail
The blog chews the double dash and converts to a longdash.
Thanks for the tips! Had the problem of garbled files whilst running a persistent USB keypen install.
Pingback: Damaged /var/lib/dpkg/available (via Motho ke motho ka botho) « La Página de Horus
I had this problem. Spent hours trying to fix it.
Then I thought – maybe I could overwrite the busted file with a new version; googled the file name. Came up your post did here. Took you advice (see below). Fixed it right away. Wish I had tried this 6 hours ago – i was getting so frustrated i was going to re-install the whole damn OS.
I think my wifi signal crashed during a package installation – maybe that was how the file got corrupted.
So:
THANKS!
so, proper course of action:
> sudo mv /var/lib/dpkg/available /var/lib/dpkg/available.oldBusted
> sudo touch /var/lib/dpkg/available
> sudo apt-get update (or something else, this isnt the important part)