{"id":17157,"date":"2023-06-12T01:23:34","date_gmt":"2023-06-11T22:23:34","guid":{"rendered":"https:\/\/kifarunix.com\/?p=17157"},"modified":"2024-03-10T10:05:16","modified_gmt":"2024-03-10T07:05:16","slug":"quick-way-to-upgrade-debian-11-to-debian-12","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/quick-way-to-upgrade-debian-11-to-debian-12\/","title":{"rendered":"Quick Way to Upgrade Debian 11 to Debian 12"},"content":{"rendered":"\n<p>Are you looking for a quick way to upgrade Debian 11 to Debian 12? Look no further, this guide will take you through all the steps for upgrading Debian 11 to Debian 12. Debian 12, codenamed &#8220;Bookworm&#8221;, has just been released! Read more about this new release on the <a href=\"https:\/\/www.debian.org\/News\/2023\/20230610\" target=\"_blank\" rel=\"noreferrer noopener\">release news page<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Table of Contents<\/h2><nav><ul><li><a href=\"#upgrading-debian-11-to-debian-12\">Upgrading Debian 11 to Debian 12<\/a><ul><li><a href=\"#backup-your-debian-11-system-data\">Backup your Debian 11 System Data<\/a><\/li><li><a href=\"#login-to-your-system-via-physical-console\">Login to your System via Physical Console<\/a><\/li><li><a href=\"#run-full-system-update\">Run Full System Update<\/a><\/li><li><a href=\"#reboot-the-system\">Reboot the System<\/a><\/li><li><a href=\"#update-system-repositories\">Update System Repositories<\/a><\/li><li><a href=\"#optionally-install-non-free-firmware-repositories\">Optionally Install Non-Free-Firmware Repositories<\/a><\/li><li><a href=\"#remove-bullseye-backports-repositories\">Remove bullseye-backports Repositories<\/a><\/li><li><a href=\"#upgrading-debian-11-to-debian-12-1\">Upgrading Debian 11 to Debian 12<\/a><\/li><li><a href=\"#reboot-the-system-2\">Reboot the System<\/a><\/li><li><a href=\"#verify-system-upgrade\">Verify System Upgrade<\/a><\/li><\/ul><\/li><li><a href=\"#other-tutorials\">Other Tutorials<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"upgrading-debian-11-to-debian-12\">Upgrading Debian 11 to Debian 12<\/h2>\n\n\n\n<p>This guide applies to upgrade of both Debian 11 desktop and server versions to Debian 12.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"backup-your-debian-11-system-data\">Backup your Debian 11 System Data<\/h3>\n\n\n\n<p>Well, it is always a good idea to backup any data, not just your Debian 11 data when you are about to upgrade it to Debian 12. Backup will always save you just in case something happens during upgrade that may cause system failure. It ensure you have a copy of your data which you can always access and recover any that was damaged.<\/p>\n\n\n\n<p>Backup process is out of this scope.<\/p>\n\n\n\n<p>You may want to check how to backup <a href=\"https:\/\/kifarunix.com\/?s=backuppc\" target=\"_blank\" rel=\"noreferrer noopener\">Linux systems using tools such as BackupPC<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"login-to-your-system-via-physical-console\">Login to your System via Physical Console<\/h3>\n\n\n\n<p>Personally, I wont recommend any system upgrade to be done via SSH. What if you loose connection in the middle of upgrade? You brick your system!<\/p>\n\n\n\n<p>So, use physical console or any direct access method.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"run-full-system-update\">Run Full System Update<\/h3>\n\n\n\n<p>Ensure that your system is up-to-date by executing the commands below.<\/p>\n\n\n\n<p>Hold on, before we can ran upgrade, let&#8217;s confirm our Debian 11 system details;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>hostnamectl<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n   Static hostname: debian11\n         Icon name: computer-vm\n           Chassis: vm\n        Machine ID: a417481aacd84ee19371d9b5e109cf12\n           Boot ID: 3300de73894747b1808316e1c4895158\n    Virtualization: oracle\n  Operating System: Debian GNU\/Linux 11 (bullseye)\n            Kernel: Linux 5.10.0-8-amd64\n      Architecture: x86-64\n<\/code><\/pre>\n\n\n\n<p>The OS and the current Kernal details;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Operating System: <\/strong>Debian GNU\/Linux 11 (bullseye)<\/li>\n\n\n\n<li><strong>Kernel: <\/strong>Linux 5.10.0-8-amd64<\/li>\n<\/ul>\n\n\n\n<p>Debian Version;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat \/etc\/debian_version<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>11.3<\/code><\/pre>\n\n\n\n<p>Now, proceed with system repositories update.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update<\/code><\/pre>\n\n\n\n<p>Run system upgrade;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt upgrade --auto-remove<\/code><\/pre>\n\n\n\n<p>Once that is done, run the smart upgrade;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt dist-upgrade<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"reboot-the-system\">Reboot the System<\/h3>\n\n\n\n<p>Once the upgrade completes successfully, reboot the system to effect all the upgrade changes.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl reboot<\/code><\/pre>\n\n\n\n<p>After system reboot, one thing to note is that my system has now moved to Debian 11.7 from Debian 11.3 after update.<\/p>\n\n\n\n<p>Let&#8217;s move on to see how to now upgrade Debian 11.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"update-system-repositories\">Update System Repositories<\/h3>\n\n\n\n<p>In order to upgrade from Debian 11 to Debian 12, we need to update the current system repositories from Debian 11&#8217;s repos, <code><strong>bullseye<\/strong><\/code>, to Debian 12&#8217;s repos, <strong><code>bookworm<\/code><\/strong>.<\/p>\n\n\n\n<p>These are my Debian 11&#8217;s current system repositories;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>grep -ir bullseye \/etc\/apt\/sources.list | grep -vE \"^#\"<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\ndeb http:\/\/deb.debian.org\/debian\/ bullseye main\ndeb-src http:\/\/deb.debian.org\/debian\/ bullseye main\ndeb http:\/\/security.debian.org\/debian-security bullseye-security main\ndeb-src http:\/\/security.debian.org\/debian-security bullseye-security main\ndeb http:\/\/deb.debian.org\/debian\/ bullseye-updates main\ndeb-src http:\/\/deb.debian.org\/debian\/ bullseye-updates main\n<\/code><\/pre>\n\n\n\n<p>So, we need to update them as follows;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sed -i.bak 's\/bullseye\/bookworm\/' \/etc\/apt\/sources.list<\/code><\/pre>\n\n\n\n<p>The repos now look like;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>grep -vE \"^#|^$\" \/etc\/apt\/sources.list<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\ndeb http:\/\/deb.debian.org\/debian\/ bookworm main\ndeb-src http:\/\/deb.debian.org\/debian\/ bookworm main\ndeb http:\/\/security.debian.org\/debian-security bookworm-security main\ndeb-src http:\/\/security.debian.org\/debian-security bookworm-security main\ndeb http:\/\/deb.debian.org\/debian\/ bookworm-updates main\ndeb-src http:\/\/deb.debian.org\/debian\/ bookworm-updates main\n<\/code><\/pre>\n\n\n\n<p>Similarly, if you have custom repos in the <strong><code>\/etc\/apt\/sources.list.d<\/code><\/strong> directory, then update them accordingly.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"optionally-install-non-free-firmware-repositories\">Optionally Install Non-Free-Firmware Repositories<\/h3>\n\n\n\n<p>Non-free-firmware repositories provide packages that requires a user to explicitly accept end user license agreement before a package can be installed. These repositories are usually required to install packages relating to various hardware such as WiFi controllers, Bluetooth, Graphics, Sound, e.t.c especially on Desktop systems.<\/p>\n\n\n\n<p>If you therefore have non-free firmware installed it is recommended to add&nbsp;<strong>non-free-firmware<\/strong>&nbsp;to your APT sources-list. To install such repos, update the sources.list file as follows;<\/p>\n\n\n\n<pre class=\"scroll-sz\"><code>\ncat >> \/etc\/apt\/sources.list << 'EOL'\n# Non-Free-Firmware\ndeb http:\/\/deb.debian.org\/debian bookworm non-free non-free-firmware\ndeb http:\/\/deb.debian.org\/debian-security bookworm-security non-free non-free-firmware\ndeb http:\/\/deb.debian.org\/debian bookworm-updates non-free non-free-firmware\nEOL\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"remove-bullseye-backports-repositories\">Remove bullseye-backports Repositories<\/h3>\n\n\n\n<p>If you have any <strong><code>bullseye-backports<\/code><\/strong> repositories installed, it is recommended to remove them from source-list files before the upgrade. If you really need them, you can add back after the upgrade.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>grep -irl 'bullseye-backports' \/etc\/apt\/sources.list* |\\\n xargs -I {} sed -i '\/bullseye-backports\/s\/^\/#\/' {}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"upgrading-debian-11-to-debian-12-1\">Upgrading Debian 11 to Debian 12<\/h3>\n\n\n\n<p>It is time to upgrade!<\/p>\n\n\n\n<p>Run system package cache update;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update<\/code><\/pre>\n\n\n\n<p>Next, perform minimal system upgrade to only update the existing packages without installing any new packages in the system<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt upgrade --without-new-pkgs<\/code><\/pre>\n\n\n\n<p>During the upgrade process, you will get <code><strong>apt-listchanges<\/strong><\/code> new!<\/p>\n\n\n\n<p>Go through the news and press <strong><code>q<\/code><\/strong> to exit when done reading, -:)<\/p>\n\n\n\n<p>You will also be prompted on whether to restart some services during upgrade. Accept (<strong>yes<\/strong>) and move forward.<\/p>\n\n\n\n<p>Do full system upgrade now from Debian 11 to Debian 12;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt full-upgrade<\/code><\/pre>\n\n\n\n<p>During upgrade, you will receive prompts on whether to override configurations of old packages with new configurations. For example;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\nConfiguration file '\/etc\/nginx\/nginx.conf'\n ==> Modified (by you or by a script) since installation.\n ==> Package distributor has shipped an updated version.\n   What would you like to do about it ?  Your options are:\n    Y or I  : install the package maintainer's version\n    N or O  : keep your currently-installed version\n      D     : show the differences between the versions\n      Z     : start a shell to examine the situation\n The default action is to keep your current version.\n*** nginx.conf (Y\/I\/N\/O\/D\/Z) [default=N] ?\n<\/code><\/pre>\n\n\n\n<p>For me, I will choose to keep currently-installed version configs.<\/p>\n\n\n\n<p>Review the prompts and proceed appropriately.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"reboot-the-system-2\">Reboot the System<\/h3>\n\n\n\n<p>Once the upgrade is done, reboot the system.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl reboot<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"verify-system-upgrade\">Verify System Upgrade<\/h3>\n\n\n\n<p>Once the system boots up, launch a terminal and start to check if everything is okay. Including any services that you might have installed on the previous OS version.<\/p>\n\n\n\n<p>For us, let's check some basic system information.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>hostnamectl<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n Static hostname: debian11\n       Icon name: computer-vm\n         Chassis: vm \ud83d\uddb4\n      Machine ID: a417481aacd84ee19371d9b5e109cf12\n         Boot ID: 934ad7ae1e2a4679b8aedb7eedc6697b\n  Virtualization: oracle\n<strong>Operating System: Debian GNU\/Linux 12 (bookworm)  \n          Kernel: Linux 6.1.0-9-amd64 <\/strong>\n    Architecture: x86-64\n Hardware Vendor: innotek GmbH\n  Hardware Model: VirtualBox\nFirmware Version: VirtualBox\n<\/code><\/pre>\n\n\n\n<p>We are now on Debian 12;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>Operating System: Debian GNU\/Linux 12 (bookworm)  \n          Kernel: Linux 6.1.0-9-amd64<\/strong><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>cat \/etc\/debian_version<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>12.0<\/code><\/pre>\n\n\n\n<p>And that is it! You have successfully upgraded your Debian 11 system to Debian 12.<\/p>\n\n\n\n<p>That closes our guide on upgrading Debian 11 to Debian 12.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"other-tutorials\">Other Tutorials<\/h2>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/?s=upgrade\" target=\"_blank\" rel=\"noreferrer noopener\">System\/tools upgrades<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Are you looking for a quick way to upgrade Debian 11 to Debian 12? Look no further, this guide will take you through all the<\/p>\n","protected":false},"author":10,"featured_media":17172,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,49,2959],"tags":[6859,6858,6860,6857],"class_list":["post-17157","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","category-command-cheatsheets","category-os","tag-debian-12","tag-debian-12-bookworm","tag-debian-12-upgrade","tag-debian-12-upgrade-from-debian-11","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/17157"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=17157"}],"version-history":[{"count":13,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/17157\/revisions"}],"predecessor-version":[{"id":20793,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/17157\/revisions\/20793"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/17172"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=17157"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=17157"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=17157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}