Disable all containers by changing the following line in the config files lxc.start.auto = 1 –> lxc.start.auto = 0
Below there are two methods for finding installed packages that did not come from Debian, using either aptitude or apt-forktracer. Please note that neither of them are 100% accurate (e.g. the aptitude example will list packages that were once provided by Debian but no longer are, such as old kernel packages).
# apt install apt-forktracer # apt-forktracer | sort
If you have any non-Debian packages on your system, you should be aware that these may be removed during the upgrade because of conflicting dependencies. If these packages were installed by adding an extra package archive in your APT source-list files, you should check if that archive also offers packages compiled for bullseye and change the source item accordingly at the same time as your source items for Debian packages. Like kernel drivers for network cards.
Regardless of the method used for upgrading, it is recommended that you check the status of all packages first, and verify that all packages are in an upgradable state. The following command will show any packages which have a status of Half-Installed or Failed-Config, and those with any error status.
# dpkg --audit
The recommended way to upgrade from previous Debian releases is to use the package management tool apt. apt is meant for interactive use, and should not be used in scripts. In scripts one should use apt-get, which has a stable output better suitable for parsing.
Before we start upgrade Debian buster to bullseye, make sure you've updated and upgraded all existing packages to their latest available version by running the following commands one by one:
# apt update # apt upgrade # apt dist-upgrade
Remove packages that have been previously downloaded for installation (at /var/cache/apt/archives). Cleaning up the package cache by running apt clean will remove all previously downloaded package files. And then clean any leftover packages and configuration files using commands:
# apt autoremove # apt autoclean # find /etc -name '.dpkg-' -o -name '.ucf-' -o -name '*.merge-error'
Reboot your system to apply all updates.
# reboot
Now the host is on the latest Buster versions, upgrade also all the individual containers to the latest Buster versions. Login as root into each of the containers and perform the following steps:
# apt update # apt upgrade # apt dist-upgrade # apt autoremove # apt autoclean # find /etc -name '.dpkg-' -o -name '.ucf-' -o -name '*.merge-error'
df /dev/sda2 Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda2 19091540 4450028 13648644 25% /
Before updating the software repositories in Debian buster, first backup the current software source list.
# mkdir ~/apt # cp /etc/apt/sources.list ~/apt # cp -rv /etc/apt/sources.list.d/ ~/apt
Verify the contents of ~/apt directory to make sure the software repository lists have been copied.
# ls apt/ sources.list sources.list.d
Before starting the upgrade you must reconfigure APT source-list files (/etc/apt/sources.list and files under /etc/apt/sources.list.d/) to add sources for bullseye and typically to remove sources for buster. Now we need to update the current repository list to point to Debian 11 repositories.
To replace and update Debian 10 repositories with Debian 11 repositories, run:
# sed -i 's/buster/bullseye/g' /etc/apt/sources.list # sed -i 's/buster/bullseye/g' /etc/apt/sources.list.d/*
Now verify if the sources list file is updated with new repository links:
# cat /etc/apt/sources.list
Sample output:
deb http://deb.debian.org/debian/ bullseye main deb-src http://deb.debian.org/debian/ bullseye main deb http://security.debian.org/debian-security bullseye/updates main deb-src http://security.debian.org/debian-security bullseye/updates main # bullseye-updates, previously known as 'volatile' deb http://deb.debian.org/debian/ bullseye-updates main deb-src http://deb.debian.org/debian/ bullseye-updates main # This system was installed using small removable media # (e.g. netinst, live or single CD). The matching "deb cdrom" # entries were disabled at the end of the installation process. # For information about how to configure apt package sources, # see the sources.list(5) manual.
Heads Up: For Debian bullseye, the security suite is now named bullseye-security instead of codename/updates and users should adapt their APT source-list files accordingly when upgrading.
So we need to update the security lines in the APT configuration file.
Find the following lines in your sources.list file:
deb http://security.debian.org/debian-security bullseye/updates main deb-src http://security.debian.org/debian-security bullseye/updates main
And replace them with following lines:
deb https://deb.debian.org/debian-security bullseye-security main contrib deb-src https://deb.debian.org/debian-security bullseye-security main contrib
After changing the security lines, the final APT sources.list file should look like below:
deb http://deb.debian.org/debian/ bullseye main deb-src http://deb.debian.org/debian/ bullseye main deb https://deb.debian.org/debian-security bullseye-security main contrib deb-src https://deb.debian.org/debian-security bullseye-security main contrib # bullseye-updates, previously known as 'volatile' deb http://deb.debian.org/debian/ bullseye-updates main deb-src http://deb.debian.org/debian/ bullseye-updates main # This system was installed using small removable media # (e.g. netinst, live or single CD). The matching "deb cdrom" # entries were disabled at the end of the installation process. # For information about how to configure apt package sources, # see the sources.list(5) manual.
Update the repository lists using command:
# sudo apt update
In some cases, doing a full system upgrade (which is explained in the next step) will remove large number of packages that you want to keep. So Debian developers recommends two-part upgrade process, namely minimal upgrade and full upgrade. The minimal upgrade will upgrade all existing packages without installing or removing any other packages. First, you need to do minimal upgrade using command:
# apt upgrade --without-new-pkgs
Keep an eye on the screen. During the upgrade process, you'll be asked to answer a few questions like what do you want to do with a configuration file or if you want to restart a service etc. The questions may vary depending upon the number of installed packages in your current Debian system. If the apt-listchanges package is installed, it will show important information about upgraded packages in a pager after downloading the packages. Press ENTER to read the information or simply press q to exit and return back to the upgrade process. Next you will be asked what do you want to do with a specific configuration file ( E.g. pam login file). Read the instructions on the screen and decide accordingly. If you're not sure what to do, just go with defaults by simply pressing ENTER key:
Now start the actual Debian 11 bullseye upgrade using command:
# apt full-upgrade
Again, you need to keep an eye on the screen and answer all questions that might come up as usual. As stated earlier, if the apt-listchanges package is installed, it will show important information about upgraded packages in a pager after downloading the packages. Press q to quit after reading the information and continue upgrade.
Once the Debian 11 upgrade process is completed, reboot your system:
#sudo reboot
Log in to the system and Check Debian 11 bullseye version using command:
# cat /etc/debian_version 11.0
Or, use lsb_release command:
# lsb_release -a
/var/log
Congratulations! We have successfully upgraded Debian 10 buster to Debian 11 bullseye.
Optionally, you can remove all packages that are no longer required using commands:
# apt --purge autoremove # apt autoclean
Now the host is upgraded to Bullseye, upgrade also all the individual containers to Bullseye. Login as root into each of the containers and perform the following steps:
Update the source.list
# apt update
When certificate error, Might need to run:
# apt install ca-certificates
# apt upgrade --without-new-pkgs # apt full-upgrade # reboot
Verify if everything works fine
# sudo apt --purge autoremove # sudo apt autoclean
No specific actions needed.
Add ExecStartPre=/bin/bash -c “mkdir -p /var/log/nginx” to /lib/systemd/system/nginx.service
[Service] Type=forking PIDFile=/run/nginx.pid ExecStartPre=/bin/bash -c "mkdir -p /var/log/nginx" ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;' ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;' ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid TimeoutStopSec=5 KillMode=mixed
And restart nginx:
# systemctl daemon-reload # systemctl start nginx