0

I'm using Debian10/KDE and since a few months ago one package was kept back. However, when using sudo apt update instead of sudo apt-get update it displays something else and allows to see the "additional version".

Why is that? Shouldn't this also be displayed with apt-get? Shouldn't it simply install version 2.8.5? (Why isn't it? How can it be installed?)

sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  python3-psycopg2
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
sudo apt 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.
sudo apt update
Reading package lists... Done
Building dependency tree       
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.
apt list --upgradable
Listing... Done
python3-psycopg2/stretch-pgdg 2.8.5-1~pgdg90+1 amd64 [upgradable from: 2.7.7-1]
N: There is 1 additional version. Please use the '-a' switch to see it
apt list --upgradable -a
Listing... Done
python3-psycopg2/stretch-pgdg 2.8.5-1~pgdg90+1 amd64 [upgradable from: 2.7.7-1]
python3-psycopg2/stable,now 2.7.7-1 amd64 [installed,upgradable to: 2.8.5-1~pgdg90+1]

Trying to debug further:

apt policy python3-psycopg2
python3-psycopg2:
  Installed: 2.7.7-1
  Candidate: 2.8.5-1~pgdg90+1
  Version table:
     2.8.5-1~pgdg90+1 500
        500 http://apt.postgresql.org/pub/repos/apt stretch-pgdg/main amd64 Packages
 *** 2.7.7-1 500
        500 http://ftp.XX.debian.org/debian buster/main amd64 Packages
        100 /var/lib/dpkg/status
sudo apt install python3-psycopg2
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 to resolve the situation:

The following packages have unmet dependencies: python3-psycopg2 : Depends: python3 (< 3.6) but 3.7.3-1 is to be installed E: Unable to correct problems, you have held broken packages.

Unlike in the linked question the usual sudo apt-get --with-new-pkgs upgrade doesn't work here:

sudo apt-get --with-new-pkgs 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.

Whatever the solution is: there should at least be a prompt/s when running sudo apt-get upgrade to install or not install that new version.

mYnDstrEAm
  • 4,275
  • 14
  • 57
  • 118
  • They seem to be from two different repositories, so probably the priority settings for those don't allow the automatic upgrade. I don't understand the "how" in the question title. How what? How can apt list --upgradable list upgradable packages? – muru Jan 06 '21 at 03:02
  • No it doesn't answer the question and sudo apt-get --with-new-pkgs upgrade did not solve the issue. I had to keep the title <150 chars: how can it be installed? (as in the text). @StephenKitt I updated the question after running these commands. – mYnDstrEAm Jan 06 '21 at 10:50
  • To solve this problem and additional step should be taken, by editing the sources.list. – GAD3R Jan 06 '21 at 12:33

1 Answers1

2

In your Postgresql repository change stretch codename to buster :

sudo sed -i 's/stretch/buster/' /etc/apt/sources.list.d/pgdg.list

then run:

sudo apt update
sudo apt upgrade

python3-psycopg2/stretch-pgdg 2.8.5-1~pgdg90+1 amd64 [upgradable from: 2.7.7-1]

The installed version python3-psycopg2 provided by debian repository need to be upgraded to 2.8.5-1~pgdg90+1 provided by postgresql repository. But before upgrading you need to set the correct repository which point to debian Buster instead of Stretch currently set.

PostgreSQL Apt Repository

GAD3R
  • 66,769
  • While this may be a useful thing for the OP to do, I don't see how this relates to the question. Could you explain how this would cause packages to be held back? – Philip Couling Jan 06 '21 at 08:10
  • @PhilipCouling I will clarify my answer. – GAD3R Jan 06 '21 at 08:12
  • 1
    Great, this solved the problem! I totally missed updating that repo after the upgrade - my fault. Maybe it would be good to recommend or automatically run a command to replace all repos using the old codename with the new one after an upgrade like so (this only works after sudo su): sed -i 's/stretch/buster/g' /etc/apt/sources.list && find /etc/apt/sources.list.d/ -type f -exec sed -i 's/stretch/buster/g' {} \; Some repos may not be available & it would be better if the commands/GUI also ran checks for this, changing back if it gets 404s & prob. be best if repos announced their presence. – mYnDstrEAm Jan 06 '21 at 11:18