No such table: users? after upgrading to 0.40 in Ubuntu 18.04

I’ve upgraded to 0.40 using the guide, and everything seemed fine. I can log in in the administration pages, I can see the emails before the upgrade, I can move mails around, etc.

However, I cannot send or receive emails.

In /var/log/ I’m seeing “user not found” errors.

In /var/log/mail.err I got this:

Jan 14 05:47:15 box postfix/trivial-rewrite[1065]: fatal: dict_sqlite_lookup: /etc/postfix/ SQL prepare failed: no such table: users?

In the admin panel, if I try to add or remove an alias, it displays an “Internal error” message. The same happens if I try to add a new user.

I tried to install MiAB again and the problem persists.

Any suggestions?

Another issue I’ve noticed is that I cannot change any DNS setting. I get this error in the logs:

subprocess.CalledProcessError: Command '['/usr/bin/ldns-signzone', '-e', '20190213', '-n', '/etc/nsd/zones/', '/tmp/', '/tmp/']' returned non-zero exit status 1.

When running it manually, I get this error message:

subprocess.CalledProcessError: Command '['/usr/bin/ldns-signzone', '-e', '20190213', '-n', '/etc/nsd/zones/', '/tmp/', '/tmp/']' returned non-zero exit status 1.

The offending line is the AAAA record of the host, but commenting it doesn’t make any difference whatsoever.

Removing the next line to the AAAA record, makes ldns-signzone happy:

IN MX 10

It doesn’t fix neither the email nor the users+alias error.

My uneducated guess would be that you are facing a database issue. It seems that perhaps it is corrupted. I unfortunately am not a database guy so I do not know what to advise you. How many users and domains do you have?

I finally made my MiAB working by repeating the restore procedure until no errors were reported (I was getting “file already exists” for the ssl certificate, for some sieve rules, and for some owncloud-install/config/config.php files).
But since I was unable to make nsd configuration work correctly, I ended up moving the DNS resolving out of the MiAB, and creating the DNS records from /etc/nsd/zones/*.txt in the external DNS. Less than ideal, but simple and straightforward.