Ubuntu Server 26.04 could benefit hugely with what Canonical did to Ubuntu Desktop 26.04 for TPM-backed FDE

TBH, I don’t really know. My intuition tells me that you’d have to dd the image to some top-level block device, i.e. /dev/sda, instead of a partition (sda1) and just fire up GParted (or GNOME Disks) and grow the partitions. But I don’t now know how much magic is already built into Ubuntu Core images; perhaps that’s something they do on first boot anyway they grow the partitions auto-magically on first boot — similar to the automatic TPM/FDE stuff?.

I think the additional resources are just what the desktop environment would use, if it were running. When I said to disable GDM3 I simply did not think of setting the default systemd target:

systemctl set-default multi-user.target

multi-user.target is everything but the graphical desktop stuff. That’s how one can switch to headless server mode in an easily accessible and well-defined way.
Some services, however, might have install directives pointing to default.target:

# /usr/lib/systemd/system/some.service
# [...]
[Install]
WantedBy=default.target

If such are installed (systemctl enable ..., e.g. by package install scripts) they will run even in multi-user.target, since it will be aliased to default.targetpipewire and friends, which are somewhat useless on a server, come to mind. So you may need to disable a few additional services (find them by running systemctl list-dependencies default.target), but, in general, I don’t see that one cannot make a desktop system into a trimmed down server. And if you need the desktop stuff (on demand), just run systemctl isolate graphical.target in an SSH session and login via remote desktop or locally, if you have a screen attached.

If you really want to trim the installed packages to the absolute minimum, I cannot recommend aptitude’s TUI highly enough. Start by minimizing the number of packages marked as manually installed: sudo apt-mark minimize-manual. Then I’d find ubuntu-desktop-minimal, mark it for removal (not actually committing the change just yet) and then wade through all its dependencies to manually install the ones I absolutely think necessary for a server with a GUI frontend, akin to Windows Server. Or, if I felt like it, I’d create my own ubuntu-server-gui metapackage, which only depends on the ones I’d have installed manually — here’s a real example of the workflow.

Perhaps also consider replacing NetworkManager with systemd-networkd; the latter being somewhat more befitting a server. Maybe the migration can be taken care of by simply installing ubuntu-server-minimal after marking NetworkManager as automatically installed. Be warned, though, that you could end up without SSH access if something goes wrong. I have never done it myself and don’t know what to look out for.

1 Like