How to Upgrade Debian 9 to 10 on Linode

Linode Staff

I just found out that I'm using Debian 9. How can I upgrade this to 10 or 11? I've tried updating but it failed.

3 Replies

Hi there,

The following steps will allow you to upgrade your Debian version. In this example, I will upgrade a Debian 9 (Stretch) Linode to Debian 10 (Buster). This will also work for Debian 11 (Bullseye).

Before doing so, always backup your Linode! See Backing Up Your Data for help with this.

First, let's check what release your system is currently rocking.

cat /etc/*release

Then let's update the current system utilizing the existing repositories.

sudo apt update && sudo apt upgrade

Keep in mind, if you're logged in as root, you don’t need to use sudo.

At this point, you have an up-to-date system on the current Debian release. Now we can upgrade to the newest release!

Use your favorite text editor to modify the /etc/apt/sources.list file.

Since we’re rocking Debian 9, the configuration file uses Stretch. We will change this to Buster. If you’re upgrading to Debian 11, use Bullseye.

This is the before:

deb http://mirrors.linode.com/debian stretch main
deb-src http://mirrors.linode.com/debian stretch main

deb http://mirrors.linode.com/debian-security stretch/updates main
deb-src http://mirrors.linode.com/debian-security stretch/updates main

# stretch-updates, previously known as 'volatile'
deb http://mirrors.linode.com/debian stretch-updates main
deb-src http://mirrors.linode.com/debian stretch-updates main

This is the after:

deb http://mirrors.linode.com/debian buster main
deb-src http://mirrors.linode.com/debian buster main

deb http://mirrors.linode.com/debian-security buster/updates main
deb-src http://mirrors.linode.com/debian-security buster/updates main

# buster-updates, previously known as 'volatile'
deb http://mirrors.linode.com/debian buster-updates main
deb-src http://mirrors.linode.com/debian buster-updates main

Save, or write out, the updated file and return to the command line.

Now run sudo apt update to update the repositories.

Once completed, run a minimal system upgrade sudo apt upgrade. Depending on your system, this step may take a while.

Hit yes or keep the local version currently installed to the package configuration, fullscreen prompts. When prompted to review changes, scroll down and hit q.

Once the minimal basic upgrade completes, now run sudo apt full-upgrade to run a full system upgrade.

Upon completion, reboot the system.

sudo init 6

This reboot may take a few minutes.

Once the system has rebooted, verify the upgrade by cat-ing the release file.

cat /etc/*release

The output should display Buster or Bullseye and the associated version.

root@lixxxx-xxx:~# cat /etc/*release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Congratulations! You have successfully upgraded your Debian system to a newer distribution.

For Debian 11 (Bullseye), there are some changes that may be relevant for those upgrading from Debian 10 (Buster). Before upgrading, sysadmins may want to review this page from the Debian site:

https://www.debian.org/releases/stable/amd64/release-notes/ch-information.en.html

Specifically, note section 5.1.3 that documents a change to the security archive layout. I successfully upgraded a Linode from Buster to Bullseye with the following lines for the security mirror:

deb http://mirrors.linode.com/debian-security bullseye-security main contrib
deb-src http://mirrors.linode.com/debian-security bullseye-security main contrib

This may need to be adjusted for your system, especially if you need more or fewer package types (e.g., "main", "contrib", "non-free", etc.). The example above is no substitute for RTFM. :)

Better link for syscrusher's message now that Bullseye is no longer stable is https://www.debian.org/releases/bullseye/amd64/release-notes/ch-information.en.html#security-archive

Also, to reboot when on buster, use systemctl reboot instead of init 6.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct