A safer alternative would be to save the output of dpkg --get-selections
, reinstall the machine with Ubuntu, and then use dpkg --set-selections
to install the same set of packages on Ubuntu.
It's possible to get apt to do what you want. But first a warning: this type of change can easily leave you with a system that won't boot or is broken in other subtle or not-so-subtle ways. You should be fully prepared to either fix difficult problems or do a reinstall and restore data from backups.
You need to create an apt pin for Ubuntu packages with a priority at least 1000. This allows apt to install the Ubuntu version even if it means downgrading. Create /etc/apt/preferences.d/ubuntu
with this content:
Package: *
Pin: release o=Ubuntu
Pin-Priority: 1001
You should update /etc/apt/sources.list
, install the ubuntu-keyring
package manually, and run apt update
. (Sounds like you've already done these steps.) Then you can try an apt full-upgrade
to move all packages to the Ubuntu versions.
Remove /etc/apt/preferences.d/ubuntu
when you're done.
Note that Debian and Ubuntu use different naming for the Linux kernel meta-package, so you'll need to manually uninstall the Debian one (e.g., linux-image-amd64
), install the Ubuntu one (e.g., linux-image-generic
), and maybe manually remove the Debian linux-image-*-amd64
packages.