Ubuntu – Is it possible to convert the system installed from ubuntu-20.10-live-server-amd64.iso to the mini.iso-like system

20.10serversubiquitysystem-installationubuntu-minimal

I have just installed "minimal" system from the ubuntu-20.10-live-server-amd64.iso ISO.
I'm doing this way because there is no mini.iso for 20.10.

I see that this system is very big (4.6 Gb!), has 577 deb-packages, contains Snaps (/snap is 506 Mb), cloud-init package and other unneeded (for me) stuff.

Is it possible to transform such system to the mini.iso-like set of packages?

Best Answer

It is possible by careful comparison of the installed package lists and file-systems.

To have a reference we need to install the 20.04 LTS from its mini.iso and then upgrade it to the 20.10.
It does not have snapd, uses 3.8 Gb and has 372 deb-packages.

Warning: do not proceed if you are unsure or if you have installed or configured many stuff to the system.

At first we need to remove Snap:

sudo apt autopurge snapd

Then remove extra packages:

sudo apt autopurge alsa-topology-conf alsa-ucm-conf apport apport-symptoms at bc bcache-tools bolt btrfs-progs byobu cloud-guest-utils cloud-init cloud-initramfs-copymods cloud-initramfs-dyn-netconf cryptsetup cryptsetup-bin cryptsetup-initramfs cryptsetup-run curl dbus-user-session dconf-gsettings-backend:amd64 dconf-service dirmngr dmeventd eatmydata ethtool finalrd fonts-ubuntu-console fwupd fwupd-signed gawk gdisk gir1.2-packagekitglib-1.0 git git-man glib-networking:amd64 glib-networking-common glib-networking-services gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm gsettings-desktop-schemas htop kpartx landscape-common libaio1:amd64 libappstream4:amd64 libarchive13:amd64 libasn1-8-heimdal:amd64 libasound2:amd64 libasound2-data libassuan0:amd64 libcanberra0:amd64 libcurl3-gnutls:amd64 libcurl4:amd64 libdbus-glib-1-2:amd64 libdconf1:amd64 libdevmapper-event1.02.1:amd64 libdw1:amd64 libeatmydata1:amd64 liberror-perl libevdev2:amd64 libevent-2.1-7:amd64 libfl2:amd64 libfwupd2:amd64 libfwupdplugin1:amd64 libgcab-1.0-0:amd64 libgdbm-compat4:amd64 libglib2.0-bin libgpgme11:amd64 libgpm2:amd64 libgssapi3-heimdal:amd64 libgstreamer1.0-0:amd64 libgudev-1.0-0:amd64 libgusb2:amd64 libhcrypto4-heimdal:amd64 libheimbase1-heimdal:amd64 libheimntlm0-heimdal:amd64 libhx509-5-heimdal:amd64 libimobiledevice6:amd64 libisns0:amd64 libjcat1:amd64 libjson-glib-1.0-0:amd64 libjson-glib-1.0-common libkrb5-26-heimdal:amd64 libksba8:amd64 libldap-2.4-2:amd64 libldap-common libltdl7:amd64 liblvm2cmd2.03:amd64 liblzo2-2:amd64 libmspack0:amd64 libnghttp2-14:amd64 libnpth0:amd64 libogg0:amd64 libopeniscsiusr0.2.0 libpackagekit-glib2-18:amd64 libperl5.30:amd64 libplist3:amd64 libpolkit-agent-1-0:amd64 libproxy1v5:amd64 libpython3.8:amd64 libreadline5:amd64 libroken18-heimdal:amd64 librtmp1:amd64 libsasl2-2:amd64 libsasl2-modules:amd64 libsasl2-modules-db:amd64 libsgutils2-2 libsigsegv2:amd64 libsmbios-c2 libsoup2.4-1:amd64 libssh-4:amd64 libstemmer0d:amd64 libtdb1:amd64 libtss2-esys0 libupower-glib3:amd64 liburcu6:amd64 libusbmuxd6:amd64 libutempter0:amd64 libvorbis0a:amd64 libvorbisfile3:amd64 libwind0-heimdal:amd64 libxmlb1:amd64 libxmlsec1:amd64 libxmlsec1-openssl:amd64 libxslt1.1:amd64 lvm2 lxd-agent-loader mdadm motd-news-config multipath-tools net-tools open-iscsi open-vm-tools overlayroot packagekit packagekit-tools pastebinit patch perl perl-modules-5.30 pinentry-curses policykit-1 pollinate python3-apport python3-attr python3-automat python3-blinker python3-click python3-colorama python3-configobj python3-constantly python3-cryptography python3-debconf python3-debian python3-distutils python3-hamcrest python3-httplib2 python3-hyperlink python3-importlib-metadata python3-incremental python3-jeepney python3-jinja2 python3-json-pointer python3-jsonpatch python3-jsonschema python3-jwt python3-keyring python3-launchpadlib python3-lazr.restfulclient python3-lazr.uri python3-lib2to3 python3-markupsafe python3-more-itertools python3-newt:amd64 python3-oauthlib python3-openssl python3-pexpect python3-problem-report python3-ptyprocess python3-pyasn1 python3-pyasn1-modules python3-pyrsistent:amd64 python3-requests-unixsocket python3-secretstorage python3-serial python3-service-identity python3-setuptools python3-simplejson python3-software-properties python3-systemd python3-twisted python3-twisted-bin:amd64 python3-wadllib python3-zipp python3-zope.interface run-one sbsigntool screen secureboot-db sg3-utils sg3-utils-udev software-properties-common sosreport sound-theme-freedesktop thermald thin-provisioning-tools tmux tpm-udev ubuntu-server unattended-upgrades update-notifier-common upower usbmuxd vim vim-runtime xfsprogs zerofree

Then install packages which are exist in system installed from mini.iso with

sudo apt update
sudo apt install bsdmainutils calendar cpp cpp-10 dictionaries-common emacsen-common fdisk installation-report krb5-locales language-pack-en language-pack-en-base language-pack-gnome-en language-pack-gnome-en-base laptop-detect libfdisk1:amd64 libisl22:amd64 libmpc3:amd64 libmpdec2:amd64 libmpfr6:amd64 libsodium23:amd64 ncal popularity-contest python3-cffi-backend python3-nacl python3-pymacaroons tasksel tasksel-data wamerican wbritish

Finally adjust the configuration files by removing leftovers of Subiquity-installed system:

sudo rm /etc/apt/apt.conf.d/90curtin-aptproxy
sudo rm /etc/apt/sources.list.curtin.old
sudo rm -rf /etc/cloud
sudo rm -rf /etc/multipath
sudo rm -rf /etc/network
sudo rm -rf /etc/pollinate
sudo rm -rf /etc/systemd/system/network-online.target.wants
sudo rm -rf /etc/systemd/system/snapd.service.d/
sudo rm /etc/crypttab

sudo mv /etc/netplan/00-installer-config.yaml /etc/netplan/01-netcfg.yaml

and by adding configuration files from mini.iso install:

cat <<EOF | sudo tee /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s3:
      dhcp4: yes
EOF

cat <<EOF | sudo tee /etc/apt/apt.conf.d/00aptitude
Aptitude::Get-Root-Command "sudo:/usr/bin/sudo";
EOF

cat <<EOF | sudo tee /etc/apt/apt.conf.d/00trustcdrom
APT::Authentication::TrustCDROM "true";
EOF

cat <<EOF | sudo tee /etc/kernel-img.conf
# Kernel image management overrides
# See kernel-img.conf(5) for details
do_symlinks = yes
do_bootloader = no
do_initrd = yes
link_in_boot = yes
EOF

Then reboot and enjoy.


As you can see the above process is a bit difficult and not user-friendly.
So I want to draw attention to this problem and invite you to participate in poll at Ubuntu Discourse.

Related Question