Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

packages have been kept back: How to get pkg list for it?

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
forca
Posts: 4
Joined: 2019-10-08 10:55

packages have been kept back: How to get pkg list for it?

#1 Post by forca »

It is very often use case, after apt-get update / upgrade, facing this message: "The following packages have been kept back:"

Calculating upgrade... Done
The following packages have been kept back:
libchromaprint1 htop vim
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

I know, what it is and what to do, to fix it.

My question is: How to get the whole list of those packages?
e.g.: "apt-get magic" ---> libchromaprint1 htop vim

Please, no awk or similar regex things, if possible. Where is this info located? Or is it dynamically created on apt-get running?
Thanks.

L_V
Posts: 1477
Joined: 2007-03-19 09:04
Been thanked: 11 times

Re: packages have been kept back: How to get pkg list for it

#2 Post by L_V »

Code: Select all

dpkg -l | grep '^h' | awk '{print $2}'

Code: Select all

aptitude search '~ahold'

forca
Posts: 4
Joined: 2019-10-08 10:55

Re: packages have been kept back: How to get pkg list for it

#3 Post by forca »

not working :(

root@p:/var/lib# apt-get -s upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
XXX-pkg1 XXX-pkg2
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

root@p:/var/lib# dpkg -l | grep '^h' | awk '{print $2}'

and aptitude not available.
It is an embedded dev. Only limited apt + dpkg available.

Any ideas?

L_V
Posts: 1477
Joined: 2007-03-19 09:04
Been thanked: 11 times

Re: packages have been kept back: How to get pkg list for it

#4 Post by L_V »

to see, output of

Code: Select all

dpkg -l | grep XXX-pkg1 XXX-pkg2

forca
Posts: 4
Joined: 2019-10-08 10:55

Re: packages have been kept back: How to get pkg list for it

#5 Post by forca »

a little bit background, I write a little c++ wrapper for apt, needed by an update-manager. So, I should be able to handle some simple use/error states. If after an apt-get update / upgrade, some kept back pkgs are detected (this works already, I just parse the std:out of apt-get), I wanna report the list with of those pkg (with kept back state) to the main side.
I just thought, it would be possible to find it with apt tools, intead of parsing/determine pgk list from std:out.

the point is, this behavior is created and prepared by me (XXX-pkg1 XXX-pkg2 are dummy pkgs, with some unmet deps), with a reason: get some kept back packages.

So, and my really issue now, to get this pkg list only...

L_V
Posts: 1477
Joined: 2007-03-19 09:04
Been thanked: 11 times

Re: packages have been kept back: How to get pkg list for it

#6 Post by L_V »

If dpkg returns nothing, check this:

Code: Select all

which -a dpkg

forca
Posts: 4
Joined: 2019-10-08 10:55

Re: packages have been kept back: How to get pkg list for it

#7 Post by forca »

no

Code: Select all

root@p:/var/lib# which -a dpkg
/usr/bin/dpkg
root@p:/var/lib# ls -l /usr/bin/dpkg
-rwxr-xr-x 1 root root 194240 Aug  7 20:03 /usr/bin/dpkg
root@p:/var/lib# /usr/bin/dpkg -l | grep '^h' | awk '{print $2}'
got it (more or less) with:

Code: Select all

apt-get -s --no-show-upgraded upgrade
but c++ parsing is terrible

any improvements are welcome

L_V
Posts: 1477
Joined: 2007-03-19 09:04
Been thanked: 11 times

Re: packages have been kept back: How to get pkg list for it

#8 Post by L_V »

If this returns nothing, you should investigate why

Code: Select all

dpkg -l | grep XXX-pkg1 XXX-pkg2
This is the package names you gave. If wrong, of course replace by real names.....
If these packages are installed, dpkg will give the exact status.
Don't look for complexity before this clarification.

Post Reply