Upgrading to TLD Linux 2018.01

Note: only upgrade from TLD Linux 2016.01 is supported. If you are running TLD Linux 2015.01 please use this howto. If you are running TLD Linux 2013.01 or earlier you will need to reinstall from scratch.

Getting started


Please backup at least entire system configuration before proceeding! If possible backup entire host or take snapshot of its current state if its virtual machine.

First of all update your poldek indexes:

poldek --upa

Now get rid of all *.rpmnew files from /etc to be sure you will have newest default configurations for all packages for which old one cannot be adjusted or updated.

You should remove all the packages that are no longer part of TLD or your upgrade may be blocked by unresolved package dependencies. Following script will create list of these packages for you:

#!/bin/sh

rpm -qa --qf="%{name}\n" > installed_packages.txt
poldek --cmd "ls --qf=%{name}\n" > dist_packages.txt
sed -i -e 's/\+/\\\+/g;' installed_packages.txt

rm -f removed_packages.txt
for pkg in $(cat installed_packages.txt); do
  if ! grep -q -E "^"$pkg"$" dist_packages.txt; then
    echo "$pkg" >> removed_packages.txt
  fi
done

rm -f installed_packages.txt dist_packages.txt

Carefully inspect contents of file removed_packages.txt created by above script to see what packages must be removed. Warning! If your system has default PHP version installed all PHP packages will be removed due to package name changes. Be sure to backup your PHP configuration before continuing and check upgrade notes for PHP.

When ready remove packages with:

rpm -ev --nodeps $(cat removed_packages.txt)

Upgrading


Warning! Before performing upgrade please read package notes, especially when you're running MySQL and/or PostgreSQL on your server. You may need to take additional actions to avoid data loss.

We can't upgrade everything at all. Due to rpm database version change first we must upgrade rpm and poldek including all dependencies:

poldek -v -U rpm* poldek*

If there were no errors we are ready to rebuild rpm database to upgrade it to db 4.7:

rm -f /var/lib/rpm/__db*
rpm --rebuilddb

Note: using wildcard rpm* will pull rpm build tools which will pull base developement tools like gcc, libc headers and some devel packages. If you don't need them its ok to remove them when upgrade is finished.

Finally we can perform system upgrade:

poldek -v --nohold --upgrade-dist

If you'll run into some unresolved dependencies you may try following things:

1. Remove problematic package. If it hauls half of your system use

rpm -e --nodeps pakcage

2. Do forced upgrade of problematic package via poldek command line:

poldek --cmd "upgrade --force package"

Add –nodeps if necessary.

Finishing


When your upgrade-dist will finish you must check/modify/recreate your system configuration. It is strongly recommended to go through all *.rpmnew files in your /etc and modify them to fit your needs. Using old configuration files may cause problems for some packages or they may not run at all.

After double or even triple checking everything you are ready to reboot :-)

Notes for some packages


Dovecot

Dovecot version has changed from 2.2 to 2.3. Please refer to official upgrade instructions:

https://wiki.dovecot.org/Upgrading/2.3

Grub

TLD 2018.01 contains final stable version of Grub bootloader. It is good idea to reinstall Grub on your system to upgrade from beta/rc version to stable one.

Kernel

Starting with version 2018.01 TLD provides only selected LTS kernels. Usually the one with longest planned support (currently 4.4) and newest one (currently 4.14). Be sure to check which kernel version you were using and if it wasn't 4.4 vanilla you must manually install one of currently supported kernel to get updates.

Freeradius

After upgrade permissions to /etc/raddb become broken. To fix them force upgrade of freeradius-server package. Before proceeding backup your /etc/raddb (just in case, it shouldn't be modified).

poldek --cmd "upgrade --force freeradius-server"

MySQL

TLD 2018.01 comes with MySQL 5.7 (Percona Server). In order to properly upgrade without loosing your data you must do full dump/restore. Please backup all your databases before upgrading. You can dump everything to single file:

mysqldump -u mysql -p -c --hex-blob --single-transaction --all-databases > sql_full_backup.sql

or each database separately:

mysqldump -u mysql -p -c --hex-blob --single-transaction databaseX > sql_databaseX_backup.sql

Now please stop mysql service:

service mysql stop

then move out old MySQL data:

mv /var/lib/mysql /var/lib/mysql.bak

and perform upgrade. When finished initialize clean MySQL 5.7 cluster:

service mysql init

And restore everything from your backup file(s):

mysql -u mysql -p < sql_full_backup.sql

Don't forget to edit /var/lib/mysql/mysqld.conf to fit your needs.

Note: MySQL in TLD now uses “root” login for superuser instead of previously used “mysql”.

Nut

After upgrade permissions to /var/lib/ups become broken. To fix them force upgrade of all nut packages installed in your system. Before proceeding backup your /etc/ups (just in case, it shouldn't be modified). For example:

poldek --cmd "upgrade --force nut nut-common nut-client nut-cgi"

PHP

All PHP packages in TLD are now fully versioned. Due to this change there is no default PHP version and upgrade procedure will remove PHP from your system. When upgrade is finished you must manually install PHP version of your choice. Following versions are supported: 5.6, 7.0, 7.1 and 7.2.

Default PHP version in TLD 2016.01 was 7.0. If you are moving to PHP 7.1 or 7.2 be sure to update your PHP applications and/or web pages. Check link below for more details about possible incompatibility issues:

PHP 7.1 backward incompatible changes
PHP 7.2 backward incompatible changes

PostgreSQL

PostgreSQL database version has changed from 9.5 to 10.3. As usual when major version changes it is strongly recommended to do upgrade using dump/restore method. Before upgrade dump all contents of your databases and copy them to some safe location. You can dump everything to single sql file with this command run locally on your server:

pg_dumpall -U postgres -W > sql_full_backup.sql

or dump just globals with:

pg_dumpall -g -U postgres -W > sql_globals.sql

and then each database separately with:

pg_dump -b -U postgres -W databaseX > sql_databaseX.sql

Now please stop potsgresql service:

service postgresql stop

move away your old database data:

mv /var/lib/pgsql /var/lib/pgsql.bak

and perform upgrade. When finished initialize clean PostgreSQL 10.3 database structure:

service postgresql init

Follow on screen instructions to set database passwords. Later go to /var/lib/pgsql/postgresql.conf and edit database configuration to fit your needs. Restore your database contents with something like this (if you dumped everything to single file):

psql -U postgres -W < sql_full_backup.sql 1>sql_restore_log.txt 2>&1

or with something like this (if you dumped globals and each database separately):

  psql -U postgres -W < sql_globals.sql 1>sql_globals_restore_log.txt 2>&1
  psql -U postgres -W < sql_databaseX.sql 1>sql_databaseX_restore_log.txt 2>&1
  psql -U postgres -W < sql_databaseY.sql 1>sql_databaseY_restore_log.txt 2>&1
  ...

When finished check sql*_restore_log.txt files for any errors, warnings or other abnormal things. Some structures or functions may have failed to restore due to changes in PostgreSQL made between version 9.5 and 10.3. If you'll hit such problem your only solution is to manually recreate failed structures/functions later or make modification to SQL statements directly in dump files and retry restore from the beginning.

Samba

Samba in TLD 2018.01 was upgraded from 4.2 to 4.8. Due to changes between these releases it may be required to update your configuration. While simple configs works ok after upgrade more complicated ones may fail to run. Be sure to check if everything works.

Syslog-ng

After upgrade syslog-ng will complaing about configuration version. All you need to do to make warnings go away is to edit version number in first line of syslog-ng.conf. Please change:

@version: 3.6

to:

@version: 3.15
© TLD Linux