#1725  Failure upgrading from 8.2.7 to 9.2.0+
Closed
addiejewoah opened 1 month ago

It's been a while since I've updated the bare-metal (Ubuntu) server installation, which is still running on 8.2.7 using an external MySQL database without problems. I've followed the upgrade guide: https://docs.onedev.io/upgrade-guide/bare-metal, but I can't upgrade, I get the following error:

/opt % sudo /opt/onedev-9.7.0/bin/upgrade.sh /opt/onedev
Running OneDev Upgrade...
--> Wrapper Started as Console
Java Service Wrapper Standard Edition 64-bit 3.5.51
  Copyright (C) 1999-2022 Tanuki Software, Ltd. All Rights Reserved.
    http://wrapper.tanukisoftware.com
  Licensed to OneDev for Service Wrapping

Launching a JVM...
WrapperManager: Initializing...
default THREAD FACTORY
INFO  - Launching application from '/opt/onedev-9.7.0'...
INFO  - Cleaning temp directory...
INFO  - Starting application...
INFO  - Upgrading /opt/onedev...
ERROR - >>> Error: Could not find or load main class com.gitplex.commons.bootstrap.Bootstrap
ERROR - >>> Caused by: java.lang.ClassNotFoundException: com.gitplex.commons.bootstrap.Bootstrap
ERROR - Unable to upgrade specified installation due to above error
INFO  - Stopping application...
<-- Wrapper Stopped

This probably is because the versions lie too far apart. I'd hoped to install some late 8.X.X version or early 9.X.X version as an intermediate upgrade step, but the oldest still available build is 9.2.0, which gives the same error:

/opt % sudo /opt/onedev-9.2.0/bin/upgrade.sh /opt/onedev
Running OneDev Upgrade...
--> Wrapper Started as Console
Java Service Wrapper Standard Edition 64-bit 3.5.51
  Copyright (C) 1999-2022 Tanuki Software, Ltd. All Rights Reserved.
    http://wrapper.tanukisoftware.com
  Licensed to OneDev for Service Wrapping

Launching a JVM...
WrapperManager: Initializing...
INFO  - Launching application from '/opt/onedev-9.2.0'...
INFO  - Cleaning temp directory...
INFO  - Starting application...
INFO  - Upgrading /opt/onedev...
ERROR - >>> Error: Could not find or load main class com.gitplex.commons.bootstrap.Bootstrap
ERROR - >>> Caused by: java.lang.ClassNotFoundException: com.gitplex.commons.bootstrap.Bootstrap
ERROR - Unable to upgrade specified installation due to above error
INFO  - Stopping application...
<-- Wrapper Stopped

The 9.7.0 service installs fine, but cannot start because of the data version mismatch.

...
21:35:11 INFO  i.onedev.commons.bootstrap.Bootstrap - Launching application from '/opt/onedev-9.7.0'...
21:35:11 INFO  i.onedev.commons.bootstrap.Bootstrap - Cleaning temp directory...
21:35:12 INFO  io.onedev.commons.loader.AppLoader - Starting application...
TERM trapped.  Shutting down.
21:35:28 ERROR i.onedev.commons.bootstrap.Bootstrap - Error booting application
io.onedev.commons.utils.ExplicitException: Data version mismatch (app data version: 152, db data version: 122)
...

How best to tackle this problem? Making a backup of the data on the old version and trying to import/restore that backup in the newer version using restore-db.sh gives the same data version mismatch error. Do I need older builds to run multiple upgrades using in-between versions? And if so, where to get them since https://code.onedev.io/onedev/server/~builds does not show older builds than 9.2.0. Thank you for you time!

FYI: these are the /opt folder contents:

total 24K
drwxr-xr-x  6 root   root   4.0K Jan 24 21:40 .
drwxr-xr-x 19 root   root   4.0K Jan 29  2023 ..
drwxr-xr-x 13 onedev onedev 4.0K Jan 24 21:40 onedev              // active installation (8.2.7)
drwxr-xr-x 12 onedev onedev 4.0K Jan 24 22:03 onedev-10.0.0
drwxr-xr-x 13 onedev onedev 4.0K Jan 24 21:03 onedev-8.2.7
drwxr-xr-x 12 onedev onedev 4.0K Jan 24 21:03 onedev-9.2.0
drwxr-xr-x 13 onedev onedev 4.0K Jan 24 21:24 onedev-9.7.0
Robin Shen commented 1 month ago

Are you still able to start 8.2.7?

addiejewoah commented 1 month ago

Yes, that still runs flawlessly after restarting it.

Robin Shen commented 1 month ago

Please check if your OneDev 8.2.7 root directory has file release.properties, and that file contains a version property with value 8.2.7. If not, that file might get deleted for some reason, and you may copy attached file to that directory and try upgrade again

release.properties

addiejewoah commented 1 month ago

Wow, great find! I now upgraded without issue restoring that file. The root directory had a release.properties_BAK file (no release.properties file). This looks like my own naming-convention when creating a backup copy of a file (postfix with '_BAK'). Apparently I had issues with the installation and renaming/removing that file fixed something? I wouldn't know why else I'd rename such a file. It's been a while, else I would've remembered. Thus, an error/oversight on my side. I'm terribly sorry for spending your time on the problem I created myself. But many thanks for pointing out the cause!

Robin Shen changed state to 'Closed' 1 month ago
Previous Value Current Value
Open
Closed
Robin Shen commented 1 month ago

No problem. Closing this now.

issue 1 of 1
Type
Question
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (3)
Reference
onedev/server#1725
Please wait...
Page is in error, reload to recover