-1

For some reason that I can't explain (being dumb I guess), I have installed packages from Debian sources. I use Ubuntu 18.04.

I'd like to fix my mistakes and downgrade to Ubuntu packages. What I did was dpkg -l | grep -v ubuntu | grep deb to list packages that have a 'deb' version instead of 'ubuntu'. For example, I was able to downgrade systemd from 241 to 237.

However, some packages won't accept being downgraded, for example perl won't downgrade unless I remove a LOT of packages, some crucial, so I can't accept this. Example:

root@KLK876:/etc/apt/preferences.d# apt-cache policy perl
perl:
  Installed: 5.28.1-6+deb10u1
  Candidate: 5.28.1-6+deb10u1
  Version table:
 *** 5.28.1-6+deb10u1 100
        100 /var/lib/dpkg/status
     5.26.1-6ubuntu0.5 500
        500 mirror://mirrors.ubuntu.com/mirrors.txt bionic-updates/main amd64 Packages
        500 mirror://mirrors.ubuntu.com/mirrors.txt bionic-security/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
     5.26.1-6 500
        500 mirror://mirrors.ubuntu.com/mirrors.txt bionic/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

So I try to revert to the ubuntu version:

root@KLK876:/etc/apt/preferences.d# aptitude install perl=5.26.1-6ubuntu0.5
The following packages will be DOWNGRADED:
  perl{b} 
0 packages upgraded, 0 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.
Need to get 201 kB of archives. After unpacking 7168 B will be freed.
The following packages have unmet dependencies:
 perl-base : Breaks: perl (< 5.28.1~) but 5.26.1-6ubuntu0.5 is to be installed
 libnet-libidn-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libb-hooks-op-check-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libnet-ssleay-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 liblist-moreutils-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libsereal-encoder-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libvariable-magic-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libdevel-callchecker-perl : Depends: perl (>= 5.28.1-4) but 5.26.1-6ubuntu0.5 is to be installed
 libdbi-perl : Depends: perl (>= 5.28.1-6+deb10u1) but 5.26.1-6ubuntu0.5 is to be installed
 perl-modules-5.28 : Breaks: perl (< 5.28.1~) but 5.26.1-6ubuntu0.5 is to be installed
 libfcgi-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libsnmp-perl : Depends: perl (>= 5.28.1-6) but 5.26.1-6ubuntu0.5 is to be installed
 texinfo : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libclass-c3-xs-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libpackage-stash-xs-perl : Depends: perl (>= 5.28.1-3) but 5.26.1-6ubuntu0.5 is to be installed
 libperlio-gzip-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libdevel-lexalias-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libsub-identify-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libclass-xsaccessor-perl : Depends: perl (>= 5.28.1-1) but 5.26.1-6ubuntu0.5 is to be installed
 libparams-util-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libposix-strptime-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libdevel-caller-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libterm-readkey-perl : Depends: perl (>= 5.28.1-3) but 5.26.1-6ubuntu0.5 is to be installed
 libunicode-utf8-perl : Depends: perl (>= 5.28.1-4) but 5.26.1-6ubuntu0.5 is to be installed
 libfile-fcntllock-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libcairo-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libparams-classify-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libclone-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libsub-name-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libunicode-linebreak-perl : Depends: perl (>= 5.28.1-4) but 5.26.1-6ubuntu0.5 is to be installed
 libnet-dbus-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libnet-dns-sec-perl : Depends: perl (>= 5.28.1-3) but 5.26.1-6ubuntu0.5 is to be installed
 libyaml-libyaml-perl : Depends: perl (>= 5.28.1-3) but 5.26.1-6ubuntu0.5 is to be installed
 libglib-perl : Depends: perl (>= 5.28.1-4) but 5.26.1-6ubuntu0.5 is to be installed
 libio-pty-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libxml-libxml-perl : Depends: perl (>= 5.28.1-4) but 5.26.1-6ubuntu0.5 is to be installed
 libpadwalker-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libmoose-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libemail-address-xs-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libsocket6-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libdbd-mysql-perl : Depends: perl (>= 5.28.1-4) but 5.26.1-6ubuntu0.5 is to be installed
 libcairo-gobject-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 perl : Depends: perl-base (= 5.26.1-6ubuntu0.5) but 5.28.1-6+deb10u1 is installed
 libxml-parser-perl : Depends: perl (>= 5.28.1-4) but 5.26.1-6ubuntu0.5 is to be installed
 libglib-object-introspection-perl : Depends: perl (>= 5.28.1-4) but 5.26.1-6ubuntu0.5 is to be installed
 libsereal-decoder-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libhtml-parser-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libalgorithm-diff-xs-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
 libperl-dev : Depends: perl:any (= 5.28.1-6+deb10u1) which is a virtual package, provided by:
                        - perl (5.28.1-6+deb10u1), but 5.26.1-6ubuntu0.5 is to be installed
                        - perl:i386 (5.26.1-6ubuntu0.5), but it is not going to be installed
                        - perl (5.26.1-6ubuntu0.5), but 5.26.1-6ubuntu0.5 is to be installed
                        - perl:i386 (5.26.1-6), but it is not going to be installed
                        - perl (5.26.1-6), but 5.26.1-6ubuntu0.5 is to be installed

 libclass-load-xs-perl : Depends: perl (>= 5.28.0-3) but 5.26.1-6ubuntu0.5 is to be installed
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     perl [5.28.1-6+deb10u1 (now)]                      



Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:

       Remove the following packages:                                                              
1)       apache2 [2.4.38-3+deb10u4 (now)]                                                          
2)       apache2-bin [2.4.38-3+deb10u4 (now)]                                                      
3)       apt-file [3.2.2 (now)]                                                                    
4)       apt-rdepends [1.3.0-6 (bionic, now)]                                                      
5)       autoconf [2.69-11.1 (now)]                                                                
6)       automake [1:1.16.1-4 (now)]                                                               
7)       build-essential [12.4ubuntu1 (bionic, now)]                                               
8)       cloc [1.74-1 (bionic, now)]                                                               
9)       command-not-found [18.04.5-1 (now)]                                                       
10)      debhelper [12.1.1ubuntu1~ubuntu18.04.1 (bionic-backports, now)]                           
11)      dh-autoreconf [19 (now)]                                                                  
12)      dh-strip-nondeterminism [1.8.0-1 (now)]                                                   
13)      dkms [2.3-3ubuntu9.7+elementary11~ubuntu5.0.1 (bionic, now)]                              
14)      doc-base [0.10.9 (now)]                                                                   
15)      dpkg-dev [1.19.7 (now)]                                                                   
16)      git [1:2.20.1-2+deb10u3 (now)]                                                            
17)      gnome-user-share [3.28.0-2 (now)]                                                         
18)      intltool-debian [0.35.0+20060710.5 (now)]                                                 
19)      libalgorithm-c3-perl [0.10-1 (bionic, now)]                                               
20)      libalgorithm-diff-perl [1.19.03-2 (now)]                                                  
21)      libalgorithm-diff-xs-perl [0.04-5+b1 (now)]                                               
22)      libalgorithm-merge-perl [0.08-3 (bionic, now)]                                            
23)      libapache2-mod-dnssd [0.6-3.2 (bionic, now)]                                              
24)      libapache2-mod-php7.4 [7.4.15-1+ubuntu18.04.1+deb.sury.org+1 (bionic, now)]               
25)      libarchive-cpio-perl [0.10-1 (bionic, now)]                                               
26)      libarchive-zip-perl [1.64-1 (now)]                                                        
27)      libasync-mergepoint-perl [0.04-2 (bionic, now)]                                           
28)      libauthen-sasl-perl [2.1600-1 (bionic, now)]                                              
29)      libb-hooks-endofscope-perl [0.24-1 (now)]                                                 
30)      libb-hooks-op-check-perl [0.22-1+b1 (now)]                                                
31)      libcairo-gobject-perl [1.004-3+b1 (now)]                                                  
32)      libcairo-perl [1.106-3+b1 (now)]                                                          
33)      libcapture-tiny-perl [0.48-1 (bionic, now)]                                               
34)      libcgi-fast-perl [1:2.15-1 (now)]                                                         
35)      libcgi-pm-perl [4.47-1 (now)]                                                             
36)      libclass-accessor-perl [0.51-1 (bionic, now)]                                             
37)      libclass-c3-perl [0.34-1 (now)]                                                           
38)      libclass-c3-xs-perl [0.14-1+b3 (now)]                                                     
39)      libclass-load-perl [0.25-1 (now)]                                                         
40)      libclass-load-xs-perl [0.10-1+b3 (now)]                                                   
41)      libclass-method-modifiers-perl [2.13-1 (now)]                                             
42)      libclass-tiny-perl [1.006-1 (bionic, now)]                                                
43)      libclass-xsaccessor-perl [1.19-3+b2 (now)]                                                
44)      libclone-perl [0.41-1+b1 (now)]                                                           
45)      libconvert-binhex-perl [1.125-1 (bionic, now)]                                            
46)      libdata-dump-perl [1.23-1 (bionic, now)]                                                  
47)      libdata-optlist-perl [0.110-1 (bionic, now)]                                              
48)      libdbd-mysql-perl [4.050-2 (now)]                                                         
49)      libdbi-perl [1.642-1+deb10u1 (now)]                                                       
50)      libdbus-1-dev [1.12.2-1ubuntu1.2 (bionic-security, bionic-updates, now)]                  
51)      libdevel-callchecker-perl [0.008-1 (now)]                                                 
52)      libdevel-caller-perl [2.06-2+b1 (now)]                                                    
53)      libdevel-globaldestruction-perl [0.14-1 (bionic, now)]                                    
54)      libdevel-lexalias-perl [0.05-2+b1 (now)]                                                  
55)      libdevel-overloadinfo-perl [0.005-1 (now)]                                                
56)      libdevel-partialdump-perl [0.20-1 (bionic, now)]                                          
57)      libdevel-stacktrace-perl [2.0400-1 (now)]                                                 
58)      libdigest-bubblebabble-perl [0.02-2 (bionic, now)]                                        
59)      libdigest-hmac-perl [1.03+dfsg-2 (now)]                                                   
60)      libdist-checkconflicts-perl [0.11-1 (bionic, now)]                                        
61)      libdpkg-perl [1.19.7 (now)]                                                               
62)      libdynaloader-functions-perl [0.003-1 (bionic, now)]                                      
63)      libemail-abstract-perl [3.008-2 (now)]                                                    
64)      libemail-address-xs-perl [1.04-1+b1 (now)]                                                
65)      libemail-date-format-perl [1.005-1 (bionic, now)]                                         
66)      libemail-foldertype-perl [0.813-1.2 (bionic, now)]                                        
67)      libemail-localdelivery-perl [1.200-1 (bionic, now)]                                       
68)      libemail-messageid-perl [1.406-1 (bionic, now)]                                           
69)      libemail-mime-contenttype-perl [1.022-1 (bionic, now)]                                    
70)      libemail-mime-encodings-perl [1.315-2 (bionic, now)]                                      
[...]                        
270)     aptitude recommends libparse-debianchangelog-perl                                         
271)     libnet-dns-perl recommends libdigest-bubblebabble-perl                                    
272)     libnet-dns-perl recommends libnet-libidn-perl                                             
273)     libio-socket-ssl-perl recommends libnet-libidn-perl | libnet-idn-encode-perl | liburi-perl
274)     libhtml-tree-perl recommends libhtml-format-perl                                          
275)     dpkg-dev recommends libalgorithm-merge-perl                                               
276)     libimage-exiftool-perl recommends libposix-strptime-perl                                  
[...]
296)     libwww-perl recommends libhtml-form-perl                                                  
297)     libwww-perl recommends libhtml-format-perl                                                
298)     libwww-perl recommends libhttp-daemon-perl                                                
299)     libwww-perl recommends libmailtools-perl                                                  
300)     libfile-stripnondeterminism-perl recommends libarchive-cpio-perl                          
301)     libxml-sax-perl recommends libxml-sax-expat-perl                                          
302)     libpackage-stash-perl recommends libpackage-stash-xs-perl                                 



Accept this solution? [Y/n/q/?] q
Abandoning all efforts to resolve these dependencies.
Abort.

As you can see the solution proposed is unacceptable. I have pressed 'n' many times but no solution provided results in a downgrade of perl and all its dependents without any major removal or unmet dependency.

I have listed all the packages in 'deb' version and asked aptitude to install their 'ubuntu' counterpart, but it's the same, aptitude either gives up or gives unwanted solutions (remove too many packages or do nothing).

How can I safely fix my mistake?

5
  • Saying that "Elementary OS ... is basically Ubuntu 18.04" is like saying "Coffee ... is basically water". Sure, they started out the same way, but they're quite different in many respects 😉
    – user1091774
    Feb 10, 2021 at 14:58
  • They use ubuntu apt sources, which is what this question is about. If I had said "ubuntu is basically debian", yes, I would agree with you. Here I don't think it applies. Also, the packages that have the problem are not from Elementary sources, they are exclusively from debian/ubuntu sources (conflict). Feb 10, 2021 at 14:58
  • Seems like you have discovered that a Debian-based system can be super-hard to downgrade. While downgrades are possible under many circumstances, it is not always possible. Were you running an Ubuntu system, our advice would be to backup your data and reinstall; it's faster and easier than hours of trial-and-error with apt. Since you are not running an Ubuntu system, we can only recommend that you consult Elementary OS support.
    – user535733
    Feb 10, 2021 at 15:11
  • Indeed it's hard. This is unrelated to Elementary OS though. It's an Ubuntu/Debian problem Feb 10, 2021 at 15:42
  • I love this question being closed as non-Ubuntu, while being 100% reproducible on Ubuntu only. Feb 21, 2021 at 22:41

2 Answers 2

1

my answer is based on the fact you have ubuntu bionic as OS

this is not so easy. Make a backup first from your important data. Remove any config you made by yourself; I mean this

500 mirror://mirrors.ubuntu.com/mirrors.txt bionic-updates/main amd64 Packages 500 mirror://mirrors.ubuntu.com/mirrors.txt bionic-security/main amd64 Packages

and of curse remove debian buster sources. and if integrated bionc-backports also. create

/etc/apt/preferences.d/ubuntu.pref

with following content. We make a try it with origin.

Package: *
Pin: origin us.archive.ubuntu.com
Pin-Priority: 1001 

Package: *
Pin: origin security.ubuntu.com
Pin-Priority: 1001 

#The next is only if you have partner in you sources

Package: *
Pin : release v=18.04,o=Canonical
Pin-Priority: 1001

refresh

sudo apt update

then you can make a simulation first.

apt -s full-upgrade

Note this can work or not.

0

@nobody's answer helped fix some packages, but no all.

I noticed that all debian packages were installed with /var/lib/dpkg/status and a priority of 100, while ubuntu packages were installed from an online source with a priority of 500.

So I listed all packages that were using the 100 version instead of the 500, and forced installed all of them (almost 1 by 1, from a total of about 1200) to the ubuntu version, sometimes removing packages that were debian only.

This took me almost a day, but eventually all packages were back to the ubuntu version and everything is now working again.

If somebody would be interested, here's what I did to identified the broken packages:

#!/bin/bash
dpkg -l \
         | awk '/^ii/{print $2}' \
         | while read p
do
        pol=$(apt-cache policy $p)
        ko=$(echo "$pol" | grep -P '\*{3} .* 100$')
        if [ "$ko" != "" ]; then
                echo $p=$(echo "$pol" | awk '/500$/{print $1;exit}')
        fi
done

I saved the output of this script into a file, and then randomly picked 10 or 20 from this file and used aptitude install (like aptitude install $(shuf -n 10 /tmp/pkg | tr \\n \ )) and used the awesome ability of aptitude to propose various solutions when there are conflicts. I always chose the options that only downgraded or proposed downgrade+removal of debian-only packages.

I finished by cleaning my sources and preferences, then ran apt update, apt upgrade and apt full-upgrade and everything was fixed.

That'll teach me! Thanks for the help.

Not the answer you're looking for? Browse other questions tagged .