How to upgrade Debian 9 Stretch to 10 Buster using command terminal

Here are the quick commands to upgrade Debian 9 stretch to Debian 10 buster Linux OS using command terminal on your Debian desktop or server system. 

The Debian distribution team has released the latest final version of Debian operating system i.e Debian 10 “Buster“.

In addition to that, its developers also working on Debian 11 “Bullseye”, in which they hope to introduce more automated QA testing through continuous integration, automated package testing, etc., and according to the release time, Debian 11.0 may be released in 2021.

The code for Debian 12 has also been identified and is named “Bookworm“. Obviously, it will take another few years to see Debian 11; thus if you talk about Debian 12, it is likely that we will see the premiere of this Debian update at the end of 2023 unless there is a change before the release. The Debian code continues to come from the role of the Toy Story movie franchise. Bookworm appears in Toy Story 3. For more in on the project, you can see the official announcement. Furthermore, you might be interested in the tutorial- How to install Debian 10 buster on VirtualBox VM

Command to Upgrade Debian 9 to 10

Step 1: Open the Command terminal on Debian 9 Stretch

Well! you either be using Debian 9 Stretch command line interface on Server or GUI on Desktop, whatever, the process of upgradation will be the same. CLI users can move to the next step while the GUI users of Debian go to the Applications and search for Terminal and as it appears, click to run it. Alternatively, you can also use the keyboard shortcut i.e CTRL+ALT+T.

Step 2: Login on Debian 9 as a root user

For that, you can simply use

su root


emulate standard user to root

sudo -i

Step 3: Update and Upgrade packages on Stretch

Before upgrading Debian stretch to buster, the first thing we need to do is updating and upgrading all existing packages of the system. Thus for that, the command is:

apt update
apt upgrade

You can see what are the packages that will get an upgrade by using the command:

apt list --upgradable

Step 4: Reboot the system

If you are on GUI then simply use the graphics control to restart the system while the command for the same is:

shutdown -r now

Step 5: Change stretch 9 repo to buster repo

Now, first again after restarting the Debian switch to root user and then convert the Debian 9 repository list to Debian 10 buster repo. However, in the list everything will be the same just word stretch will get replaced by the buster.

For that use the below single command:

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

In case you have also third-party repository on your Debian 9 then disable them right now during the process of upgradation. Later we revoke them again.

sed -i 's/^/#/' /etc/apt/sources.list.d/*.list

Step 6: Update system to flush Cache

As above we have changed the repository list of Debian 9 to Debian 10, thus we need to flush the existing cache in order to let system recognize the new one.

apt update

Step 7: Upgrade Debian 9 to Debian 10

Now, again run the upgrade command:

apt upgrade

While Upgrading, it will ask to configure libpam0g:amd64

“There are services installed on your system which needs to be restarted when certain libraries, such as libpam, libc and libssl, are upgraded. Since these restarts may cause interruptions of service for the system, you will normally be promoted on each upgrade for the list of service you wish to restart. You can choose this option to avoid being prompted; instead, all necessary restarts will be done for you automatically so you can avoid being asked questions on each library upgrade”

Select YES option using the TAB button of the keyboard for a smooth upgrade process and then press the Enter button.

Upgrade Debian 9 to Debian 10 packages

The above command will update the system to the latest buster using the added repository. Once the process is done use the below command for the complete upgrade process if something is yet not upgraded.

apt dist-upgrade

Step 8: Remove the leftover or outdated packages

After performing all the above steps, we should clean our Debian 10, so that old packages that are not in need anymore will get removed to make room for other packages.

apt autoremove
apt clean

Step 9: Restart Debian 10 buster

Finally, again restart your latest updated Debian system. You can use the command:

shutdown -r now
halt -r now

Step 10: Check the version of your Debian system

In the command terminal type following command to check the version fo installed Debian system.

cat /etc/os-release

Check the version of your Debian stretch to buster