Error while migrating mail

This morning I started the NS7 to NS8 migration process. The first module, nextcloud, went smooth but the mail migration stopped with an error:

<7>BEGIN 
<7>INSERT INTO relayrules (rule_type, rule_subject , transport, host, port, tls, username, password, enabled) 
                    VALUES ('wildcard', '*', 'smtp', 'xxxx.xxxx.nl', 25, 'encrypt', 'pa3hfj', 'xxxxxx', 1)
<7>ROLLBACK
Traceback (most recent call last):
  File "/home/mail3/.config/actions/import-module/49import_smarthosts", line 62, in <module>
    cur.execute("""INSERT INTO relayrules (rule_type, rule_subject , transport, host, port, tls, username, password, enabled) 
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.IntegrityError: UNIQUE constraint failed: relayrules.rule_subject
""

Probably an error in the conversion of the mailretrieval entries. It seems to stumble over the “rule_subject”. How can this be solved?

Multiple wildcard rules. Any idea @stephdl ? Where do they come from?

1 Like

please can you send me in private in the NS7 terminal

db smarthosts show
config show postfix

replace just password field by insensitive data (pwd: xxxxxxx) please

if you can still find it, can you send me /home/mail3/.config/state/{postfix.json,smarthosts.json}

1 Like

Apart from fixing the bug I think you have to abort Email migration, remove some relay rule to work around the bug, then start Email migration again.

On the ns8, (after sending the requested file to Steph) remove the Mail module created by the failed migration attempt. There’s no hurry to do it, if its services are still stopped.

/sbin/e-smith/db getmail show

please just replace the password and the user due to sensitive data

I am sad I cannot reproduce, what is the version of nethserver-mail, nethserver-mail*

[root@ns7loc6 ~]# rpm -qa | grep migration
nethserver-ns8-migration-1.0.13-1.ns7.x86_64
[root@ns7loc6 ~]# rpm -qa | grep mail
perl-Email-Valid-1.198-1.el7.noarch
nethserver-roundcubemail-1.5.2-1.ns7.noarch
nethserver-mail-filter-2.32.2-1.ns7.noarch
mailx-12.5-19.el7.x86_64
nethserver-mail-server-2.32.2-1.ns7.noarch
nethserver-mail-getmail-2.32.2-1.ns7.noarch
mailcap-2.1.41-2.el7.noarch
nethserver-mail-common-2.32.2-1.ns7.noarch
getmail-5.13-1.el7.noarch
nethserver-mail-smarthost-2.32.2-1.ns7.noarch
roundcubemail-1.4.14-1.ns7.noarch
sendmail-milter-8.14.7-6.el7.x86_64

Good morning Stephane,

I eventually skipped the migration of email and set it up afterwards. To be sure it would not interfere I removed the getmail entries in NS7 so the db getmail show gives no output, maybe it is retrievable from a backup? The other outputs are here below.

Still a lot of other problems which I shall address in seperate posts on the forum.

Thanks for your efforts to help! Maybe, because of your valuable time :slight_smile: , if there are no other users with this email-migrationproblem it is best to let it rest for now as I have email working now on NS8.

[root@server1 ~]# /sbin/e-smith/db getmail show
[root@server1 ~]# rpm -qa | grep migration
nethserver-ns8-migration-1.0.13-1.ns7.x86_64
[root@server1 ~]# rpm -qa | grep mail
perl-Email-Valid-1.198-1.el7.noarch
fail2ban-sendmail-0.11.2-3.el7.noarch
nethserver-mail-filter-2.32.2-1.ns7.noarch
sendmail-milter-8.14.7-6.el7.x86_64
getmail-5.13-1.el7.noarch
roundcubemail-1.4.14-1.ns7.noarch
nethserver-mail-smarthost-2.32.2-1.ns7.noarch
javamail-1.4.6-8.el7.noarch
perl-Email-Date-Format-1.002-15.el7.noarch
nethserver-mail-p3scan-2.32.2-1.ns7.noarch
mailcap-2.1.41-2.el7.noarch
nethserver-roundcubemail-1.5.2-1.ns7.noarch
nethserver-mail-disclaimer-2.32.2-1.ns7.noarch
nethserver-mail-server-2.32.2-1.ns7.noarch
nethserver-mail-getmail-2.32.2-1.ns7.noarch
mailx-12.5-19.el7.x86_64
nethserver-mail-common-2.32.2-1.ns7.noarch
1 Like