How to upgrade droplet from Debian 10 (buster) to Debian 11 (bullseye)

Hello community, please tell me how to update debian 10 to 11 correctly? The /etc/apt/sources.list file is generated automatically when droplet is initialized, and as I understand it, nothing can be changed directly in it.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

My /etc/apt/sources.list file contains the following lines:

1 ## Note, this file is written by cloud-init on first boot of an instance 2 ## modifications made here will not survive a re-bundle. 3 ## if you wish to make changes you can: 4 ## a.) add ‘apt_preserve_sources_list: true’ to /etc/cloud/cloud.cfg 5 ## or do the same in user-data 6 ## b.) add sources in /etc/apt/sources.list.d 7 ## c.) make changes to template file /etc/cloud/templates/sources.list.debian.tmpl 8 ###

I do not know what is a re-bundle, but changes I have made to /etc/apt/sources.list have survived for years across many tens of reboots and several upgrades starting with Debian 9 (or possibly even 8).

First, get your buster system up-to-date and it may not be a bad idea to do an apt-get autoremove or equivalent, and reboot if necessary. Then…

At the most basic, changing “buster” to “bullseye” in /etc/apt/sources.list and also changing things that look like “debian-security bullseye/updates” to “debian-security bullseye-security” should prepare your apt sources.

Then run apt-get update, apt-get upgrade, and apt-get dist-upgrade or the apt or aptitude equivalents based on the program you like to use. Reboot.

You may also want to purge obsolete items. I have found that “aptitude seach ‘~o’” can list those items (or at least many or most – supposedly, it is hard to know for sure), “aptitude purge ‘~o’” will remove them.

It should go without saying to backup all important data off the droplet before proceeding. If you use do’s droplet backup utility, it may be a good idea to kick one off before starting this.

I have used the above steps with good success over several Debian upgrades across many systems – droplets and linodes, and also on machines in my home and office. Good luck!