Upgrade/migration from 0.30 to 0.45 fails

I keep trying to upgrade to the new version but struggle to make it work.
The v0.30 runs on a dedicated root server and all system packages are up to date.
The new miab server is a cloud VM on hetzner with a floating ip and a network volume mounted to hold the user-data in a different place /var/miab.

I can install v45 but in order to do so, I need to set the public ip before I run the setup script.
export PUBLIC_IP=1.2.3.4 because miab picks the private IP but not the floating public IP.
Additional I export the STORAGE_ROOT to /var/miab.

After I run the setup, which does succeed, I can login into my box.
Then I mount the network volume to /var/miab. Now it contains the all data from the old box.
Before I can run the mailinabox command again, I need to modify the /var/miab/owncloud/config.php to set the correct datadirectory to /var/miab/owncloud.

The setup runs fine to a certain point where I can’t figure out whats happening:

primary Hostname: box.example.io
Public IP Address: 1.2.3.4
Public IPv6 Address: 2a01:f:f:f::1
Private IP Address: 4.3.2.1
Mail-in-a-Box Version:  v0.45

Updating system packages...
Installing system packages...
Initializing system random number generator...
Firewall is active and enabled on system startup
Installing nsd (DNS server)...
Installing Postfix (SMTP server)...
Installing Dovecot (IMAP server)...
Installing OpenDKIM/OpenDMARC...
Installing SpamAssassin...
Installing Nginx (web server)...
Installing Roundcube (webmail)...
Installing Nextcloud (contacts/calendar)...
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Set log level to debug
Turned on maintenance mode
Updating database schema
Updated database
Disabled incompatible app: files_texteditor
Updating <files_rightclick> ...
Updated <files_rightclick> to 0.14.2
Checking for update of app accessibility in appstore
Checked for update of app "accessibility" in appstore
Checking for update of app activity in appstore
Checked for update of app "activity" in appstore
Checking for update of app calendar in appstore
Checked for update of app "calendar" in appstore
Checking for update of app cloud_federation_api in appstore
Checked for update of app "cloud_federation_api" in appstore
Checking for update of app comments in appstore
Checked for update of app "comments" in appstore
Checking for update of app contacts in appstore
Checked for update of app "contacts" in appstore
Checking for update of app dav in appstore
Checked for update of app "dav" in appstore
Checking for update of app federatedfilesharing in appstore
Checked for update of app "federatedfilesharing" in appstore
Checking for update of app federation in appstore
Checked for update of app "federation" in appstore
Checking for update of app files in appstore
Checked for update of app "files" in appstore
Checking for update of app files_pdfviewer in appstore
Checked for update of app "files_pdfviewer" in appstore
Checking for update of app files_rightclick in appstore
Update app files_rightclick from appstore
Checked for update of app "files_rightclick" in appstore
Checking for update of app files_sharing in appstore
Checked for update of app "files_sharing" in appstore
Checking for update of app files_trashbin in appstore
Checked for update of app "files_trashbin" in appstore
Checking for update of app files_versions in appstore
Checked for update of app "files_versions" in appstore
Checking for update of app files_videoplayer in appstore
Checked for update of app "files_videoplayer" in appstore
Checking for update of app gallery in appstore
Checked for update of app "gallery" in appstore
Checking for update of app logreader in appstore
Checked for update of app "logreader" in appstore
Checking for update of app lookup_server_connector in appstore
Checked for update of app "lookup_server_connector" in appstore
Checking for update of app nextcloud_announcements in appstore
Checked for update of app "nextcloud_announcements" in appstore
Checking for update of app notifications in appstore
Checked for update of app "notifications" in appstore
Checking for update of app oauth2 in appstore
Checked for update of app "oauth2" in appstore
Checking for update of app password_policy in appstore
Checked for update of app "password_policy" in appstore
Checking for update of app privacy in appstore
Checked for update of app "privacy" in appstore
Checking for update of app provisioning_api in appstore
Checked for update of app "provisioning_api" in appstore
Checking for update of app recommendations in appstore
Checked for update of app "recommendations" in appstore
Checking for update of app serverinfo in appstore
Checked for update of app "serverinfo" in appstore
Checking for update of app sharebymail in appstore
Checked for update of app "sharebymail" in appstore
Checking for update of app support in appstore
Checked for update of app "support" in appstore
Checking for update of app survey_client in appstore
Checked for update of app "survey_client" in appstore
Checking for update of app systemtags in appstore
Checked for update of app "systemtags" in appstore
Checking for update of app text in appstore
Checked for update of app "text" in appstore
Checking for update of app theming in appstore
Checked for update of app "theming" in appstore
Checking for update of app twofactor_backupcodes in appstore
Checked for update of app "twofactor_backupcodes" in appstore
Checking for update of app updatenotification in appstore
Checked for update of app "updatenotification" in appstore
Checking for update of app user_external in appstore
Update app user_external from appstore
Checked for update of app "user_external" in appstore
Checking for update of app viewer in appstore
Checked for update of app "viewer" in appstore
Checking for update of app workflowengine in appstore
Checked for update of app "workflowengine" in appstore
Checking for update of app files_texteditor in appstore
Checked for update of app "files_texteditor" in appstore
Starting code integrity check...
Finished code integrity check
Update successful
Turned off maintenance mode
Reset log level
Installing Z-Push (Exchange/ActiveSync server)...
Installing Mail-in-a-Box system management daemon...
Installing Munin (system monitoring)...
no such table: users<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>

The I can set the password for the me@box.example.com account and the setup script again prints this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>

Nginx is running fine but not the management app:

curl http://127.0.0.1:10222
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>

Do you have any ideas?
Did someone succeeded to migrate from v0.30 -> v0.45?
Maybe it’s just a configuration issue?
For example: should I try to migrate to v0.40 first and then update to each version individually?
I spend now roughly 2,5 days on it and I guess I’m stuck.

Coming in this late to the game migrating from v0.30 to the present you are going to have issues. I haven’t had an opportunity to read through your post yet and won’t for a couple of hours but this post will likely be helpful:

This is the official instructions:

And this is likely what you are going to need …

@alento That’s true, I’m late. The pre v0.30 releases updates went pretty smooth on my side, even when I skipped a version … so I’ve thought it might(hopefully should) work. The second thread/post sounds good and seems to have valuable tips on how to proceed, even though I might need to plan with a little more time for the update to complete.

That being said, I think(I’m pretty sure) I shouldn’t spend no more time on migration directly from v0.30 > v0.45.

Thanks for pointing me into the right direction.

Now, let’s venture into unsupported territory for a bit…

Do any of your users use NextCloud? @biophonc

In otherwords, is NextCloud a make or break proposition? Is an upgrade not including the NC data acceptable? If so, I may have a simplistic plan.

I have some users using nextcloud (including myself) but I can(I’d be fine with it) backup all data and do not need to necessarily migrate it - because no important data would be lost.

A simplistic plan sounds very good. :grin:

I haven’t tried this myself, but did help someone on Slack do this and it did work —

Spin up the new MiaB. Then rsynch the /home/user-data/mail directory from the old box to the new one. Run sudo mailinabox and with luck it should work.

I just actually READ your OP … try moving the nextcloud directories out of the STORAGE ROOT (thus abandoning them) and see if re-running sudo mailinabox goes smoother.

Basically what is happening is that NextCloud installation is failing because the data is in the wrong format for NC. For whatever reason, they change some variable in their database for every version meaning that the database needs to be rewritten between each and every NC version … which usually is handled quite well but for unknown (to me) reasons is failing in your case. If you really want to try to save that data you may find some assistance at the Nextcloud forums https://help.nextcloud.com, but from what you wrote it may be easier for you and your users to back up their NC data and restore it once the MiaB upgrade is in place.