2023-06-19 00:00:00

TechnologyBookworm|debian|LAMP|PHP|upgrade

How to upgrade to Debian 12, and tips for troubleshooting problems in LAMP

Debian 12 (Bookworm) was released in June 2023 for Linux computers. The new version features a massive number of updates, such as a new Linux kernel, new PHP version, LibreOffice and much more. Upgrading an operating system to a new major release is always somewhat distressful task, especially if you are upgrading a production server or a PC that is the primary workstation of someone. Here is our guide for upgrading Debian to version 12 with tips for systems running applications that rely on LAMP software packages (Linux, Apache, Mysql/Mariadb, PHP).

Before you start the upgrade

Major releases of Debian can only be upgraded from the previous version. The system you want to upgrade must be running on Debian 11 before you can start. Here is a guide for upgrading to Debian 11. Not sure which version you have? Type on the command line:
hostnamectl
If it doesn't run, type:
cat /etc/debian_version

Copy these two network configuration files into a safe place before starting the upgrade:

/etc/resolv.conf
/etc/network/interfaces

(Having a copy of resolv.conf saved my day because for some reason upgrade process deleted the existing resolv.conf).

To minimize package conflicts, check the status of current apt packages, and remove old ones:

dpkg --audit
apt clean
apt autoremove

If you believe available disk space could run low during the upgrade, check the status:
df

Perhaps there are packages you can remove? List installed packages:
apt list --installed

I rarely reboot our Linux servers or PCs, but at this stage - just before the actual upgrade I rebooted the computer.

The Debian 12 upgrade process

First, the apt package system has to be told that you want Debian 12 Bookworm software instead of Bullseye. This means editing a few lines in the configuration file /etc/apt/sources.list. Below is a list of key lines required by Debian. The principle is to replace bullseye with bookworm. Your sources.list may have more lines for additional packages. Also files in the sources.list.d -directory may point to additional packages. Here are the key lines you need:

deb http://deb.debian.org/debian/ bookworm main
deb http://security.debian.org/debian-security bookworm-security main
deb http://deb.debian.org/debian/ bookworm-updates main
deb http://deb.debian.org/debian bookworm non-free non-free-firmware
deb http://deb.debian.org/debian-security bookworm-security non-free non-free-firmware
deb http://deb.debian.org/debian bookworm-updates non-free non-free-firmware

(Thanks to https://www.debugpoint.com/upgrade-debian-12-from-debian-11/ for the list)

Now, let's start. Type the following on the command line:

apt update

The last lines of the output look like something below:

Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
2069 packages can be upgraded. Run 'apt list --upgradable' to see them.

Next, type:

apt upgrade

You should see something like this:

1694 upgraded, 224 newly installed, 0 to remove and 375 not upgraded.
Need to get 1,526 MB of archives.
After this operation, 1,750 MB of additional disk space will be used.

Patience, it can take a long time to finish. Once it is done, you can run the major version upgrade:

apt full-upgrade

You should see something like:

375 upgraded, 123 newly installed, 46 to remove and 0 not upgraded.
Need to get 436 MB of archives.
After this operation, 325 MB of additional disk space will be used.
Do you want to continue? [Y/n]

Again, this process may take some time to finish.

If the upgrade completed without critical errors, reboot the system. Once it is up and running, verify the operating system version:

hostnamectl
or
cat /etc/debian_version

Troubleshooting

If you have problems with connecting to the network after the upgrade (the command line error message can be something like:
Temporary failure in name resolution
you may have lost your DNS configuration file. This is why the first thing to do before starting the upgrade was to backup the file/etc/resolv.conf. Now is the perfect time to recover the file in its original location.

Servers that are running a LAMP software may encounter critical errors because all the key packages for Apache, Mysql/Mariadb and PHP have been upgraded.

PHP seems to be the major casualty. You have to manually install PHP 8.2 and additional PHP modules that your system requires.

apt install php8.2

And the modules you need, such as ((which modules are needed depends on the applications and services you are running):

apt install php8.2-mysql
apt install php8.2-mbstring

Remember to restart the web server after these changes. If you are running Apache2:

systemctl restart apache2

We are running Wordpress CMS, so it was the first service we tested after PHP installation. Although Wordpress worked, we had a theme that completely broke the entire Wordpress when it was activated. The theme worked fine with PHP 7.4, but PHP 8.2 caused the theme to crash.

PHP 8.2 may break programs that ran fine earlier.

Updated on 2023-08-09: here is an articlethat lists major changes in PHP 8.2 compared to earlier version.

Upgrading to PHP 8.2 may not only break Wordpress themes, but Wordpress plugins as well. We have encountered two plugins so far that failed to run on PHP 8.2. The problems didn't instantly make themselves known, so identifying them required some research. The core Wordpress is compatible with PHP 8.2.

We have a number of tool programs and web applications written in PHP, and some of them started misbehaving after the upgrade to PHP 8.2. So far, we have identified two common problems in the PHP code of the programs we have: variable typesand timezone. PHP has been flexible with variable types so far, but now it requires a variable to stick to its type. Most often, the code we have corrected had undeclared or empty arrays. Surprisingly many programs rely they are running on the same timezone as the underlying operating system. Now, this timezone must be set in PHP - either in the PHP.ini file or in the program using a dedicated function.

Debian development team has written a thorough upgrade document that you can view here.

News

2025-05-14 16:03:00

Bordeaux is ready for hot summer days.#streetphotographyhttps://pixelfed.social/p/arihak/827854641319295061


Hochosterwitz castle

2025-05-10 15:23:05

Hochosterwitz castle


News

2025-05-07 14:39:00

A meeting in winter sun.#streetphotography #travelphotographyflic.kr/p/2qey2NHhttps://flic.kr/p/2qey2NH


News

2025-04-30 17:01:00

Shady character.#streetphotography #travelphotography #StreetPhotography


Not in space, but firmly on the ground in Valencia.

2025-04-25 17:47:30

arihak

Not in space, but firmly on the ground in Valencia.


News

2025-04-24 15:17:00

According to a survey, football (a sport where you are supposed to kick the ball instead touching the ball with a hand) is the most popular sports that fans want to follow live on site even if it means traveling overseas. #travelhttps://klaava.com/sports-events-are-trending-among-travelers/


News

2025-04-23 14:19:00

An unexpected recognition for analog #photography : UNESCO Cultural Heritage designation suggests a renewed appreciation for the craftsmanship and cultural significance of analog methods.https://www.diyphotography.net/analog-photography-recognized-as-intangible-cultural-heritage-by-unesco/


News

2025-04-17 13:18:00

New restriction on Flickr #photo sharing: Free #Flickr accounts will be restricted from downloading original and large-size images. While users will still be able to upload photos of all sizes, free account holders will only be able to download medium and small photos.https://petapixel.com/2025/04/16/flickr-restricting-download-sizes-for-free-accounts/


News

2025-04-16 10:54:00

Morning commute.#streetphotography#travelphotography


News

2025-04-12 09:17:00

The region in #Europe where you will get more #travel days for your euro (or whatever the local currency happens to be). The difference in the average cost is vast between the cheapest and the most expensive European countries.https://klaava.com/here-are-the-cheapest-countries-to-travel-in-europe/


Looks like a perfect spot for a cat to observe the street but no one was home when I passed the window.

2025-04-10 13:35:48

arihak

Looks like a perfect spot for a cat to observe the street but no one was home when I passed the window.


News

2025-04-07 08:50:00

When you take a #photo in RAW format the file is filled with extra data that allows for much richer post-processing, but the #camera world has never actually settled on one standardized RAW format.https://www.theverge.com/tech/640119/camera-raw-spec-format-explained-adobe-dng-canon-nikon-sony-fujifilm


News

2025-04-01 08:39:00

YouTube was the second-biggest media company in the world last year.And in 2025, #YouTube should eclipse #Disney, and become the biggest #media company in the world.https://www.businessinsider.nl/youtube-is-about-to-eclipse-disney-as-the-biggest-media-company-in-the-world/


News

2025-03-28 08:36:00

World Press Photo Contest 2025 ​have just been announced. This year, according to organizers, 59,320 images were submitted for judging, made by 3,778 photographers. #photographyhttps://www.theatlantic.com/photo/2025/03/winners-2025-world-press-photo-contest/682180/


Look around, and love your phone later

2025-03-22 10:17:39

arihak

Look around, and love your phone later


News

2025-03-21 12:50:00

An ancient football stadium?#streetphotography


News

2025-03-11 13:32:00

The World Photography Organisation has announced the category winners and shortlisted photographers for the Sony World #Photography Awards 2025 Open competition.https://www.dpreview.com/articles/0086546939/sony-world-photography-awards-2025-category-winners


News

2025-03-06 16:56:00

Coffee break.#streetphotography


News

2025-02-27 08:22:00

The Sony World #Photography Organisation unveiled the shortlisted entries and finalists in its annual competition’s 10 professional categories.https://edition.cnn.com/2025/02/25/style/sony-world-photography-awards-professional-2025/index.html


Summer heat.

2025-02-26 17:06:07

arihak

Summer heat.