Fix dpkg available file in Ubuntu

This note relates to Ubuntu Maverick Meerkat (10.10) but it might apply to other versions, as well.

I wrote this note after my system became unstable following a number of configuration shenanigans. What did not help is that I had just upgraded from 10.04 to 10.10. Therefore, I am not sure that I can explain how to get to the state my platform was in.

Symptom: Every time an apt-get command is run, some sort of error or warning is reported stating that an available package has a corrupt version number.

Cause: The ‘available’ file used by dpkg contains erroneous information or is corrupted.

Solution: Rebuild the ‘available’ file.

Recipe:

1. Back up current file

2. Delete current ‘available’ file

3. Rebuild ‘available’ file

After these steps, commands to ‘apt-get’ should no longer complain about available versions.

3 Replies to “Fix dpkg available file in Ubuntu”

  1. My alternatives file had null bytes in it and I was getting an error:
    dpkg: error: parsing file ‘/var/lib/dpkg/available’ near line 32089:
    invalid package name (must start with an alphanumeric character)
    when attempting to update.
    After following your solution the update succeeded.
    Thank you.

    Note that step 2 should read “dpkg”, not “dpgk”.

  2. Thanks for posting this. I realise that it’s over 2 years old now but I stumbled across this when having the same problem as you describe. I’m using Ubunut 12.10 and this post (aside from changing aptitude to apt-get) fixed the problem.

    Cheers!

  3. On wheezy only with the command “dselect update” the /var/lib/dpkg/available was updates. With “apt-get update” or “aptitude update” the file was still zero.

Leave a Reply

Your email address will not be published. Required fields are marked *