How to fully upgrade Debian from command line (including release_version)?

11,707

Solution 1

The Debian operating system is not bleeding edge. It enjoys great stability when installed, on supported hardware. However, as a result, the software that Debian uses and that is in its repo's are slightly older, than those in say, Ubuntu. Even though Ubuntu is Debian based, it is constantly being updated and things are getting tweaked day to day sometimes. If you successfully complete the commands you listed, everything should be up to date and considered the newest stable version. If you are however looking to go from Debian 8 to 9. The process is more involved.

After doing the above commands:

  • If everything went smoothly, perform database sanity and consistency checks for partially installed, missing and obsolete packages:

    dpkg -C
    
  • If no issues are reported, check what packages are held back:

    apt-mark showhold
    
    Packages On Hold will not be upgraded, which may cause inconsistencies after Stretch upgrade. Before you move to the next part, it is recommended to fix all issues produced by both above commands.
    
  • Make backup of your sources.list:

    cp /etc/apt/sources.list /etc/apt/sources.list_backup
    
  • Change to stretch;

    sed -i 's/jessie/stretch/g' /etc/apt/sources.list
    
  • Update

    apt-get update
    
  • List Upgradeable:

    apt list --upgradable 
        Note that if you see anything that alarms you at this point you can undo everything in reverse.
    

After the following commands there is no undoing:

apt-get upgrade
apt-get dist-upgrade

More information can be found: HERE

Solution 2

For anyone upgrading to Debian 11 "bullseye", mind that there is a change in the security archive layout, so simply replacing the codename in sources.list is not enough. I use WSL on Windows 10 and wsl --install -d Debian gave me Debian 9, so I had to upgrade to 11.

Here is a summary of the steps:

1. Backup everything

2. Update current release

sudo apt update
sudo apt upgrade

3. Edit the sources.list.

Without this step, the upgrade command won't "see" the new release. This is what I had before on "Debian GNU/Linux 9 (stretch)":

$ cat /etc/apt/sources.list
deb http://deb.debian.org/debian stretch main
deb http://deb.debian.org/debian stretch-updates main
deb http://security.debian.org/debian-security/ stretch/updates main

Changed it to:

deb http://deb.debian.org/debian bullseye main
deb http://deb.debian.org/debian bullseye-updates main
deb http://security.debian.org/debian-security/ bullseye-security main

Note that stretch/updates became bullseye-security, not bullseye/updates!

4. Clean and update

sudo apt clean && sudo apt update

5. Perform full upgrade

sudo apt full-upgrade

Confirmed success with:

$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
Share:
11,707

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    I desire to totally upgrade everything in Debian:Stable including the release version, to the newest stable release available:

    • Packages update
    • Packages upgrade
    • D:S minor_version
    • D:S major_version
    • D:S release_version

    Each action will be done respective to others in that entire recursive (monthly/yearly) single process, while I assume that release_version will surly be the last.

    In other words, I'd like to create a "fully rolling release stable Debian".

    I do it when having at least weekly/daily automatic backups (per month) of all the data so if something was broken I restore a backup.

    What will be the command to "brutally" upgrade everything whatsoever including doing a release upgrade? I was thinking about:

    apt-get update -y && apt-get upgrade -y && apt-get dist-upgrade -y
    
  • Admin
    Admin over 5 years
    I thank you and upvoted; I must say I look for a release_version-agnostic way to totally upgrade Debian, that is, without using terms like "Jesse" or "Strech" (or "Buster" in the coming time). Is there a way to make the entire operation release_version agnostic?
  • Admin
    Admin over 5 years
    I edited the question anyway; not any grandiose edit; just clarifying how I imagine the process be done in a release_version-agnostic way.
  • telcoM
    telcoM over 5 years
    Each time you upgrade from one major release to the next, it is important to read the upgrade chapter of the Release Notes of the new release first: it sometimes includes special steps you should take to ensure a seamless upgrade. The "brutal" way mentioned in the edited question is not guaranteed to always work, even though it might usually work.