I need to get a list of manually installed packages from backports, in order to "complete" the apt-get upgrade && apt-get dist-upgrade sequence. Following command lists the packages that are manually installed from backports:

$ # based on: https://serverfault.com/a/109680/261445
$ aptitude search "?narrow(~i, ~Abackports) ?not(?automatic)" | sed 's/ - .*//'
i  btrfs-progs
i  checkinstall
i  linux-headers-5.9.0-0.bpo.2-amd64
i  linux-image-5.9.0-0.bpo.2-amd64
i  spl-dkms
i  zfs-dkms
i  zfsutils-linux

However, I never gave a command like:

apt-get install -t buster-backports linux-image-5.9.0-0.bpo.2-amd64

so the output is not accurate. I installed the kernel by apt-get install -t buster-backports linux-image-amd64 command so I expect to get linux-image-amd64 and not linux-image-5.9.0-0.bpo.2-amd64.

How can I get the list of what I really manually installed?

1 Answer 1


The aptitude command is accurate: it lists all packages currently installed, from backports, and not marked as automatically installed.

The fact that this doesn’t output what you expect it to is another issue, and one we can’t solve for you. Something caused your linux-image-amd64 meta-package to be reverted to the Debian 10 version. Presumably in a related event, no doubt helped by the protection given to the currently-active kernel and to meta-packages, the actual kernel image and headers packages from backports lost their “automatic” marker.

The packaging system only knows what its current state is, not how it got there.

To solve your underlying problem, you should run

sudo apt -t buster-backports install linux-{image,headers}-amd64

which will upgrade the meta-packages to their backported versions and install the corresponding real packages.

After that, apt upgrade will upgrade any out-dated backport versions without requiring you to manually figure out what packages came from backports.

If you mark the old kernel packages as automatically installed, your system will be in the state you want it to be in and the aptitude command will give the output you expect:

sudo apt-mark auto linux-{headers,image}-5.9.0-0.bpo.2-amd64

If you really want to figure out what happened, the logs in /var/log/apt should tell you, but apt and co. can’t use that information themselves.

  • I'm a little bit confused: Will the original aptitude commad give the "correct" output if I re-install image/header with apt -t buster-backports linux-image-amd64 command? Or you are suggesting that I should resolve this particular issue manually every time?
    – ceremcem
    Jan 26, 2021 at 12:15
  • If you adjust the system state so that it matches what you expect it to be, then yes, the original aptitude command will give the output you expect. Its output is always correct; it’s just that the state it reflects isn’t what you think it should be. See the update. Jan 26, 2021 at 12:32
  • Note that even after marking the packages as auto, linux-image-amd64 didn't show up within the above list. I needed to "install" it (again?) manually (I'm sure I did before, I don't know how those conflicts occurred)
    – ceremcem
    Jan 26, 2021 at 20:11
  • 1
    Yes, I said in my answer that you’d have to re-install that package. Jan 26, 2021 at 21:43

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.