Table of Contents

Ubuntu 2 Debian

This page tries to convert one Ubuntu installation to Debian GNU/Linux.

Why

Short answer: Why not?
Long answer: I was happily using Oracle Cloud Infrastructure with Debian GNU/Linux self created images until one day Oracle stopped to support that on the free usage tier. They only provide few options like Ubuntu, Oracle and CentOS, the most close option is Ubuntu… but I don´t like because I don´t like.

How

Requirements

Stop talking... how?

Ubuntu 20.04
apt-get update
apt-get upgrade
#deb cdrom:[Debian GNU/Linux 12.2.0 _Bookworm_ - Official amd64 NETINST with firmware 20231007-10:28]/ bookworm main non-free-firmware

deb http://deb.debian.org/debian/ bookworm main non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm main non-free-firmware

deb http://security.debian.org/debian-security bookworm-security main non-free-firmware
deb-src http://security.debian.org/debian-security bookworm-security main non-free-firmware

# bookworm-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_and_backports
deb http://deb.debian.org/debian/ bookworm-updates main non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm-updates main non-free-firmware

# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys '0E98404D386FA1D9'
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys '6ED0E7B82643E131'
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 'F8D2585B8783D481'
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys '54404762BBB6E853'
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 'BDE6D2B9216EC7A8'
cd /etc/apt/trusted.gpg.d/
wget https://ftp-master.debian.org/keys/archive-key-12.asc
wget https://ftp-master.debian.org/keys/archive-key-12-security.asc
apt-get clean
apt-get clean all
apt-get update
apt-get dist-upgrade
Unpacking amd64-microcode (3.20230808.1.1~deb12u1) over (3.20191218.1ubuntu1.2) ...
dpkg: error processing archive /var/cache/apt/archives/amd64-microcode_3.20230808.1.1~deb12u1_amd64.deb (--unpack):
 trying to overwrite '/lib/firmware/amd/amd_sev_fam17h_model0xh.sbin', which is also in package linux-firmware 1.187.39
Errors were encountered while processing:
 /var/cache/apt/archives/amd64-microcode_3.20230808.1.1~deb12u1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
apt-get remove --purge linux-firmware
apt-get dist-upgrade
apt-get autoremove --purge
nameserver 94.140.14.14
nameserver 94.140.15.15

* Install Linux kernel (if you are using Ampere… change to arm64 or something more appropiate):

apt-get install linux-image-amd64
dpkg -l |grep linux-image
dpkg -l |grep linux-headers
apt-get remove --purge linux-headers-5.4.0-144-generic linux-headers-5.4.0-169-generic
-bash: /usr/bin/locale-check: No such file or directory

Delete the following file:

rm /etc/profile.d/01-locale-fix.sh
apt-get remove --purge ubuntu-*
dpkg -l |grep ubuntu
apt-get remove <packages>
apt-get autoremove --purge
rm /etc/lsb-release
cp /usr/share/base-files/motd /etc/motd
cd /etc/update-motd.d
ls
rm 10-help-text 50-motd-news 85-fwupd # remove all if you want
apt-get remove --purge cloud-init*
apt-get remove --purge ca-certificates
apt-get autoremove --purge
apt-get install ca-certificates cloud-init # Use cloud-init if applies
apt-get install lvm2
apt-get install vim
Ubuntu 22.04
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 sg3-utils : Depends: libsgutils2-1.46-2 (>= 1.46) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

You can remove the package and install after the upgrade, take on consideration that will remove multipath support:

apt-get remove --purge sg3-utils sg3-utils-udev  multipath-tools ubuntu-server ubuntu-server-minimal
apt-get dist-upgrade
Unpacking amd64-microcode (3.20230808.1.1~deb12u1) over (3.20191218.1ubuntu1.2) ...
dpkg: error processing archive /var/cache/apt/archives/amd64-microcode_3.20230808.1.1~deb12u1_amd64.deb (--unpack):
 trying to overwrite '/lib/firmware/amd/amd_sev_fam17h_model0xh.sbin', which is also in package linux-firmware 1.187.39
Errors were encountered while processing:
 /var/cache/apt/archives/amd64-microcode_3.20230808.1.1~deb12u1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
apt-get remove --purge amd64-microcode

References