1 (edited by jackb 2024-08-20 09:06:32)

Topic: Direct Upgrade Ubuntu 20.04 to 22.04 (Guide)

It's time to get out of your comfort zone. As of April 25 Ubuntu 20.04 is EOL. Recommended to upgrade to 22.04+. Please note you can't skip versions you will need to Upgrade to 22.04 before 24.04.

Note: Snapshot, Backup before proceeding.

In the Direct Upgrade to 22.04 I ran into problems with dovecot causing the installer to crash these fixes will need to be applied before attempting the upgrade. (You may not need to do some fixes)

Make sure that iredmail is running the latest, You can't skip releases and not recommended! Be sure iRedmail is running 1.7.1 as of this post https://docs.iredmail.org/iredmail.releases.html

Lets begin,

Update the Server to the latest versions

 sudo apt update
 sudo apt upgrade -f
 sudo reboot 

Now the updates are installed we can now do the fixes before upgrading to 22.04.
MariaDB requires fixes, although these fixes are nothing to cause problems it will just fill /var/log/mail.log with errors

 cd /etc/mysql
 sudo nano my.cnf
 [client-server]
# Port or socket location where to connect
# port = 3306
   socket = /run/mysqld/mysqld.sock

# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/
[mysqld]
log_warnings=1
innodb_file_per_table = ON

sudo nano mariadb.cnf
 [client-server]
# Port or socket location where to connect
# port = 3306
   socket = /run/mysqld/mysqld.sock

   sudo systemctl restart mariadb 

Dovecot. There is a deprecated parameter in dovecot.conf that needs to be removed. (Note Your Server May not have this if not you can move onto the next step.

 cd /etc/dovecot
 sudo nano dovecot.conf
 
metric imap_command_finished {
    event_name = imap_command_finished
} 

sudo systemctl restart dovecot 

Next step.

Amavis. On some deployments DKIMs keys have permissions which are root:root not amavis:amavis, this won't cause any problems with the direct upgrade but will cause amavis to not run after the upgrade is completed.

 cd /var/lib
 sudo chown -R amavis:amavis dkim 

When fixes are applied, we can now backup the configs. Although Configs are not modified providing you specified in the upgrade processes and you chose N Just better to backup incase. (Note PHP www.conf will required to be backed up. If you don't use Sogo Groupware then you can disregard backing up it's config.

 cd /etc 
 sudo cp -R php /home/username
 sudo cp -R nginx /home/username
 sudo cp -R sogo /home/username 

When all above are completed we can now upgrade to Ubuntu 22.04 follow all installation screen.

 sudo apt dist-upgrade
 sudo do-release-upgrade 

Upgrade is completed make sure to copy www.conf back to /etc/php/8.1/fpm/pool.d/

 cd /etc/php/7.4/fpm/pool.d
 sudo cp www.conf /etc/php/8.1/fpm/pool.d
 sudo systemctl restart php8.1-fpm 

After the direct upgrade iredadmin will have a Internal Server Error Page to fix,
Please follow
https://docs.iredmail.org/migrate.or.up … admin.html
https://docs.iredmail.org/upgrade.mlmmjadmin.html

That is all that's required to upgrade to 22.04 from 20.04.

If you see errors in /var/log.mail.log related to claimav, the previous log gets locked. Fix,

 sudo systemctl stop clamav-daemon.service
 sudo rm /var/log/clamav/freshclam.log
 sudo systemctl start claimav-daemon.service 

Sogo Users, After a direct upgrade the ppa will require to be added for jammy,

 cd /etc/apt/sources.list.d
 sudo nano sogo-nightly.list 
 deb https://packages.sogo.nu//nightly/5/ubuntu jammy jammy
 sudo apt update
 sudo apt install sogo sogo-activesync sope4.9-gdl1-mysql
 sudo reboot 

Once everything is done above you should have a Ubuntu 22.04 Mail Server fully functioning.

Some people have reported Password Plugin in Roundcube being broken,

A fix,

 /opt/www/roundcubemail/plugins
  sudo nano config.inc.php
  $config['password_algorithm'] = 'clear';
  to
  $config['password_algorithm'] = "ssha512";

  $config['password_algorithm_prefix'] = '';
  to
  $config['password_algorithm_prefix'] = "{SSHA512}"; 

 $config['password_query'] = "UPDATE mailbox SET password=%D,passwordlastchange=NOW()  WHERE username=%u";
 to
 $config['password_query'] = "UPDATE mailbox SET password=%P,passwordlastchange=NOW()  WHERE username=%u"; 

Any problems please report below.

Regards

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Direct Upgrade Ubuntu 20.04 to 22.04 (Guide)

One typo: command "sudo stop clamav-daemon.service" should be "sudo systemctl stop clamav-daemon.service".

3

Re: Direct Upgrade Ubuntu 20.04 to 22.04 (Guide)

ZhangHuangbin wrote:

One typo: command "sudo stop clamav-daemon.service" should be "sudo systemctl stop clamav-daemon.service".

Fixed. My bad

Regards