How to upgrade from Debian 9 (Stretch) to Debian 10 (Buster)

Debian 10 is finally here. Time to upgrade all the things!!!

The upgrade from Debian 9, code named Stretch to Debian 10, code named Buster is
a fairly painless process.

First, it’s good practice to make sure you’re completely up to date on your
current version by running:

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade

At this point, you should be completely up to date with everything you need to
be able to move from Debian 9 to 10. Also, depending on how far behind you are,
it may be worth rebooting your machine.

Once you’re ready to commit to the upgrade, which I do recommend you not going
into blindly, and actually having another machine for staging that you can
upgrade first, you will need to update your target code name in your sources
list.

The quickest way to do so is to simply run:

sed -i 's/stretch/buster/g' /etc/apt/sources.list

This obviously is assuming you are currently on Stretch, and not another version
of Debian, or even worse, trying to upgrade Ubuntu to Debian (which can be a
shit show, but I have read it is possible with enough hackery).

If you’re looking for a more manual route, open up /etc/apt/sources.list and
do a find and replace for instances of stretch and convert them to buster.

Now that things are all set, you can update to point to the latest repository
and package list:

sudo apt update

Once things are all up to date, you can run:

sudo apt upgrade

Which will present you with a ton of packages that now need to be upgraded,
awaiting confirmation to do so.

Upon confirming that you’d like to proceed with the upgrade, your system will
download a bunch of stuff and then serve up a change log from the packages about
to be upgraded.

It’s best to review these updates, and if you’re satisfied with things, you can
press q to exist and proceed with the installation.

Next, you will be presented with a warning / confirmation with how you’d like to
proceed with service upgrades.

Since they could impact service. You can upgrade them as they are updated (which
may cause issues) or not restart them, so you can restart them when it’s more
convenient for you.

I went ahead and opted to restart them during the upgrade, since it’s the
weekend and my active usage tends to be lower.

And now the fun begins. The system will go through the upgrade process,
upgrading your packages from those of the Debian 9 repository to those of the
Debian 10 repository.

Depending on how many packages you have installed, the process will take at the
very least, a few minutes.

Like most upgrades, I recommend that you test stuff out, and then reboot the
machine to make sure it’s coming back online as per usual.

If you’d like, you can still run sudo apt dist-upgrade but it seems to be an
unnecessary step, at least for me and my systems.

So there you have it, you can are now running the latest and greatest that the
Debian Project has to offer!

Josh Sherman - The Man, The Myth, The Avatar

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.


If you found this article helpful, please consider buying me a coffee.