Question

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

Posted October 1, 2021 325 views
DebianDebian 10DigitalOcean Droplets

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.

1 comment
  • from the sources.list file, you should add this line to the /etc/cloud/cloud.cfg file in order to avoid overriding it at boot:

    aptpreservesources_list: true

    But I prefer an official answer as I’m facing the same issue

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.

×
Submit an Answer
1 answer

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 ‘aptpreservesources_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!