I am thinking of switching to Debian from Ubuntu, for various reasons, moving towards a more free software supporting system being one of them. (GNU.org mentions that we can choose to keep Debian completely free if we want, by not including the nonfree repositories.)

Apart from the installation (which I should be able to manage since I've grown pretty comfortable with reading manuals and using the terminal), I have one major concern: my internet connection is weak, in terms of both bandwidth and usage limit. Thus, it would be inconvenient if I had to identify all the packages that I'm currently used to using and have set up on Ubuntu (such as Python3, python-pip packages, GNU Octave and its data, and basically every other package I've installed off the internet using apt), and download and install them all over again.

What I mean to ask is, is there any neat way of doing this? Is it possible, first of all, to take my packages from one system to another, with data? I'm specifically asking because Ubuntu is Debian-based.

If it is not possible, I am willing to download the packages (sure, it would take a long time, but I would have to do it). But in that case, once I have the packages set up on Debian, can I move just the data across the two systems? Even that would be really convenient.

2 Answers 2


Late to the party, but this is something definitely doable.

Pick Debian stable or testing release close to the Ubuntu release you are upgrading from. Add debian and debian-security (and perhaps debian-backports repositories to /etc/apt/sources.list with main contrib non-free components, like this:

deb http://deb.debian.org/debian bullseye main contrib non-free
deb http://deb.debian.org/debian-security/ bullseye-security main contrib non-free
deb http://deb.debian.org/debian bullseye-updates main contrib non-free

keeping the other (ubuntu) sources there for now. Create /etc/apt/preferences.d/10-no-ubuntu with the following:

Package: *
Pin: release o=Ubuntu
Pin-Priority: -1000

Manually install debian keyrings from packages.debian.org (search debian-keyring and debian-archive-keyring packages, get the download link, wget it and do dpkg -i debian-*.deb on the machine.

Time to run apt-get update.

And then apt-get dist-upgrade, ubuntu packages with higher versions (if any) should get downgraded as necessary.

Remove ubuntu repos from /etc/apt/souces.list, remove /etc/apt/preferences.d/10-no-ubuntu. Check that you have linux-image-amd64 (or somesuch) installed as ubuntu calls its kernel packages somewhat differently. run apt-get autoremove a few times.

I did roughly this for Ubuntu 22.04 focalDebian bullseye and most things went okay (including IMAP/SMTP server, apache2 with a few glitches (different php version), nextcloud (redis version change — small trouble)).

Good luck.

  • 3
    Thanks a lot for this (late) guideline, it works for me perfect from Ubuntu 16.04 to Debian 10 Buster
    – Achim
    Oct 16, 2022 at 10:34
  • I can confirm that this is a doable. I moved from Ubuntu bionic to Debian buster. I will now upgrade further. In preparation this table was very useful: askubuntu.com/a/445496/538491
    – ñull
    Feb 7 at 18:17
  • 1
    Instruction / suggestion is not complete. A whole list of old ubuntu packages remain installed coexisting with new debian packages. I am looking for a way to distinguish and remove them.
    – ñull
    Feb 15 at 11:50
  • 2
    Hint: After removing the ubuntu sources, aptitude search ~o (for orphaned) show them. Apr 7 at 15:32

Unfortunately you can't directly migrate, Ubuntu packages, while based on Debian, are completely recompiled sometimes with different point releases. Ubuntu also does not QUITE share the exact same disk layout as Debian, so you frequently can't just move over configuration files either.

I would suggest a clean Debian install and copy over your data.

  • I tried @eudoxos proposal but I agree that a clean install is the best solution. It is not good to leave any skeletons in the closet and in the end a clean start will be less work.
    – ñull
    Feb 17 at 14:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .