2

Upgrading Debian 9 to Debian 10

 2 years ago
source link: https://www.vultr.com/docs/upgrading-debian-9-to-debian-10
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
<?xml encoding="utf-8" ??>

Introduction

Debian 10 (Buster), is the successor to Debian 9 (Stretch). It was released on July 6, 2019. In this tutorial, we will be upgrading an existing Debian 9 installation to Debian 10.

Prerequisites

  • Root access to an existing server running Debian 9.
  • Basic knowledge of the Linux command line.

All commands in this tutorial should be run as root. If you are using a standard user, (your prompt doesn't end with #), you will need to prepend sudo to all commands. Alternatively, you can type sudo -i to switch to the root user.

Step 1: Preparation

Before upgrading, you should backup your server. Although Debian releases are generally stable, there is always a risk of something going wrong or an unexpected incompatibility. One option is to use Vultr backups or snapshots. Alternatively, you can use tools like borg or tar if you wish to store backups yourself.

Another important step is to check for broken packages. This can be done with dpkg --audit. If it fails, you can try to correct the issue with apt -f install or dpkg --configure -a. In the case of broken dependencies which cannot be resolved, aptitude -f install may be able to fix it (aptitude uses a more comprehensive dependency resolution method).

You will want to make sure you are aware of any changes made to packages, including configuration files, as you may need to reapply them later. Modified files belonging to packages can be found with dpkg --verify.

In addition, make sure you have a kernel metapackage like linux-image-amd64 installed. If you only have a package like linux-image-4.9.0-9-amd64 installed, your kernel may not be updated properly. You can ensure it is installed by running apt install linux-image-amd64.

If you use any third-party software, especially applications from third-party repositories, you need to ensure they are compatible with Debian 10 before upgrading.

Finally, if you have an unreliable network connection, you should perform the upgrade inside a screen or tmux session so the upgrade process can continue even if you lose connection.

Step 2: Updating all current packages

To minimize possible issues, all installed packages should be at the latest version prior to the release upgrade.

apt update
apt upgrade
apt autoremove --purge
reboot

If you notice any errors during the process, correct them before proceeding.

Step 3: Modifying package lists

Next, all package lists need to be updated from Stretch to Buster. You can do this manually with the following.

nano /etc/apt/sources.list /etc/apt/sources.list.d/*

Alternatively, you can do this automatically with sed.

sed -i "s:stretch:buster:g" /etc/apt/sources.list /etc/apt/sources.list.d/*

Step 4: Upgrading to Debian 10

Now, it is time to upgrade to Debian 10. First, update your package lists:

apt update

Next, upgrade the packages:

apt upgrade
apt dist-upgrade

During the upgrade, you may be asked if you would like to restart services. You can safely say no to this, as you will be rebooting later.

You may also be told there is a conflict between configuration files. If you are certain there are no breaking changes between versions, you can choose to keep the local version currently installed. If you are uncertain, you should show the differences between versions.

Finally, reboot into Debian 10.

reboot

Step 5: Cleanup

Ensure your server has been upgraded by running lsb_release -a. The output should look like the following.

No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

You can remove any leftover dependencies with apt autoremove --purge.

Troubleshooting

If you have dependency problems which apt cannot resolve, using aptitude may help.

In the case that your system will not boot after the upgrade, you can use single-user mode to debug it. If this doesn't work, you can attach a live ISO to your virtual machine and chroot into your system to debug it.

Useful Resources

Want to contribute?

You could earn up to $600 by adding new articles


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK