Similar to what @iestynapmwg said, while upgrading from Ubuntu 20.10 to 21.04 experiencing this slowness on step "searching for obsolete software". Mine took 36 minutes (in my Dell XPS 15 9550 that's not so old).
2021-05-14 08:17:28,617 DEBUG Start checking for obsolete pkgs
2021-05-14 08:41:34,610 DEBUG Finish checking for obsolete pkgs
Main difference is that my main culprit seems always package 'libqt5gui5'
2021-05-14 08:37:08,688 DEBUG 'libparams-validationcompiler-perl' scheduled for remove but not safe to remove, skipping
2021-05-14 08:37:08,776 DEBUG package 'libqt5concurrent5' produces an unwanted removal 'libqt5gui5', skipping
and lsof command returned "hirsute"
sudo lsof /var/lib/dpkg/lock
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1002/gvfs
Output information may be incomplete.
lsof: WARNING: can't stat() fuse.portal file system /run/user/1002/doc
Output information may be incomplete.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
hirsute 15215 root 16uW REG 259,5 0 1966936 /var/lib/dpkg/lock
Similar to what @iestynapmwg said, while upgrading from Ubuntu 20.10 to 21.04 experiencing this slowness on step "searching for obsolete software". Mine took 36 minutes (in my Dell XPS 15 9550 that's not so old).
2021-05-14 08:17:28,617 DEBUG Start checking for obsolete pkgs
2021-05-14 08:41:34,610 DEBUG Finish checking for obsolete pkgs
Main difference is that my main culprit seems always package 'libqt5gui5'
2021-05-14 08:37:08,688 DEBUG 'libparams- validationcompi ler-perl' scheduled for remove but not safe to remove, skipping
2021-05-14 08:37:08,776 DEBUG package 'libqt5concurrent5' produces an unwanted removal 'libqt5gui5', skipping
and lsof command returned "hirsute"
sudo lsof /var/lib/dpkg/lock
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1002/gvfs
Output information may be incomplete.
lsof: WARNING: can't stat() fuse.portal file system /run/user/1002/doc
Output information may be incomplete.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
hirsute 15215 root 16uW REG 259,5 0 1966936 /var/lib/dpkg/lock