酷徒LOGO

apt dpkg退出,错误"无法扫描更新目录 `/var/lib/dpkg/updates/': 没有此类文件或者目录",如何修复?


问题:

rm -r /var/lib/dpkg/*



现在,当我尝试升级时,我得到了:


E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)


E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?


masoud@masoud-PC:~$ sudo apt-get upgrade 


E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)


E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?



当我使用:sudo dpkg --configure -a

我得到:


dpkg: error: cannot scan updates directory `/var/lib/dpkg/updates/': No such file or directory



enter image description here

对于sudo apt-get upgrade -f 得到:


Reading package lists... Done


Building dependency tree 


Reading state information... Done


Correcting dependencies... failed.


The following packages have unmet dependencies:


 ia32-libs : Depends: ia32-libs-multiarch but it is not installable


 wine1.4 : Depends: wine1.4-i386 (= 1.4.1-0ubuntu5) but it is not installable


E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.


E: Unable to correct dependencies




答案1:

打开终端并键入以下命令:


sudo mkdir -p /var/lib/dpkg/{updates,alternatives,info,parts,triggers}


sudo killall apt* software-center* dpkg


sudo apt-get update


sudo apt-get purge wine1.4 ia32-libs-multiarch


sudo apt-get upgrade



第一个命令去掉了"无法扫描更新目录"(rm -r的灾难),然后需要结束dkpg apt实例来删除"Unable to lock"消息,第三,让清理软件包缓存,更新软件列表缓存和升级。


答案2:

开始需要重新创建/var/lib/dpkg/status文件。你应该在/var/backups/dpkg.status.0有个备份

首先创建dpkg文件夹,然后将/var/backups/dpkg.status.0复制到/var/lib/dpkg/status,如下所示,


 mkdir /var/lib/dpkg


 cp /var/backups/dpkg.status.0 /var/lib/dpkg/


 mv /var/lib/dpkg/dpkg.status.0 /var/lib/dpkg/status



update内部创建一个名为/var/lib/dpkg的文件夹


 mkdir /var/lib/dkpg/update



现在你必须重新安装所有已安装的应用程序。

注:

在/var/backups/上有额外的备份,即dpkg.status.1.dpkg.status.2,但是格式为zipped。如果想使用它,你必须解压缩它。






Copyright © 2011 HelpLib All rights reserved.    知识分享协议 京ICP备17041772号-2  |  如果智培  |  酷兔英语  |  帮酷