Traccar Docker server not running

Peterkala year ago

I have the latest Docker version of traccar 5.9 and I use watchtower to autoupdate all my containers and obviously Traccar autoupdated and stopped working and giving me this error:

End of classname legend:
========================
    at org.traccar.Main.run(Main.java:154)
    at org.traccar.Main.main(Main.java:114)
Caused by: com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) [Guice/ErrorInCustomProvider]: HikariPool$PoolInitializationException: Failed to initialize pool: Unsupported database file version or invalid file header in file "/opt/traccar/data/database.mv.db" [90048-220]
  at DatabaseModule.provideDataSource(DatabaseModule.java:46)
  at DatabaseStorage.<init>(DatabaseStorage.java:48)
      \_ for 2nd parameter
  while locating DatabaseStorage
  at MainModule.provideStorage(MainModule.java:123)
  while locating Storage
Learn more:
  https://github.com/google/guice/wiki/ERROR_IN_CUSTOM_PROVIDER
1 error
======================
Full classname legend:
======================
DatabaseModule:                         "org.traccar.storage.DatabaseModule"
DatabaseStorage:                        "org.traccar.storage.DatabaseStorage"
HikariPool$PoolInitializationException: "com.zaxxer.hikari.pool.HikariPool$PoolInitializationException"
MainModule:                             "org.traccar.MainModule"
Storage:                                "org.traccar.storage.Storage"
========================
End of classname legend:
========================
    at com.google.inject.internal.InternalProvisionException.toProvisionException(InternalProvisionException.java:251)
    at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1151)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1186)
    at org.traccar.Main.run(Main.java:126)
    ... 1 more
Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Unsupported database file version or invalid file header in file "/opt/traccar/data/database.mv.db" [90048-220]
    at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:596)
    at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:582)
    at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:100)
    at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
    at org.traccar.storage.DatabaseModule.provideDataSource(DatabaseModule.java:79)
    at org.traccar.storage.DatabaseModule$$FastClassByGuice$$1967ea.GUICE$TRAMPOLINE(<generated>)
    at org.traccar.storage.DatabaseModule$$FastClassByGuice$$1967ea.apply(<generated>)
    at com.google.inject.internal.ProviderMethod$FastClassProviderMethod.doProvision(ProviderMethod.java:260)
    at com.google.inject.internal.ProviderMethod.doProvision(ProviderMethod.java:171)
    at com.google.inject.internal.InternalProviderInstanceBindingImpl$CyclicFactory.provision(InternalProviderInstanceBindingImpl.java:185)
    at com.google.inject.internal.InternalProviderInstanceBindingImpl$CyclicFactory.get(InternalProviderInstanceBindingImpl.java:162)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:40)
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:60)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:113)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:300)
    at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1148)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1186)
    at org.traccar.MainModule.provideStorage(MainModule.java:126)
    at org.traccar.MainModule$$FastClassByGuice$$4a4c0.GUICE$TRAMPOLINE(<generated>)
    at org.traccar.MainModule$$FastClassByGuice$$4a4c0.apply(<generated>)
    at com.google.inject.internal.ProviderMethod$FastClassProviderMethod.doProvision(ProviderMethod.java:260)
    at com.google.inject.internal.ProviderMethod.doProvision(ProviderMethod.java:171)
    at com.google.inject.internal.InternalProviderInstanceBindingImpl$CyclicFactory.provision(InternalProviderInstanceBindingImpl.java:185)
    at com.google.inject.internal.InternalProviderInstanceBindingImpl$CyclicFactory.get(InternalProviderInstanceBindingImpl.java:162)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)
    at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1148)
    ... 3 more
Caused by: org.h2.jdbc.JdbcSQLNonTransientConnectionException: Unsupported database file version or invalid file header in file "/opt/traccar/data/database.mv.db" [90048-220]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:690)
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:489)
    at org.h2.message.DbException.get(DbException.java:212)
    at org.h2.mvstore.db.Store.convertMVStoreException(Store.java:158)
    at org.h2.mvstore.db.Store.<init>(Store.java:142)
    at org.h2.engine.Database.<init>(Database.java:324)
    at org.h2.engine.Engine.openSession(Engine.java:92)
    at org.h2.engine.Engine.openSession(Engine.java:222)
    at org.h2.engine.Engine.createSession(Engine.java:201)
    at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:338)
    at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:122)
    at org.h2.Driver.connect(Driver.java:59)
    at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
    at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:359)
    at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
    at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:470)
    at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561)

    ... 33 more
Caused by: org.h2.mvstore.MVStoreException: The write format 2 is smaller than the supported format 3 [2.2.220/5]
    at org.h2.mvstore.DataUtils.newMVStoreException(DataUtils.java:996)
    at org.h2.mvstore.FileStore.getUnsupportedWriteFormatException(FileStore.java:944)
    at org.h2.mvstore.FileStore.processCommonHeaderAttributes(FileStore.java:547)
    at org.h2.mvstore.RandomAccessStore.readStoreHeader(RandomAccessStore.java:227)
    at org.h2.mvstore.FileStore.start(FileStore.java:917)
    at org.h2.mvstore.MVStore.<init>(MVStore.java:289)
    at org.h2.mvstore.MVStore$Builder.open(MVStore.java:2036)
    at org.h2.mvstore.db.Store.<init>(Store.java:133)

    ... 45 more

Can you help me to fix this issue ?

Andya year ago

Hello, I'm facing a similar issue, but while using a Raspberry Pi (arm64). I wanted to update from version 5.8 to 5.9.

Anton Tananaeva year ago

You're using H2 database, so you need to manually migrate the database to the new format. There are several threads about it on the forum and GitHub. Please use search.

Peterkala year ago

I found this post: https://www.traccar.org/forums/topic/error-to-update-to-415/#post-68319

These are the correct and up to date instructions ?

Peterkala year ago

OK.. so in Docker compose file i changed:

services:
  traccar:
    image: traccar/traccar:5.8

and it is working but i have an old version...

the h2-1.4.200.jar seems like registering that my database is newer and sees it as corrupted.

I was able to open H2 Shell "H2 Shell 2.0.206 (2022-01-04)" via command

java -cp ./h2.2022/bin/h2-2.0.206.jar org.h2.tools.Shell

and it worked so I assume I have a new database version 2.0.206 and not the old one 1.4.200.

Anton Tananaeva year ago

That thread is pretty old. There was another format update with this release, so the H2 versions you're using are probably wrong.

Peterkala year ago

Are there some information about updated version of H2 database in release-notes of new traccar instance ?

Why Traccar (docker) cannot make the conversion of H2 database to newer version by itself ?

I understand all commands and processes what I need to do to convert the database from older version H2 to newer version but I need the exact version number of newer database to be able to convert it with Traccar 5.9.

Anton Tananaeva year ago

You can check the database version in the libs folder.

Peterkala year ago

OK, in

cd /opt/traccar/lib/

I see h2-2.1.214.jar

This is for 5.8 Traccar version...

For Traccar version 5.9 I can see:

h2-2.2.220.jar...

So I assume I need to convert my H2 database from version 2.1.214 to 2.2.220.

DevLaba year ago

Upgrade from 5.6 to 5.9

https://github.com/h2database/h2database/releases/download/version-2.2.222/h2-2.2.222.jar
https://github.com/h2database/h2database/releases/download/version-2.1.214/h2-2.1.214.jar
cp /opt/traccar/data/database.mv.db /root/upgrade_DB/data 
cd /root/upgrade_DB/data

backup db using 2.1.214 db driver:

java -cp ../../h2-2.1.214.jar org.h2.tools.Script -url jdbc:h2:./database -user sa -script test.zip -options compression zip

restore test.zip to new db using 2.2.222 db driver (notice ../database):

java -cp ../../h2-2.2.222.jar org.h2.tools.RunScript -url jdbc:h2:../database -user sa -script test.zip -options compression zip

sudo systemctl status traccar
sudo systemctl stop traccar
rm -r /opt/traccar/
wget https://github.com/traccar/traccar/releases/download/v5.9/traccar-linux-64-5.9.zip
unzip ./traccar-linux-64-5.9.zip
./traccar.run
cp root/upgrade_DB/database.mv.db /opt/traccar/data/
systemctl start traccar

systemctl status traccar

● traccar.service - traccar
     Loaded: loaded (/etc/systemd/system/traccar.service; enabled; preset: enabled)
     Active: active (running) since Tue 2023-09-12 12:28:20 UTC; 17s ago
   Main PID: 536873 (java)
      Tasks: 57 (limit: 9394)
     Memory: 574.5M
        CPU: 30.629s
     CGroup: /system.slice/traccar.service
             └─536873 /opt/traccar/jre/bin/java -jar tracker-server.jar conf/traccar.xml

Sep 12 12:28:24 traccar traccar[536873]: Running Changeset: changelog-5.7::changelog-5.7::author
Sep 12 12:28:24 traccar traccar[536873]: Running Changeset: changelog-5.8::changelog-5.8::author
Sep 12 12:28:27 traccar traccar[536873]: Running Changeset: changelog-5.9::changelog-5.9::author
Sep 12 12:28:27 traccar traccar[536873]: UPDATE SUMMARY
Sep 12 12:28:27 traccar traccar[536873]: Run:                          3
Sep 12 12:28:27 traccar traccar[536873]: Previously run:              41
Sep 12 12:28:27 traccar traccar[536873]: Filtered out:                 0
Sep 12 12:28:27 traccar traccar[536873]: -------------------------------
Sep 12 12:28:27 traccar traccar[536873]: Total change sets:           44
Sep 12 12:28:27 traccar traccar[536873]: Liquibase: Update has been successful. Rows affected: 3
STRSHRa year ago

Thanks DevLab, that one solved it for me.