Upgrade a PS4 Host from Debian Major Version 10 to 11
What is it
The Linux operating system of your PS4 system runs the Debian distribution in relase 10 (a.k.a. "Buster") and you want to upgrade to the successor Debian 11 ("Bullseye").
The coupling between the operating system version of your server platform and what the PS4 stacks uses is pretty loose - actually, that's the promise of container technology. This means that stacks and server may and will differ on what OS version they are based upon and this will wirk perfectly as long as the server runs a sufficiently modern OS version. It is therefore mot necessary to simultaneously upgrade server and stacks to a new OS version.
Find more on Debian releases on the Debial release page.
Prerequisites
Backup your PS4 system, especially when it has production character. While these upgrades usually run flawlessly there is never a 100% guarantee.
The snapshot feature most VM and cloud environments offer is a fast and comfortable way to create short-term backups. Be aware that cloud providers usually charge for the additional storage consumed by the snapshot, so every now and then you should delete snapshots you no longer need.
As a bare minimum you should have a copy of these directory hierarchies:
- /etc
- /var/lib/dpkg
- /var/lib/apt/extended_states
- and additionally have the output of this command saved somewhere: dpkg --get-selections "*".
How to achieve it
The upgrade follows the regular Debian process for distribution upgrades. The following instructions are valid for a PS4 system which has not been modified heavily on the operating system level (e.g. by adding additional package repositories, installing unstable versions of packages and the like).
- Make sure you have a backup available.
- Inform users if necessary. While you do not have to stop your PS4 stacks now (using docker-stack stop ...) you might nevertheless do it to avoid users to start activities during the update which might later get aborted when rebooting into the upgraded system.
- Update your package configuration in /etc/apt/sources.list with a text editor:
- Replace every occurrence of "buster" by "bullseye" (also in combinations like "buster-updates", "buster/updates" or "buster-backports").
- Do not forget this step as it is specific to the update to Debian 11: Replace all occurences of "bullseye/updates" in the third column by "bullseye-security" (this is due to a change of the Debian 11 repository structure).
- Additionally, in the line containing the PS4 repository (the "ps.msg.team" URL) append the Debian major release version to the URL. It then reads so:
- Write all what follows in a logfile. This is a simple precaution for those rare cases where the upgrade process fails. The logfile allows to reproduce all steps and (possibly overlooked) messages in chronological order and is often a valuable means to track down problems. Start the logfile with script -t 2>/upgrade-debian11.time -a /upgrade-debian11.script. (A "Script started" message confirms that the keystroke log is allocated.)
- Now everything is prepared in order to start the update. As a first step execute apt update to retrieve the current package catalog (this will not yet change any software packages). The command will just take a few seconds to complete.
- Make sure sufficient free disk space is avaiable for the upgrade process. This command will check it and report: apt -o APT::Get::Trivial-Only=true full-upgrade (The error at the end of the output reading "Trivial Only specified..") does no harm as for us is just important that the total size of the upgrade has been calculated and checked against the available free space.)
- Execute apt upgrade -y. This does the bulk of the upgrade process, so expect that a pretty big amount of data will be downloaded (several 100 MB). On a good Internet connection the process takes less than 15 minutes but it may get interrupted several times when manual input is required. See the note below for details.
- Execute apt full-upgrade -y. This will remove superfluous packages and thoroughly resolve dependency conflicts. This step should take less than a minute. It again may get interrupted by messages requesting your input, see below.
- Change the Debian major version information in /etc/issue and /etc/motd in a text editor so that the login messages show the correct OS level.
- Reboot your system. It should come up with the new Debian major version and start all of your PS4 stacks, as usual. Note that this will also end the log you started before through the script command.)
Messages you might encounter
The "upgrade" and "full-upgrade" steps will get interrupted because you have to decide on something which the software cannot determine without your help. Usually this is about configuration files which may get overwritten by the upgrade. It looks like this:
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** xyz.conf (Y/I/N/O/D/Z) [default=N] ?
The system asks what do do, giving you the chance to first inspect the differences by selecting D.
- To keep your current configuration select N (this, for the sake of safety, is the default).
- To instead the Debian 10 standard version of the configuration and overwriting your version select Y.
Here is a list of such questions commonly displayed during such an upgrade, together with a recommendation how to reply (assuming you did not apply individual changes to the respective configuration file):
- /etc/issue: N (keep the old version and modify it manually, see the last step in the instructions)
- A screen dialog informs you "There are services installed on your system which need to be restarted... Restart service during package upgrades without asking?". Unless you want to keep the service downtime to an absolute minimum you should answer Yes here.
- sudoers: N
- crontab: N (PS4 has its own root crontab contents)
- vimrc: Y
- filetypes: Y
- /etc/ntp.conf: Y
- openssh-server (another screen dialog): install the package maintainer's version
- grub-pc (again a screen dialog): select /dev/sda (the cursor is already there, so just press SPACE to select and then ENTER to confirm)
Good to know
To check the operating system version of your PS4 platform you may look into file /etc/debian_version or check the line "Operating System" in the output of command hostnamectl.