Stripping down Ubuntu 24.04 before upgrading it to Debian
I have got a bit lost with development of my Noble->Trixie upgrade script due to enromous package number installed with GNOME3 and KDE setups.
The simplest setup to upgrade was Ubuntu Server whose initial state does not contain GUI stuff at all.
So I decided to find a way to efficiently and significantly reduce package count on Ubuntu system, while still keeping it operating and accessible by network.
First, I debootstrapped a Noble environment in a subfolder and chrooted into it.
Then I added some useful packages and their dependencies: linux-image-generic , shim-signed , network-manager , openssh-server , screen , less and some others.
Then I listed installed packages and saved the list (stripping architecture suffix from libraries):
dpkg -l | grep '^ii ' | awk '{print $2}' | awk -F: '{print $1}' > /tmp/pkglist
Then I copied the list to my experimental Ubuntu VM, and by running apt remove --dry-run , found a package whose removal will remove the most of packages which depended on it directly or indirectly
The search looked like this:
Their removal, followed by apt autoremove , removed >1000 Ubuntu packages (to be later reinstalled with Debian versions).
Then I repeated the search for next "champions", having found, in descending usefulness, libgdbm6t64 , libavahi-common-data , libasound2-data , libsharpyuv0 , libdw1t64 , tpm-udev , libdconf1 , libjson-glib-1.0-common , libpcre2-16-0 , emacsen-common , libcrack2 , libdrm-common , libllvm18 , libstemmer0d , pkexec , python3-blinker , python3-distro-info , at-spi2-common , liblmdb0 , liblzo2-2 , libtraceevent1 , x11-common , xz-utils , dmidecode , libaccountsservice0 , libip4tc2 , libmagic-mgc , libfcitx5* , libproxy1v5 , pci.ids .
The rest is probably not worth attention, as they remove only 1 depending package with each of themselves:
fuse3 , inetutils-telnet , install-info , libchewing3-data , libgnome-menu-3-0 , libmarisa0 , libncurses6 , libnuma1 , libpinyin-data , libunwind8 , libwhoopsie0 , linux-sound-base , tnftp , ubuntu-wallpapers-noble
The simplest setup to upgrade was Ubuntu Server whose initial state does not contain GUI stuff at all.
So I decided to find a way to efficiently and significantly reduce package count on Ubuntu system, while still keeping it operating and accessible by network.
First, I debootstrapped a Noble environment in a subfolder and chrooted into it.
Then I added some useful packages and their dependencies: linux-image-generic , shim-signed , network-manager , openssh-server , screen , less and some others.
Then I listed installed packages and saved the list (stripping architecture suffix from libraries):
dpkg -l | grep '^ii ' | awk '{print $2}' | awk -F: '{print $1}' > /tmp/pkglist
Then I copied the list to my experimental Ubuntu VM, and by running apt remove --dry-run , found a package whose removal will remove the most of packages which depended on it directly or indirectly
The search looked like this:
minr=1 for i in $(comm -23 <(dpkg -l | grep '^ii ' | awk '{print $2}' | awk -F: '{print $1}' | sort -u) <(sort -u /tmp/pkglist) ) do newr=$(sudo eatmydata apt remove --dry-run $i 2>/dev/null | grep -cw Remv ) [ $newr -lt $minr ] && continue [ $newr -gt $minr ] && minr=$newr echo '!!!!' $i $minr doneInitially it took quite a time, and the "champion" packages were found to be libxrender1 on GNOME3 and libfontconfig1 on KDE.
Their removal, followed by apt autoremove , removed >1000 Ubuntu packages (to be later reinstalled with Debian versions).
Then I repeated the search for next "champions", having found, in descending usefulness, libgdbm6t64 , libavahi-common-data , libasound2-data , libsharpyuv0 , libdw1t64 , tpm-udev , libdconf1 , libjson-glib-1.0-common , libpcre2-16-0 , emacsen-common , libcrack2 , libdrm-common , libllvm18 , libstemmer0d , pkexec , python3-blinker , python3-distro-info , at-spi2-common , liblmdb0 , liblzo2-2 , libtraceevent1 , x11-common , xz-utils , dmidecode , libaccountsservice0 , libip4tc2 , libmagic-mgc , libfcitx5* , libproxy1v5 , pci.ids .
The rest is probably not worth attention, as they remove only 1 depending package with each of themselves:
fuse3 , inetutils-telnet , install-info , libchewing3-data , libgnome-menu-3-0 , libmarisa0 , libncurses6 , libnuma1 , libpinyin-data , libunwind8 , libwhoopsie0 , linux-sound-base , tnftp , ubuntu-wallpapers-noble