我如何识别和/或降级所有仅以 /var/lib/dpkg/status 作为源的软件包?

我如何识别和/或降级所有仅以 /var/lib/dpkg/status 作为源的软件包?

在 Ubuntu 16.04(Xenial)系统上,我安装了一堆 PPA,这些 PPA 安装的软件包版本比默认 repo 软件包更新,以尝试获得默认 repo 中没有的一些新功能。

不幸的是,系统最终变得不稳定。我删除了所有 PPA,但现在我有一大堆软件包,它们的版本都比默认 repo 软件包所期望的版本要高,因此经常与它们不兼容。

以下是我在使用这些新包时遇到的错误示例:

E: Can't find a source to download version '2.40.16-1~ubuntu16.04.1' of 'librsvg2-2:amd64'
E: Internal error: couldn't generate list of packages to download
$ apt policy librsvg2-2:amd64
librsvg2-2:
  Installed: 2.40.16-1~ubuntu16.04.1
  Candidate: 2.40.16-1~ubuntu16.04.1
  Version table:
 *** 2.40.16-1~ubuntu16.04.1 100
        100 /var/lib/dpkg/status
     2.40.13-3 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages

我一直在通过手动识别并将每个软件包降级到 repo 版本来重新稳定系统。例如,在这种情况下,我会这样做:

sudo apt install librsvg2-2:amd64=2.40.13-3

这似乎可以解决每个单独包的问题,​​但不幸的是,包数量实在太多了,所以我想找到一些自动化的解决方案,可以批量降级它们。

有没有办法做到这一点?

我认为最主要的方法是以某种方式识别所有仅以/var/lib/dpkg/status为来源的包。当然,如果有其他方法,我很乐意学习。

我已经尝试过解决方案建议的现有问题我得到的是:

$ sudo apt-get -o Dir::Etc::Preferences=a_p dist-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

答案1

我遇到了与楼主类似的问题。我尝试安装libsdl2-dev,但失败了,因为

$ sudo apt install libsdl2-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help resolve the situation:

The following packages have unmet dependencies:
 libsdl2-dev : Depends: libasound2-dev but it is not going to be installed
               Depends: libegl1-mesa-dev but it is not going to be installed
               Depends: libgl1-mesa-dev but it is not going to be installed
               Depends: libgles2-mesa-dev but it is not going to be installed
               Depends: libglu1-mesa-dev but it is not going to be installed
               Depends: libmirclient-dev but it is not going to be installed
               Depends: libpulse-dev but it is not going to be installed
               Depends: libudev-dev but it is not going to be installed
               Depends: libxkbcommon-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

发生这种情况的原因似乎是许多已安装的软件包没有 repo。

$ sudo apt policy libxcb-present0
libxcb-present0:
  Installed: 1.13-2~ubuntu18.04
  Candidate: 1.13-2~ubuntu18.04
  Version table:
 *** 1.13-2~ubuntu18.04 100
        100 /var/lib/dpkg/status
     1.13-1 500
        500 http://ca.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

aptitude能够自动降级阻止安装的软件包libsdl2-dev。这并不是 OP 所要求的。但对我很有用,对其他人也应该有用。对我来说,当我第一次运行 aptitude 时,它​​给出了这个作为第一个解决方案

# aptitude install libsdl2-dev

<snip>

The following packages have unmet dependencies:
 libdrm-dev : Depends: libdrm2 (= 2.4.100-3~b~padoka0) but 2.4.101-2~18.04.1 is installed
              Depends: libdrm-intel1 (= 2.4.100-3~b~padoka0) but 2.4.101-2~18.04.1 is installed
              Depends: libdrm-radeon1 (= 2.4.100-3~b~padoka0) but 2.4.101-2~18.04.1 is installed
              Depends: libdrm-nouveau2 (= 2.4.100-3~b~padoka0) but 2.4.101-2~18.04.1 is installed
              Depends: libdrm-amdgpu1 (= 2.4.100-3~b~padoka0) but 2.4.101-2~18.04.1 is installed
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     libdrm-dev [Not Installed]                         
2)     libegl1-mesa-dev [Not Installed]                   
3)     libgl1-mesa-dev [Not Installed]                    
4)     libgles2-mesa-dev [Not Installed]                  
5)     libglu1-mesa-dev [Not Installed]                   
6)     libsdl2-dev [Not Installed]                        
7)     mesa-common-dev [Not Installed]                    



Accept this solution? [Y/n/q/?]

拒绝这个解决方案。附注:保留当前安装的版本是可以接受的。但我觉得坚持使用官方的 Ubuntu 软件包或我想要使用的存储库更安全。

下一个解决方案是将软件包降级为已知存储库的版本。

The following actions will resolve these dependencies:

      Downgrade the following packages:                                               
1)      libdrm-amdgpu1 [2.4.101-2~18.04.1 (now) -> 2.4.100-3~b~padoka0 (bionic)]      
2)      libdrm-amdgpu1:i386 [2.4.101-2~18.04.1 (now) -> 2.4.100-3~b~padoka0 (bionic)] 
3)      libdrm-intel1 [2.4.101-2~18.04.1 (now) -> 2.4.100-3~b~padoka0 (bionic)]       
4)      libdrm-intel1:i386 [2.4.101-2~18.04.1 (now) -> 2.4.100-3~b~padoka0 (bionic)]  
5)      libdrm-nouveau2 [2.4.101-2~18.04.1 (now) -> 2.4.100-3~b~padoka0 (bionic)]     
6)      libdrm-nouveau2:i386 [2.4.101-2~18.04.1 (now) -> 2.4.100-3~b~padoka0 (bionic)]
7)      libdrm-radeon1 [2.4.101-2~18.04.1 (now) -> 2.4.100-3~b~padoka0 (bionic)]      
8)      libdrm-radeon1:i386 [2.4.101-2~18.04.1 (now) -> 2.4.100-3~b~padoka0 (bionic)] 
9)      libdrm2 [2.4.101-2~18.04.1 (now) -> 2.4.100-3~b~padoka0 (bionic)]             
10)     libdrm2:i386 [2.4.101-2~18.04.1 (now) -> 2.4.100-3~b~padoka0 (bionic)]        



Accept this solution? [Y/n/q/?]

就这样。现在至少阻止 libsdl2-dev 安装的孤立软件包已降级为存储库已知的版本。

相关内容