Database recovery

I’ve just migrate to version 0.23.0 selfhosted. I’ve recreated my user but my vikunja is empty.
Is there any way to recover my tasks…?
Thanks in advance.

If you check the database, does it still have all the content?

Does it work if you restore from your backup?

Yes, I was using mariadb database and I still have all the content or I could restore from a backup.
But I do not know who to restore?
I’ve been reading but I did not make any backup before upgrading because vikunja-api was crashing.
Could anyone be so kind to let me know how to proceed.
Thanks in advance.

The first thing to check is log files. Mariadb logs should show whether Vikunja is trying to connect. Vikunja logs should show errors. There may even be old vikunja-api logs that will help you know why it was crashing - upgrading clearly hasn’t corrected that problem.

It began crashing after update to last version by watchtower.
I’m attaching my logs to see if anyone could see the issue.

vikunja-db-1
date,stream,content
2024-02-15 19:02:20,stderr,2024-02-15 19:02:20 0 [Note] InnoDB: Buffer pool(s) load completed at 240215 19:02:20
2024-02-15 19:02:20,stderr,Version: ‘10.11.7-MariaDB-1:10.11.7+maria~ubu2204’ socket: ‘/run/mysqld/mysqld.sock’ port: 3306 mariadb.org binary distribution
2024-02-15 19:02:20,stderr,2024-02-15 19:02:20 0 [Note] mariadbd: ready for connections.
2024-02-15 19:02:20,stderr,2024-02-15 19:02:20 0 [Note] Server socket created on IP: ‘::’.
2024-02-15 19:02:20,stderr,2024-02-15 19:02:20 0 [Note] Server socket created on IP: ‘0.0.0.0’.
2024-02-15 19:02:20,stderr,2024-02-15 19:02:20 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
2024-02-15 19:02:20,stderr,2024-02-15 19:02:20 0 [Note] Plugin ‘FEEDBACK’ is disabled.
2024-02-15 19:02:20,stderr,2024-02-15 19:02:20 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2024-02-15 19:02:20,stderr,2024-02-15 19:02:20 0 [Note] InnoDB: log sequence number 390010 transaction id 886
2024-02-15 19:02:20,stderr,2024-02-15 19:02:20 0 [Note] InnoDB: File ‘./ibtmp1’ size is now 12.000MiB.
2024-02-15 19:02:20,stderr,2024-02-15 19:02:20 0 [Note] InnoDB: Setting file ‘./ibtmp1’ size to 12.000MiB. Physically writing the file full Please wait …
2024-02-15 19:02:20,stderr,2024-02-15 19:02:20 0 [Note] InnoDB: 128 rollback segments are active.
2024-02-15 19:02:20,stderr,2024-02-15 19:02:20 0 [Note] InnoDB: End of log at LSN=390010
2024-02-15 19:02:20,stderr,2024-02-15 19:02:20 0 [Note] InnoDB: Buffered log writes (block size=512 bytes)
2024-02-15 19:02:20,stderr,2024-02-15 19:02:20 0 [Note] InnoDB: Completed initialization of buffer pool
2024-02-15 19:02:20,stderr,2024-02-15 19:02:20 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB

vikunja-vikunja-1
date,stream,content
“2024-02-15 19:02:51,stdout,”“2024-02-15T19:02:51.514561712Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/tasks/all?sort_by=due_date&sort_by=id&order_by=asc&order_by=desc&filter_by=done&filter_value=false&filter_comparator=equals&filter_concat=and&filter_include_nulls=false&page=1 7.458801ms - Mozilla/5.0 (Windows NT 10.0” Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:50,stdout,2024-02-15T19:02:50.994543458Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/tasks/all?sort_by=due_date&sort_by=id&order_by=asc&order_by=desc&filter_by=done&filter_value=false&filter_comparator=equals&filter_concat=and&filter_include_nulls=false&page=1 7.043082ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:50,stdout,2024-02-15T19:02:50.98825311Z: WEB ▶ 192.168.128.1 GET 200 /api/v1/avatar/venega?size=50&=1708023771398 897.158µs - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:50,stdout,2024-02-15T19:02:50.978628961Z: WEB ▶ 192.168.128.1 GET 200 /api/v1/user 962.985µs - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:50,stdout,2024-02-15T19:02:50.977506485Z: WEB ▶ 192.168.128.1 GET 200 /api/v1/avatar/venega?size=50&=1708023771385 855.296µs - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:50,stdout,2024-02-15T19:02:50.96663877Z: WEB â–¶ 192.168.128.1 POST 200 /api/v1/user/token 1.278016ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:50,stdout,2024-02-15T19:02:50.748190302Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/tasks/all?sort_by=due_date&sort_by=id&order_by=asc&order_by=desc&filter_by=done&filter_value=false&filter_comparator=equals&filter_concat=and&filter_include_nulls=false&page=1 7.48172ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:49,stdout,2024-02-15T19:02:49.403363038Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/tasks/all?sort_by=due_date&sort_by=id&order_by=asc&order_by=desc&filter_by=done&filter_value=false&filter_comparator=equals&filter_concat=and&filter_include_nulls=false&page=1 4.689492ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:46,stdout,2024-02-15T19:02:46.091405312Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/tasks/all?sort_by=due_date&sort_by=id&order_by=asc&order_by=desc&filter_by=done&filter_value=false&filter_comparator=equals&filter_concat=and&filter_include_nulls=false&page=1 6.671414ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:46,stdout,2024-02-15T19:02:46.084385661Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/projects?is_archived=true&page=1 10.230247ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:46,stdout,2024-02-15T19:02:46.083652156Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/notifications?page=1 1.248133ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:46,stdout,2024-02-15T19:02:46.076777524Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/labels?page=1 8.127253ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:46,stdout,2024-02-15T19:02:46.046155811Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/avatar/venega?size=50&=1708023766354 1.263593ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:45,stdout,2024-02-15T19:02:45.933800068Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/user 1.346857ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:45,stdout,2024-02-15T19:02:45.91215828Z: WEB â–¶ 192.168.128.1 POST 200 /api/v1/login 289.462646ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:33,stdout,2024-02-15T19:02:33.339663065Z: WEB ▶ 192.168.128.1 GET 200 /api/v1/avatar/venega?size=50&=1708023753749 908.4µs - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:33,stdout,2024-02-15T19:02:33.330771849Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/user 2.069514ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:33,stdout,2024-02-15T19:02:33.32942546Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/avatar/venega?size=50&=1708023753738 1.418286ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:33,stdout,2024-02-15T19:02:33.317168961Z: WEB â–¶ 192.168.128.1 POST 200 /api/v1/user/token 1.345522ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:32,stdout,2024-02-15T19:02:32.759083041Z: WEB ▶ 192.168.128.1 GET 304 /assets/OpenSans-Italic_wght__c9a8fe68-MZ2snjxx.woff2 654.24µs - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:32,stdout,2024-02-15T19:02:32.710854891Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/projects/1 4.266342ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:32,stdout,2024-02-15T19:02:32.709384389Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/projects/1/tasks?sort_by=position&order_by=asc&filter_by=done&filter_value=false&filter_comparator=equals&filter_concat=and&page=1 2.791702ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:32,stdout,2024-02-15T19:02:32.641626973Z: WEB ▶ 192.168.128.1 GET 304 /assets/ProjectList-qm15u6OH.css 401.6µs - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:32,stdout,2024-02-15T19:02:32.641202018Z: WEB ▶ 192.168.128.1 GET 304 /assets/pagination-11cjot2M.css 204.949µs - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:32,stdout,2024-02-15T19:02:32.640882985Z: WEB ▶ 192.168.128.1 GET 304 /assets/pagination-Oo72CNE-.js 478.705µs - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:32,stdout,2024-02-15T19:02:32.640673081Z: WEB ▶ 192.168.128.1 GET 304 /assets/nothing-Y-P4oLiO.js 455.034µs - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:32,stdout,2024-02-15T19:02:32.640570391Z: WEB ▶ 192.168.128.1 GET 304 /assets/ProjectList-K68UwaRw.js 558.129µs - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:28,stdout,2024-02-15T19:02:28.364245663Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/tasks/all?sort_by=due_date&sort_by=id&order_by=asc&order_by=desc&filter_by=done&filter_value=false&filter_comparator=equals&filter_concat=and&filter_include_nulls=false&page=1 10.235326ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:28,stdout,2024-02-15T19:02:28.356804105Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/avatar/venega?size=50&=1708023748609 76.885219ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:28,stdout,2024-02-15T19:02:28.309779238Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/notifications?page=1 1.853623ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:28,stdout,2024-02-15T19:02:28.306147145Z: WEB ▶ 192.168.128.1 GET 304 /assets/Quicksand_wght__87bdcc7f-h-EywySu.woff2 648.158µs - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:28,stdout,2024-02-15T19:02:28.303529144Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/projects?is_archived=true&page=1 12.525837ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:28,stdout,2024-02-15T19:02:28.301093173Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/labels?page=1 10.197699ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:28,stdout,2024-02-15T19:02:28.183368946Z: WEB â–¶ 192.168.128.1 GET 200 /api/v1/user 1.788588ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:28,stdout,2024-02-15T19:02:28.143858689Z: WEB ▶ 192.168.128.1 GET 200 /api/v1/info 823.517µs - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:28,stdout,2024-02-15T19:02:28.134807932Z: WEB â–¶ 192.168.128.1 GET 304 /assets/OpenSans_wght__54a65da5-UqCmZOxj.woff2 3.001693ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:27,stdout,2024-02-15T19:02:27.522417349Z: WEB â–¶ 192.168.128.1 GET 304 /assets/es-ES-1e8oASxA.js 26.940753ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:27,stdout,2024-02-15T19:02:27.174071505Z: WEB â–¶ 192.168.128.1 GET 304 /assets/index-VlJ-wnF6.css 2.599959ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:27,stdout,2024-02-15T19:02:27.169021937Z: WEB â–¶ 192.168.128.1 GET 304 /assets/index-9Lu9q13r.js 55.534167ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
"
2024-02-15 19:02:27,stdout,2024-02-15T19:02:27.037825915Z: WEB â–¶ 192.168.128.1 GET 304 / 1.056789ms - Mozilla/5.0 (Windows NT 10.0" Win64 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36

There don’t seem to be any errors there. The database appears to be starting successfully and Vikunja seems to be serving content to safari.

  • Are these just the last logs before the crashing started?
  • What exactly do you mean by crashing? I’d assumed you meant the Docker containers on the server but do you actually mean the browser?
  • If the latter please try a browser other than Safari (eg Try Firefox or Vivaldi).

I meant the docker container. Just crashed when 0.23.0 went out.
I follow the proccess described to make it work but database was lost.
Even registered client so I recreated using cli but the database is still lost.
I’ve the mariadb log only for the current day (I don’t know why)
I don’t know why is Safari in the logs because I’m using Chrome to access vikunja.

The user is stored in the database, so if the database is gone, the user is gone. Restore the database from a backup and your user should be back.

Recreating the user is just starting fresh again, this new user will be lost if you restore the database.

The mariadb log is only from today because that’s Docker default. IIRC it’s only since the container was last launched. You can configure the log to be kept longer, stored elsewhere, but if you hadn’t done that before it’s no help now. (I run Vikunja in Podman using systemd services and have logs in the systemd journal - I’d forgotten what Docker default was like, sorry.)

So if you have a database backup from before the crash you should concentrate on getting that restored. But I worry about how you ‘lost’ the database, it sounds like you may not have configured persistent storage for it in Docker…

If you’re not very experienced in dealing with databases you may find a tool like Adminer helpful though it’s a bit of a pain to set up.

I only have backups from mariadb docker folder. Is this a proper backup?

If it is, how could I restore the database from a backup?

Assuming you defined docker volumes like the example in vikunja docs, it should be a simple case of replacing the new folder with the old.

I can’t give exact commands because I don’t know the details of your setup but something like:

  • Stop the vikunja and mariadb containers
  • move the db folder aside mv db db-broken
  • copy the backup folder into its place cp -R db-backup db
  • check that the permissions on the db folder now match those on db-broken and modify them with chown and chmod as necessary.
  • start the db and vikunja containers back up again

Does that make sense?

I’ve restored a copy of mariadb folder (which was only used for vikunja) and checked permissions but

2024-02-20T17:15:18.242494049Z: INFO :arrow_forward: config/InitConfig 001 No config file found, using default or config from environment variables. stdout

17:15:18 2024-02-20T17:15:18.357845238Z: INFO :arrow_forward: migration/Migrate 05b Ran all migrations successfully. stdout

17:15:18 2024-02-20T17:15:18.358020417Z: INFO :arrow_forward: models/RegisterReminderCron 05c Mailer is disabled, not sending reminders per mail stdout

17:15:18 2024-02-20T17:15:18.358095612Z: INFO :arrow_forward: models/RegisterOverdueReminderCron 05d Mailer is disabled, not sending overdue per mail stdout

17:15:18 2024-02-20T17:15:18.358292155Z: INFO :arrow_forward: cmd/func29 05e Vikunja version v0.23.0 stdout

17:15:18 ⇨ http server started on [:1234:

No config file found must be the issue.
Once restored I don’t recognize my old user.

The “No config file found” can be ignored. You can configure Vikunja via a config file but you can also use Docker environment variables, which is what the Docker compose examples do and what that message tells you it’s doing. It’s normal for Vikunja to put that in the log.

I’d say the next step is to check what is in the database you restored. The mariadb docker page has examples of how to log into the container on the command line, scroll down to the section “Connect to MariaDB from the MariaDB command line client”.

That same page has a Docker compose example including Adminer if you prefer a GUI for the database.

Either way you need to figure out whether your restored database actually containers you previous user and tasks.