2

On an Ubuntu 16.04 (Xenial) system, I have installed a bunch of PPAs which installed packages with versions newer than the default repo packages, in an attempt to obtain some newer features that weren't available in the default repos.

Unfortunately, the system ended up being unstable. I removed all the PPAs, but now I have a whole bunch of packages that are ahead of the versions expected by the default repo packages and thus often incompatible with them.

An example of an error I'm getting with these new packages:

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

I've been re-stabilizing the system by manually identifying and downgrading each of these packages to the repo version. In this case, for example, I'd do:

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

This seems to solve the problem for each individual package, but unfortunately there's a huge number of them so I'l like to find some automated solution that would downgrade them all in a batch.

Is there a way to do that?

The primary way I imagine is to somehow identify all packages that only have /var/lib/dpkg/status as their source. Of course, if there's any other way I'd be happy to learn it.

I have tried the solution from the suggested existing question and all I get is:

$ 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.
7
  • 4
    Possible duplicate of Downgrade a bunch of packages – Kristopher Ives Feb 17 '19 at 18:32
  • @KristopherIves Thanks, but I tried the solution and it does nothing (while I'm sure there's many such packages remaining): 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. – Dun Peal Feb 17 '19 at 18:37
  • Did you see the ppa-purge command? – Kristopher Ives Feb 17 '19 at 18:38
  • @KristopherIves Yes, but there were several PPAs ans they were all removed. I'm not sure if I can even find them all again - most of them were added a long time ago. – Dun Peal Feb 17 '19 at 18:41
  • The easy way was to use ppa-purge. When you rejected that path, you chose a more difficult path. Use of dist-upgrade is not recommended - it will recalculate your system's needs, and might install/uninstall packages that you don't expect. – user535733 Feb 17 '19 at 19:01
0

I had a similar problem as the OP. I'm trying to install libsdl2-dev, which fails because

$ 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.

This seems to be happening because a lot of installed packages don't have a 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 is able to automatically downgrade packages that are blocking installation of libsdl2-dev. Not exactly what OP is asking for. But was useful to me, and should be useful to others. For me, when I first run aptitude, it gives this as the first resolution

# 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/?]

Say no to this solution. A side note. It could be acceptable to just keep the current installed version. But I felt it was safer to stick with the official Ubuntu packages, or from repos that I want to use.

The next solution is to downgrade packages to versions that are part of know repos.

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/?]

There you go. Now at least the orphaned packages that are blocking the install of libsdl2-dev have been downgraded to versions that are known to repos.

1
  • I'm confused by this answer. Where in this answer is the solution to the question asked? It looks like the first two thirds of the content of this answer are giving instructions to apply some failed solution. This kind of narrative should not be included in an answer because it is confusing and will result in people actually trying to apply this "non-answer". One of our goals on AU is to provide answers without chitchat or distraction. Can you edit your answer and consolidate your answer to the solution only. Just tell us how to apply the working answer, leave out the rest. – Nmath Nov 8 '20 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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