Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Issue : Many threads try to solve the broken packages problem using the options as below. However my main problem is that BOTH the available & available-old do not exist . I have no clue how I ended up deleting them(if it wasnt because of a corrupt package, instead)

sudo dpkg --clear-avail && sudo apt-get update
sudo dpkg-reconfigure -a 
ekta@superwomen:~$ sudo apt-get dselect-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
  bluez bluez-alsa bluez-cups bluez-gstreamer cython dpkg dpkg-dev firefox
  firefox-globalmenu firefox-locale-en flashplugin-installer
  gnome-settings-daemon libbluetooth3 libdpkg-perl liblcms2-2 thunderbird
  thunderbird-gnome-support thunderbird-locale-en thunderbird-locale-en-us
  unity-greeter
20 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/72.5 MB of archives.
After this operation, 15.7 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Preconfiguring packages ...
dpkg: error: failed to open package info file `/var/lib/dpkg/available' for reading: No such file or directory
E: Sub-process /usr/bin/dpkg returned an error code (2)


sudo do-release-upgrade

dpkg: error: failed to open package info file `/var/lib/dpkg/available' for reading: No such file or directory
E: Sub-process /usr/bin/dpkg returned an error code (2)


--- from update manager ---
    installArchives() failed: perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_IN.ISO8859-1"
        are supported and installed on your system.
    perl: warning: Falling back to the standard locale ("C").
    locale: Cannot set LC_CTYPE to default locale: No such file or directory
    locale: Cannot set LC_MESSAGES to default locale: No such file or directory
    locale: Cannot set LC_ALL to default locale: No such file or directory
    Preconfiguring packages ...
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_IN.ISO8859-1"
        are supported and installed on your system.
    perl: warning: Falling back to the standard locale ("C").
    locale: Cannot set LC_CTYPE to default locale: No such file or directory
    locale: Cannot set LC_MESSAGES to default locale: No such file or directory
    locale: Cannot set LC_ALL to default locale: No such file or directory
    Preconfiguring packages ...
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_IN.ISO8859-1"
        are supported and installed on your system.
    perl: warning: Falling back to the standard locale ("C").
    locale: Cannot set LC_CTYPE to default locale: No such file or directory
    locale: Cannot set LC_MESSAGES to default locale: No such file or directory
    locale: Cannot set LC_ALL to default locale: No such file or directory
    Preconfiguring packages ...
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_IN.ISO8859-1"
        are supported and installed on your system.
    perl: warning: Falling back to the standard locale ("C").
    locale: Cannot set LC_CTYPE to default locale: No such file or directory
    locale: Cannot set LC_MESSAGES to default locale: No such file or directory
    locale: Cannot set LC_ALL to default locale: No such file or directory
    Preconfiguring packages ...
    dpkg: error: failed to open package info file `/var/lib/dpkg/available' for reading: No such file or directory

dpkg: error: failed to open package info file `/var/lib/dpkg/available' for reading: No such file or directory E: Sub-process /usr/bin/dpkg returned an error code (2)

I am on ubuntu 12.04 LTS & here's the contents of /var/lib/dpkg

ekta@superwomen:/var/lib/dpkg$ ls -l 
total 9932
drwxr-xr-x 2 root root    4096 Apr 29 15:23 alternatives
drwxr-xr-x 2 root root  372736 May  4 20:08 info
-rw-r--r-- 1 root root       0 May  4 22:31 lock
drwxr-xr-x 2 root root    4096 Apr 13  2012 parts
-rw-r--r-- 1 root root 1975559 May  4 22:32 status
-rw-r--r-- 1 root root 1947927 May  4 21:39 status-bad
-rw-r--r-- 1 root root 1947932 May  4 20:48 status-old
-rw-r--r-- 1 root root 1947932 May  4 21:48 status_ekta
-rw-r--r-- 1 root root 1948728 May  4 20:48 status~
drwxr-xr-x 2 root root    4096 Apr 29 15:23 triggers
drwxr-xr-x 2 root root    4096 May  4 21:39 updates

status_ekta is a manually created backup & status-bad reflects that I did this manipulation to the "main" status file before taking the backup (in a different folder) . Status file, thus should be fine.

I also tried purge, autoremove - which basically removed the corrupt packages, but does not solve the main problem of not having the "list" of available packages.

My question :

1. What does the available file have anyway ? can I update this manually using dpkg -l somehow?

2. How do I solve this without complete re-install, and if there are stable alternatives to apt-get (apt-get is ONLY for dpkg I assume ?) What else will I have to live without, if I do not fix this ?

I also deselected the ppa repos from update manager & selected the "Main Server" , as a part of Canonical troubleshooting here, but it did not help.

Here's what I have in my "status" file -

ekta@superwomen:/var/lib/dpkg$ cat status | grep "Status:" | sort -u 
Status: deinstall ok config-files
Status: install ok installed
share|improve this question

1 Answer 1

Just boot from Ubuntu live disk and copy the /var/lib/dpkg/available file to it's corresponding path in the partition where Ubuntu is actually installed.

  • Boot from Ubuntu live disk and the click on try Ubuntu option on startup.

  • Now openup the terminal by pressing ctrl+Alt+T.

    sudo mount /dev/sdaX /mnt        # Where /dev/sdaX is your installed Ubuntu's partition
    sudo cp /var/lib/dpkg/available /mnt/var/lib/dpkg
    
  • After the above operation, boot from your Hard-disk. Now it will work.

share|improve this answer
    
/dev/sda1 is your root partition. So replace /dev/sdaX in the above answer with /dev/sda1 –  Avinash Raj May 5 at 3:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.