After upgrading ubuntu to a new version, there will be many obsolete packages. To see these packages, you can
It will list all those obsolete packages.
To autoremove them one by one will be will tedious, we can first copy those packages into a file, like aa.txt, then use the following perl script to do it once:
1 2 3 4 5 6 7