2

Running Debian I often come across a flood of packages that could be upgraded. I don't want to just apt upgrade without doing it carefully so I want to install 'non-serious' packages first (with their associated libs, etc. - in groups), before I look at the 'serious' ones.

A hacky way of doing that is at the end of this question, but I'm sure there are better ways, as well as possibly this question bringing to light better ideas or concerns.

QUESTION: How can I install subgroups of related packages all together, from apt list --upgradeable?

If here is the output of the above command;

apparmor/testing 2.13.3-5+b1 amd64 [upgradable from: 2.13.3-5]
gir1.2-atk-1.0/testing 2.34.1-1 amd64 [upgradable from: 2.34.0-1]
gir1.2-totem-1.0/testing 3.34.1-2 amd64 [upgradable from: 3.34.0-1+b1]
gjs/testing 1.58.1-1 amd64 [upgradable from: 1.58.0-2]
gnome-calculator/testing 3.34.1-1 amd64 [upgradable from: 3.34.0-1]
graphviz/testing 2.42.2-3 amd64 [upgradable from: 2.40.1-7]
hexchat/testing 2.14.2-5+b1 amd64 [upgradable from: 2.14.2-5]
imagemagick-6.q16/testing 8:6.9.10.23+dfsg-2.1+b2 amd64 [upgradable from: 8:6.9.10.23+dfsg-2.1+b1]
imagemagick/testing 8:6.9.10.23+dfsg-2.1+b2 amd64 [upgradable from: 8:6.9.10.23+dfsg-2.1+b1]
iputils-ping/testing 3:20190709-2 amd64 [upgradable from: 3:20190709-1]
libalgorithm-diff-xs-perl/testing 0.04-5+b2 amd64 [upgradable from: 0.04-5+b1]
libapparmor1/testing 2.13.3-5+b1 amd64 [upgradable from: 2.13.3-5]
libapt-pkg-perl/testing 0.1.36+b2 amd64 [upgradable from: 0.1.36+b1]
libatk-adaptor/testing 2.34.1-1 amd64 [upgradable from: 2.34.0-3]
libatk-bridge2.0-0/testing 2.34.1-1 amd64 [upgradable from: 2.34.0-3]
libatk-bridge2.0-dev/testing 2.34.1-1 amd64 [upgradable from: 2.34.0-3]
libatk1.0-0/testing 2.34.1-1 amd64 [upgradable from: 2.34.0-1]
libatk1.0-data/testing 2.34.1-1 all [upgradable from: 2.34.0-1]
libatk1.0-dev/testing 2.34.1-1 amd64 [upgradable from: 2.34.0-1]
libatk1.0-doc/testing 2.34.1-1 all [upgradable from: 2.34.0-1]
libb-hooks-op-check-perl/testing 0.22-1+b2 amd64 [upgradable from: 0.22-1+b1]
libcairo-gobject-perl/testing 1.005-2+b1 amd64 [upgradable from: 1.005-2]
libcairo-perl/testing 1.106-3+b2 amd64 [upgradable from: 1.106-3+b1]
libcdt5/testing 2.42.2-3 amd64 [upgradable from: 2.40.1-7]
libcgraph6/testing 2.42.2-3 amd64 [upgradable from: 2.40.1-7]
libclass-xsaccessor-perl/testing 1.19-3+b3 amd64 [upgradable from: 1.19-3+b2]
libclone-perl/testing 0.41-1+b2 amd64 [upgradable from: 0.41-1+b1]
libcommon-sense-perl/testing 3.74-2+b8 amd64 [upgradable from: 3.74-2+b7]
libdbd-mysql-perl/testing 4.050-2+b1 amd64 [upgradable from: 4.050-2]
libdbi-perl/testing 1.642-1+b2 amd64 [upgradable from: 1.642-1+b1]
libdevel-callchecker-perl/testing 0.008-1+b1 amd64 [upgradable from: 0.008-1]
libfcgi-perl/testing 0.78-2+b4 amd64 [upgradable from: 0.78-2+b3]
libfile-fcntllock-perl/testing 0.22-3+b6 amd64 [upgradable from: 0.22-3+b5]
libgd-perl/testing 2.71-2+b1 amd64 [upgradable from: 2.71-2]
libgdal-dev/testing 2.4.2+dfsg-1+b3 amd64 [upgradable from: 2.4.2+dfsg-1+b2]
libgdal20/testing 2.4.2+dfsg-1+b3 amd64 [upgradable from: 2.4.2+dfsg-1+b2]
libgjs0g/testing 1.58.1-1 amd64 [upgradable from: 1.58.0-2]
libglib-object-introspection-perl/testing 0.047-1+b1 amd64 [upgradable from: 0.047-1]
libglib-perl/testing 3:1.329.1-1+b1 amd64 [upgradable from: 3:1.329.1-1]
libglib2.0-0/testing 2.62.1-1 amd64 [upgradable from: 2.62.0-3]
libglib2.0-bin/testing 2.62.1-1 amd64 [upgradable from: 2.62.0-3]
libglib2.0-data/testing 2.62.1-1 all [upgradable from: 2.62.0-3]
libglib2.0-dev-bin/testing 2.62.1-1 amd64 [upgradable from: 2.62.0-3]
libglib2.0-dev/testing 2.62.1-1 amd64 [upgradable from: 2.62.0-3]
libglib2.0-doc/testing 2.62.1-1 all [upgradable from: 2.62.0-3]
libgvc6/testing 2.42.2-3 amd64 [upgradable from: 2.40.1-7]
libgvpr2/testing 2.42.2-3 amd64 [upgradable from: 2.40.1-7]
libhtml-parser-perl/testing 3.72-3+b4 amd64 [upgradable from: 3.72-3+b3]
libimage-magick-q16-perl/testing 8:6.9.10.23+dfsg-2.1+b2 amd64 [upgradable from: 8:6.9.10.23+dfsg-2.1+b1]
libio-pty-perl/testing 1:1.08-1.1+b6 amd64 [upgradable from: 1:1.08-1.1+b5]
libjson-xs-perl/testing 4.020-1+b1 amd64 [upgradable from: 4.020-1]
liblab-gamut1/testing 2.42.2-3 amd64 [upgradable from: 2.40.1-7]
libldap-2.4-2/testing 2.4.48+dfsg-1+b1 amd64 [upgradable from: 2.4.48+dfsg-1]
liblinux-epoll-perl/testing 0.016-1+b2 amd64 [upgradable from: 0.016-1+b1]
liblist-moreutils-perl/testing 0.416-1+b5 amd64 [upgradable from: 0.416-1+b4]
liblocale-gettext-perl/testing 1.07-3+b5 amd64 [upgradable from: 1.07-3+b4]
liblz4-1/testing 1.9.1-2 amd64 [upgradable from: 1.8.3-1+b1]
libmagick++-6.q16-8/testing 8:6.9.10.23+dfsg-2.1+b2 amd64 [upgradable from: 8:6.9.10.23+dfsg-2.1+b1]
libmagickcore-6.q16-6/testing 8:6.9.10.23+dfsg-2.1+b2 amd64 [upgradable from: 8:6.9.10.23+dfsg-2.1+b1]
libmagickwand-6.q16-6/testing 8:6.9.10.23+dfsg-2.1+b2 amd64 [upgradable from: 8:6.9.10.23+dfsg-2.1+b1]
libnet-dbus-perl/testing 1.1.0-6+b1 amd64 [upgradable from: 1.1.0-6]
libnet-dns-sec-perl/testing 1.13-1+b1 amd64 [upgradable from: 1.13-1]
libnet-libidn-perl/testing 0.12.ds-3+b2 amd64 [upgradable from: 0.12.ds-3+b1]
libnet-ssleay-perl/testing 1.88-1+b1 amd64 [upgradable from: 1.88-1]
libpango-perl/testing 1.227-3+b2 amd64 [upgradable from: 1.227-3+b1]
libparams-classify-perl/testing 0.015-1+b2 amd64 [upgradable from: 0.015-1+b1]
libpathplan4/testing 2.42.2-3 amd64 [upgradable from: 2.40.1-7]
libperlio-gzip-perl/testing 0.19-1+b6 amd64 [upgradable from: 0.19-1+b5]
libpurple0/testing 2.13.0-2.2+b1 amd64 [upgradable from: 2.13.0-2.2]
libpython2.7-dev/testing 2.7.17~rc1-1 amd64 [upgradable from: 2.7.16-4]
libpython2.7-minimal/testing 2.7.17~rc1-1 amd64 [upgradable from: 2.7.16-4]
libpython2.7-stdlib/testing 2.7.17~rc1-1 amd64 [upgradable from: 2.7.16-4]
libpython2.7/testing 2.7.17~rc1-1 amd64 [upgradable from: 2.7.16-4]
libpython3.7-dev/testing 3.7.5~rc1-2 amd64 [upgradable from: 3.7.5~rc1-1]
libpython3.7-minimal/testing 3.7.5~rc1-2 amd64 [upgradable from: 3.7.5~rc1-1]
libpython3.7-stdlib/testing 3.7.5~rc1-2 amd64 [upgradable from: 3.7.5~rc1-1]
libpython3.7/testing 3.7.5~rc1-2 amd64 [upgradable from: 3.7.5~rc1-1]
libref-util-xs-perl/testing 0.117-1+b2 amd64 [upgradable from: 0.117-1+b1]
libsereal-decoder-perl/testing 4.007+ds-1+b1 amd64 [upgradable from: 4.007+ds-1]
libsereal-encoder-perl/testing 4.007+ds-1+b1 amd64 [upgradable from: 4.007+ds-1]
libsnmp30/testing 5.7.3+dfsg-5+b2 amd64 [upgradable from: 5.7.3+dfsg-5+b1]
libsqlite3-0/testing 3.30.0-1 amd64 [upgradable from: 3.29.0-2]
libsqlite3-dev/testing 3.30.0-1 amd64 [upgradable from: 3.29.0-2]
libsub-name-perl/testing 0.21-1+b4 amd64 [upgradable from: 0.21-1+b3]
libsvn1/testing 1.10.6-1+b1 amd64 [upgradable from: 1.10.6-1]
libterm-readkey-perl/testing 2.38-1+b1 amd64 [upgradable from: 2.38-1]
libtext-charwidth-perl/testing 0.04-9+b1 amd64 [upgradable from: 0.04-9]
libtext-iconv-perl/testing 1.7-6+b2 amd64 [upgradable from: 1.7-6]
libtotem0/testing 3.34.1-2 amd64 [upgradable from: 3.34.0-1+b1]
libtype-tiny-xs-perl/testing 0.016-1+b1 amd64 [upgradable from: 0.016-1]
libunicode-utf8-perl/testing 0.62-1+b1 amd64 [upgradable from: 0.62-1]
libxdot4/testing 2.42.2-3 amd64 [upgradable from: 2.40.1-7]
libxml-libxml-perl/testing 2.0134+dfsg-1+b1 amd64 [upgradable from: 2.0134+dfsg-1]
libxml-parser-perl/testing 2.46-1+b1 amd64 [upgradable from: 2.46-1]
libyaml-libyaml-perl/testing 0.80+repack-2+b1 amd64 [upgradable from: 0.80+repack-2]
libzbar0/testing 0.23-1.1+b1 amd64 [upgradable from: 0.23-1.1]
linux-compiler-gcc-8-x86/testing 5.2.17-1+b1 amd64 [upgradable from: 5.2.17-1]
linux-headers-5.2.0-3-amd64/testing 5.2.17-1+b1 amd64 [upgradable from: 5.2.17-1]
linux-kbuild-5.2/testing 5.2.17-1+b1 amd64 [upgradable from: 5.2.17-1]
linux-libc-dev/testing 5.2.17-1+b1 amd64 [upgradable from: 5.2.17-1]
meson/testing 0.52.0-1 all [upgradable from: 0.51.2-1]
node-yargs-parser/testing 15.0.0-1 all [upgradable from: 14.0.0-2]
openjdk-11-jdk-headless/testing 11.0.5+9-1 amd64 [upgradable from: 11.0.5+6-2]
openjdk-11-jdk/testing 11.0.5+9-1 amd64 [upgradable from: 11.0.5+6-2]
openjdk-11-jre-headless/testing 11.0.5+9-1 amd64 [upgradable from: 11.0.5+6-2]
openjdk-11-jre/testing 11.0.5+9-1 amd64 [upgradable from: 11.0.5+6-2]
openssh-client/testing 1:8.1p1-1 amd64 [upgradable from: 1:8.0p1-7]
openssh-server/testing 1:8.1p1-1 amd64 [upgradable from: 1:8.0p1-7]
openssh-sftp-server/testing 1:8.1p1-1 amd64 [upgradable from: 1:8.0p1-7]
perl-base/testing 5.30.0-6 amd64 [upgradable from: 5.28.1-6]
perl/testing 5.30.0-6 amd64 [upgradable from: 5.28.1-6]
pidgin/testing 2.13.0-2.2+b1 amd64 [upgradable from: 2.13.0-2.2]
python2.7-dev/testing 2.7.17~rc1-1 amd64 [upgradable from: 2.7.16-4]
python2.7-minimal/testing 2.7.17~rc1-1 amd64 [upgradable from: 2.7.16-4]
python2.7/testing 2.7.17~rc1-1 amd64 [upgradable from: 2.7.16-4]
python3.7-dev/testing 3.7.5~rc1-2 amd64 [upgradable from: 3.7.5~rc1-1]
python3.7-minimal/testing 3.7.5~rc1-2 amd64 [upgradable from: 3.7.5~rc1-1]
python3.7/testing 3.7.5~rc1-2 amd64 [upgradable from: 3.7.5~rc1-1]
subversion/testing 1.10.6-1+b1 amd64 [upgradable from: 1.10.6-1]
texinfo/testing 6.6.0.dfsg.1-2+b1 amd64 [upgradable from: 6.6.0.dfsg.1-2]
totem-common/testing 3.34.1-2 all [upgradable from: 3.34.0-1]
totem-plugins/testing 3.34.1-2 amd64 [upgradable from: 3.34.0-1+b1]
totem/testing 3.34.1-2 amd64 [upgradable from: 3.34.0-1+b1]
usb.ids/testing 2019.10.05-1 all [upgradable from: 2019.07.27-1]

I would like to update/install all the python2 related things, first. So I would do this:

 sudo apt-get -s install $(sudo apt list --upgradeable | cut -d " " -f 1 | sed 's/\/[a-z]*$//' | awk '/python3/' | tr "\n" " ")

Of course, at every pipe this could be broken into pieces, and possibly > to files.

I also note that apt claims to be unstable with scripts.

Of course, it seems apt-get will accept a 'vertical list' of packages too, e.g.

 sudo apt-get -s install $(sudo apt list --upgradeable | cut -d " " -f 1 | sed 's/\/[a-z]*$//' | awk '/python3/')

and of course use only one sudo. This is something I do often and so hopefully (most likely) there is a better way and/or could help someone else too.

PS I thought this How to select an incomplete range of packages with apt? and this How to select an incomplete range of packages with apt? questions were close, but is not quite what I was looking for.

I tried to get @Jasen answer to work - apt: Install all php packages whatsoever but it pulls from the pool of apt-cache search and not apt list --upgradeable, but even he doesn't seem to like it (though it is much more graceful than what I use).

1
  • 1
    I'd use aptitude for a task like this. Beyond the point: your list is not "vertical" in either case, because the shell performs word splitting on the result of command substitution if it doesn't happen in double quotes. And your cut | sed | awk triplet can be replaced by a single sed 's|/.*||;/python3/!d' (for example). Commented Oct 13, 2019 at 18:18

1 Answer 1

2

As Ferenc Wágner says suggests, I use aptitude whenever I want to operate on finer-grained selections of packages than “everything which can be upgraded”. I’m assuming you don’t have pre-defined sets of packages for which you’d write match tests in scripts, so that a more interactive approach is appropriate; aptitude’s TUI is well-suited for this kind of work.

By default, it presents packages by “virtual” state (security updates, other upgradable packages, new packages, installed packages, not installed packages, obsolete packages, virtual packages, and tasks; aptitude refers to this as “status”), and inside each status, by section, and finally by archive. Thus today’s set of OpenSSL updates show up as

Screenshot showing OpenSSL updates in <code>aptitude</code>, under “Security Updates”, split by section: <code>doc</code>, <code>libdevel</code>, <code>libs</code>, <code>utils</code>

This doesn’t quite match what you’re after, but aptitude’s display is highly customisable, and packages can be grouped by source package name, or even any pattern you care for; for example, by status, priority, and source package:

Screenshot showing OpenSSL updates in <code>aptitude</code>, under “Security Updates”, splut by priority and source package name

You can switch views at runtime (G), or configure your favourite views in aptitude’s configuration files.

+ will select packages for upgrade, along with any dependent upgrades; aptitude will also highlight anything which is broken. Thus after selecting only libssl1.1 for upgrade:

Screenshot showing <code>libssl1.1</code> selected for upgrade, <code>libssl1.1:i386</code> automatically selected, and <code>libssl-dev</code> broken by the upgrade

At this point I can ask aptitude for help in resolving the breakage, or continue selecting packages for upgrade myself. g will show me everything I’ve asked aptitude to do before actually doing it. I can also view packages’ changelogs, and check all available versions etc., before continuing.

Using aptitude in this way also avoids a significant downside of any approach involving apt install (or apt-get install): it won’t lose the “automatically installed” flag.

1
  • I have used aptitude solely for its --full-resolver but did not know about this 'fine-graining' functionality...
    – nate
    Commented Oct 14, 2019 at 13:25

You must log in to answer this question.

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