Crossgrading Ubuntu 18.04 to Debian 10

After upgrading all Ubuntu 18.04 packages to their latest releases, I adapted eudoxos‘ recipe:

  1. Rebooted and selected the stock 18.04 kernel instead of HWE, which I was using
  2. Downloaded debian-keyring and debian-archive-keyring .debs and installed them with dpkg -i debian*.deb
  3. Created /etc/apt/preferences.d/10-no-ubuntu to pin down Ubuntu packages:
    Package: *
    Pin: release o=Ubuntu
    Pin-Priority: -1000
  4. Added Debian sources for buster to the end of /etc/apt/sources.list:
    deb http://deb.debian.org/debian buster main contrib non-free
    deb http://deb.debian.org/debian-security/ buster/updates main contrib non-free
    deb http://deb.debian.org/debian buster-updates main contrib non-free
  5. apt update && apt-get dist-upgrade
  6. Answered “no” to all configuration changes questions (I’ll update them later)
  7. Post-install, networking was non-functional. Apparently this was caused by Apparmor, so I disabled it (systemctl disable apparmor.service) and rebooted.
  8. Deleted /etc/apt/preferences.d/10-no-ubuntu
  9. Then it was time for manual package surgery. Lots and lots of it. Searching for remaining Ubuntu packages is easy enough, with
    dpkg -l | grep ubuntu

    and

    aptitude search '?narrow(?installed, ?not(?origin(Debian)))'

    Many of the matching packages can be removed/downgraded to their Debian versions without issue, but a bunch of gcc and python packages turned out to be tricky, and had to be downgraded all together. I did make notes, but following them blindly would most likely just do more harm than good, so I won’t post them here; you’ll need to hack’n’slash your own way anyway.