Upgrade Debian 9 Stretch to Debian 10 Buster From Command Line
Debian 10, codenamed Buster, was released on July 6, 2019. This tutorial is going to you how to upgrade Debian 9 to Debian 10 from command line. You can follow this tutorial on a Debian 9 desktop, or Debian 9 server. As with every Debian release, Debian 10 will be supported for 5 years. The codename “Buster” is named after Andy’s dog in the Toy Story movie.
Recommendation
If you installed the proprietary Nvidia driver on Debian 9 desktop, I recommend removing it before the upgrade because the Nvidia driver caused package conflict when I attempted to upgrade Debian stretch to buster.
sudo apt remove *nvidia*
Upgrade Debian 9 Stretch to Debian 10 Buster Using Command Line
You can use command line to upgrade Debian desktop or a headless server. If you use SSH to log into your Debian server, it’s a good idea to keep your OpenSSH session alive by adding the following line in /etc/ssh/sshd_config
file on your server.
ClientAliveInterval 60
Save and close the file. Then restart SSH daemon.
sudo systemctl restart ssh
To upgrade to Debian 10, switch to root user with the following command. You will need to enter the root user’s password.
su -
Then update existing software using the following two commands.
apt update apt upgrade
If a new kernel is installed when running the above command, then you need to reboot the system to in order to continue the upgrade process. To reboot Debian, run the following command. (Remember to switch to root user again after the reboot.)
shutdown -r now
Next, we need to edit the sources.list
file with a command line text editor such as Nano.
nano /etc/apt/sources.list
Change all instances of stretch
to buster
. If you don’t like changing it one by one, then you can exit out of Nano text editor (Press Ctrl+X
) and run the following command for batch replacement.
sed -i 's/stretch/buster/g' /etc/apt/sources.list
Then we need to disable third-party repositories with the following command, which will add a #
character at the beginning of line for every .list file in /etc/apt/sources.list.d/
directory.
sed -i 's/^/#/' /etc/apt/sources.list.d/*.list
Next, update software sources and upgrade software to the latest version available in the buster repository. This step is called minimal upgrade.
apt update apt upgrade
If you see the following error,
The following packages have unmet dependencies: inetutils-ping : Conflicts: ping
Then you can uninstall inetutils-ping
.
apt remove inetutils-ping
And run apt upgrade
command again. If the apt-listchanges shows up during the upgrade, you can press the Q
key to return to the main screen.
When upgrading packages, you will be asked if you want to restart services without asking. If you want to manually restart services, choose No. This tutorial choose Yes, because my Debian box doesn’t have a service that needs to be accessed by the public.
You will also likely to be asked if you want to install new version of configuration files. I always choose No (Just press Enter) to be on the safe side. (The new configuration file will be saved with the same file name but with the .ucf-dist
or .dpkg-dist
extension, which you can examine after the upgrade.)
Once minimal upgrade is finished, run the following command to begin full upgrade.
apt dist-upgrade
Now you can remove obsolete/unneeded software packages from your Debian system.
apt autoremove apt clean
Finally, reboot the system.
shutdown -r now
Check your Debian version.
lsb_release -a
You should see the following text.
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 10 (buster) Release: 10 Codename: buster
Congrates! You have successfully upgraded to Debian 10 Buster.
Next Step
I hope this tutorial helped you upgrade Debian 9 to Debian 10. You can also attend a Debian release party to celebrate it! As always, if you found this post useful, then subscribe to our free newsletter to get more tips and tricks. Take care 🙂
Outstanding synopsis! Thank you and have a great week.
Do *NOT* disable all third-party repositories before upgrading! This will result in problems with packages of the same name but different origins. Removing the repos makes it impossible to replace the old ones from the repo with new ones from the debian repos. I just ran into this with some gstreamer packages from debian multimedia.
Disable them after you are done, and re-run “apt update”, if that’s what you want to do.
Interesting…
In previos updates i simply perfomed
sudu apt-get update
sudo apt-get -y dist-upgrade
it seems to have worked, but now I am not so sure.
Since I thought that “sed -i ‘s/stretch/buster/g’ /etc/apt/sources.list” would be resolved by the dist-upgrade.
If you use the stable branch in your sources.list file like below.
Instead of
Then running
will automatically upgrade your Debian system if a new version is released.
Hi. Followed the upgrade instructions exactly and got no errors. However, after rebooting, I can’t get the GUI Desktop to run. I have tried all the boot options in the raspi-config and also changed the resolution several times but I still get a console on my HDMI desktop. Naturally, VNC doesn’t work as there’s no GUI to display. I have researched the problem on the Raspberry Pi forum but haven’t found an answer. Hope you can help. Thanks.
Exactly the same problem when I followed a similar other guide. Unfortunately still able to load to CLI.
This post is written for Debian desktop and server. Please follow official Raspbian upgrade instructions if you use Raspberry Pi.
Excellent suggestion. When I used the process on the Raspberry Pi blog, it worked. Thanks.