apt - find orphaned packages

Ok, I did what you newer should do: a dist upgrade from ubuntu to debian :-)

I wrote a short script (amazing simple and amazing effective), that helped me a lot:

https://gist.github.com/zerwes/9df84303ae6b3a5faaf5fc4275e955d2

#! /usr/bin/env python3
# apt install python3-apt
import apt
cache = apt.Cache()
for pkg in cache:
    if cache[pkg.name].is_installed:
        continue
    if cache[pkg.name].candidate:
        continue
    print(pkg.name)

This will list you all packages installed that have no valid source anymore. Purge them in order to have a clean distupgraded system :-)


linux
debian
apt