Damaged /var/lib/dpkg/available

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

12 thoughts on “Damaged /var/lib/dpkg/available

  1. K.Mandla Post author

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

    Reply
  2. sebrem

    Hi, just create an empty /var/lib/dpkg/available, it will be rebuilt, at least here (sid).

    Reply
  3. tesseracter

    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)

    Reply
  4. Fubuntu

    Try the following:

    dpkg –clear-avail
    aptitude update

    This will download a new copy of available packages,
    hopefully removing corruption in the process.

    Reply
  5. Fubuntu

    That’s dpkg dash dash clear-avail
    The blog chews the double dash and converts to a longdash.

     dpkg --clear-avail
    aptitude update 
    Reply
  6. Pingback: Damaged /var/lib/dpkg/available (via Motho ke motho ka botho) « La Página de Horus

  7. modustollens

    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)

    Reply

Leave a reply to Fubuntu Cancel reply