dpkg 中缺少 available-old 和 available - “dpkg:错误:无法打开软件包信息文件 `/var/lib/dpkg/available' 进行读取”

dpkg 中缺少 available-old 和 available - “dpkg:错误:无法打开软件包信息文件 `/var/lib/dpkg/available' 进行读取”

问题:许多帖子尝试使用以下选项解决损坏的软件包问题。但我的主要问题是可用的和可用的旧版本都不存在。我不知道我最后是如何删除它们的(如果不是因为软件包损坏,而是)

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:错误:无法打开软件包信息文件“/var/lib/dpkg/available”进行读取:没有此文件或目录 E:子进程 /usr/bin/dpkg 返回错误代码 (2)

我在 ubuntu 12.04 LTS 上,这是 /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 是手动创建的备份,status-bad 反映出我在备份之前(在不同的文件夹中)对“主”状态文件进行了此操作。因此状态文件应该没问题。

我还尝试了清除、自动删除 - 这基本上删除了损坏的软件包,但并没有解决没有可用软件包“列表”的主要问题。

我的问题 :

1.可用文件到底有什么?我可以用 dpkg -l 以某种方式手动更新它吗?

2.我该如何在不完全重新安装的情况下解决这个问题,以及 apt-get 是否有稳定的替代品(我认为 apt-get 仅适用于 dpkg?)如果我不解决这个问题,我还有什么可失去的?

作为 Canonical 故障排除的一部分,我还从更新管理器中取消选择了 ppa 存储库并选择了“主服务器”这里,但没有帮助。

以下是我的“状态”文件中的内容 -

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

答案1

只需从 Ubuntu 活动磁盘启动并将文件复制/var/lib/dpkg/available到实际安装 Ubuntu 的分区中的相应路径。

  • 从 Ubuntu 实时磁盘启动并在启动时单击尝试 Ubuntu 选项。

  • 现在按 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
    
  • 完成上述操作后,从硬盘启动。现在就可以正常工作了。

相关内容