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-01-15 08:59:00

Not to mention travel – when real life experiences in a destination don’t match the expectations and everything that can go wrong, goes wrong. Well, that’s the beauty of #travel. #Europehttps://klaava.com/nitpickers-travel-journal-travel-lessons-learned-in-2024/


News

2025-01-11 13:25:00

A conclusion from the Traffic Scorecard 2024 results is it takes about double the time to drive along the streets of London (the most congested city in #Europe) than the streets of Munich, which is ranked the 21st most congested European city. #traffic #travelhttps://klaava.com/the-cities-in-europe-where-people-are-stuck-in-traffic-most-often/


A shop dedicated to tasty juice

2025-01-09 14:04:10

arihak

A shop dedicated to tasty juice


in the busy old town center.

2025-01-08 16:16:08

in the busy old town center.


News

2025-01-07 14:56:00

A reminder for keeping your data safe when traveling. Why? It is likely that you have to access your most critical data in risky situations on the road.https://cybernews.com/privacy/how-to-protect-your-sensitive-information-while-traveling/


News

2025-01-02 16:33:00

What about the scenery, you who are hurrying to the other side?#streetphotography#streetphoto


News

2025-01-01 16:06:00

According to a survey, third of travelers are victims of online booking scams. Since it is so convenient to make travel reservations online, that’s what we do. The problem is that we haven’t adopted new methods to avoid online scams. #travel #scamhttps://klaava.com/a-traveler-is-more-likely-to-get-scammed-when-booking-a-trip-than-being-robbed-in-a-destination/


Perhaps road builders had too much time?

2024-12-29 15:19:44

Perhaps road builders had too much time?


News

2024-12-27 18:25:00

#Photography is full of so-called “rules” that can feel overwhelming. However, some of these “rules” are downright myths.https://www.diyphotography.net/debunking-seven-common-myths-photographers-still-believe-in/


What should I read next?

2024-12-25 15:18:22

arihak

What should I read next?


News

2024-12-23 11:34:00

Since #EU #DMA has specified #Apple as a #gatekeeper in #mobile devices, EU considers Apple should implement several iOS connectivity features, predominantly used for and by connected devices. For instance, notifications, automatic Wi-Fi connection, AirPlay, AirDrop, or Bluetooth audio switching.https://digital-markets-act.ec.europa.eu/commission-seeks-feedback-measures-apple-should-take-ensure-interoperability-under-digital-markets-2024-12-19_en


News

2024-12-21 14:51:00

Smartphone users in the US are not impressed with the latest artificial intelligence features on their devices with 73 percent of Apple users and 87 percent of Samsung users unsatisfied, according to a new study. #phone #AIhttps://petapixel.com/2024/12/19/majority-of-smartphone-users-are-unimpressed-with-ai-features-study-finds/


There should be enough ice already to open the hotel

2024-12-20 16:40:17

There should be enough ice already to open the hotel


Hiking on a mountain experience: the end of an ancient tunnel

2024-12-09 14:12:31

arihak

Hiking on a mountain experience: the end of an ancient tunnel


on a hot summer day

2024-12-02 18:47:01

on a hot summer day


Cloudy day in a valley

2024-11-25 16:31:59

arihak

Cloudy day in a valley


In the shade of a lone palm tree

2024-11-25 15:46:29

In the shade of a lone palm tree


an abandoned town?

2024-11-07 18:35:22

an abandoned town?


A quiet moment between heavy rain

2024-10-24 17:34:45

A quiet moment between heavy rain


Everyone loves a pretty mountain scenery

2024-10-24 16:54:02

arihak

Everyone loves a pretty mountain scenery