Wrong credentials after updating images

Good morning,

After using Vikunja for a good time (something like a year) by hosting it on a RaspberryPi using Docker, I have decided today to update the images as it was a while.

After that update, I had an issue telling me that the migration of the DB failed (I haven’t noted the error message, sadly). The API image was failing and restarting permanently.
I’ve tried to rollback to older versions, then the migration seemed to work and the applications started properly.

Though, when I’m trying to connect to any account, I now get Wrong username or password.
I’m sure of the identifiers since I’m using a password manager who was still working before the update.

Any idea of what could have gone wrong there?

Thanks in advance!

Anything in the logs? How are you hosting Vikunja? Can you share your config?

Logs:
The logs mainly contains the actual error.
Besides that, only the first line of log puzzle me a bit but it may be legit:

api_1       | info: creating the new user vikunja with 1000:1000
api_1       | usermod: no changes
api_1       | 2023/10/31 13:28:37 No config file found, using default or config from environment variables.
api_1       | 2023-10-31T13:28:37.708378962Z: INFO      ▶ migration/Migrate 052 Ran all migrations successfully.
api_1       | 2023-10-31T13:28:37.708839364Z: INFO      ▶ models/RegisterReminderCron 053 Mailer is disabled, not sending reminders per mail
api_1       | 2023-10-31T13:28:37.709532949Z: INFO      ▶ models/RegisterOverdueReminderCron 054 Mailer is disabled, not sending overdue per mail
api_1       | 2023-10-31T13:28:37.709999315Z: INFO      ▶ cmd/func25 055 Vikunja version v0.21.0
api_1       | ⇨ http server started on [::]:3456
api_1       | 2023-10-31T13:28:57.749061669Z: WEB       ▶ 192.168.1.110  GET 404 /info 111.795µs - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) vikunja-desktop/0.21.0 Chrome/114.0.5735.134 Electron/25.2.0 Safari/537.36                   
api_1       | 2023-10-31T13:28:57.756502682Z: WEB       ▶ 192.168.1.110  GET 200 /api/v1/info 1.025934ms - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) vikunja-desktop/0.21.0 Chrome/114.0.5735.134 Electron/25.2.0 Safari/537.36           
api_1       | 2023-10-31T13:28:57.770896677Z: WEB       ▶ 192.168.1.110  GET 200 /api/v1/info 716.53µs - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) vikunja-desktop/0.21.0 Chrome/114.0.5735.134 Electron/25.2.0 Safari/537.36             
api_1       | 2023-10-31T13:29:05.650005686Z: WEB       ▶ 192.168.1.110  OPTIONS 204 /api/v1/login 29.87µs - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) vikunja-desktop/0.21.0 Chrome/114.0.5735.134 Electron/25.2.0 Safari/537.36         
api_1       | 2023-10-31T13:29:08.079405225Z: ERROR     ▶ v1/Login 0ad Wrong username or password
api_1       | 2023-10-31T13:29:08.080022256Z: WEB       ▶ 192.168.1.110  POST 412 /api/v1/login 2.426501922s - Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) vikunja-desktop/0.21.0 Chrome/114.0.5735.134 Electron/25.2.0 Safari/537.36

Configuration:
Nothing particular.
I suppose it’s the default config, then.

How to host:
I’m just using a docker-compose file with a service for the db, one for the api and one for the frontend.
The only thing I’ve change is the image of the api: vikunja/api:0.21. (I don’t know what was the previous, I was using latest, but I don’t know exactly from when).
It does not contain any login information (except for the DB, but I don’t think that’s related).

Is any of this helpful?

Can you share your docker compose file?

Sure, here it is:

  db:
    image: biarms/mysql:5.7.30-beta-travis
    container_name: vikunja
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    environment:
      MYSQL_ROOT_PASSWORD: --
      Mx-armysql_user: vikunja
      mysql_password: --
      mysql_database: vikunja
    volumes:
      - ./db:/var/lib/mysql
    restart: unless-stopped
  api:
    image: vikunja/api:0.21
    environment:
      vikunja_database_host: db
      vikunja_database_password: --
      vikunja_database_type: mysql
      vikunja_database_user: vikunja
      vikunja_database_database: vikunja
      vikunja_api_secret: --
    ports:
      - 3456:3456
    volumes:
      - ./files:/app/vikunja/files
    depends_on:
      - db
    restart: unless-stopped
  frontend:
    image: vikunja/frontend
    ports:
      - 22301:80
    environment:
      VIKUNJA_API_URL: http://192.168.1.248:3456/api/v1
    restart: unless-stopped

Not entirely sure but the env variables for the api container might need to be uppercase. Can you check if there is data in the mysl database?

Hmm, I’ve tried to uppercase them and it fails with a SQL migration error.
For what it’s worth, it worked like a charm for the last year with this docker-compose.

Regarding the database, it seems there is some data in it. There are many files, for a total of more than 200MB. Not sure what I should look at or how to read these data without the app, though :confused:

Are there any tasks? Check with select * from tasks;

Yes, they seems to be there

Can you enable db logs and check which queries are executed prior to the wrong password error?

Hi,

Sorry for the late answer! Took me a while to have again some time to look into that.
I’ve tried to enable the DB logs as requested but I cannot see any queries when I try to log in.

I was unsure how to do it so I’ve followed this answer.
I think it works because I got some logs while doing some query:

root@3c65d424fd31:/# /usr/bin/tail -f /var/log/mysql/mysql.log
mysqld, Version: 5.7.30-0ubuntu0.18.04.1 ((Ubuntu)). started with:
Tcp port: 3306  Unix socket: /var/run/mysqld/mysqld.sock
Time                 Id Command    Argument
2023-12-15T15:15:50.577525Z	    4 Query	SET global log_output = 'file'
2023-12-15T15:15:57.305688Z	    4 Quit	
2023-12-15T15:18:07.670173Z	    5 Connect	vikunja@localhost on  using Socket
2023-12-15T15:18:07.670585Z	    5 Query	select @@version_comment limit 1
2023-12-15T15:19:06.366131Z	    5 Query	SELECT DATABASE()
2023-12-15T15:19:06.369454Z	    5 Init DB	vikunja
2023-12-15T15:19:07.915061Z	    5 Query	select * from tasks
2023-12-15T15:19:36.666375Z	    5 Quit	

Between these different queries, I’ve tried to log in both from the Web UI and from the desktop application, where I got the ‘Wrong password error’.
Is it some expected output? Did I do something wrong?

Anyway, thanks again for your help!

I actually meant these: Config options | Vikunja

Are your users still in the database? select * from users

Ah sorry!

So first of all, I confirm that my users are still in the database (with select * from users).

Then, following your link I’ve added in my docker-compose:

      VIKUNJA_LOG_DATABASE: stdout
      VIKUNJA_LOG_DATABASELEVEL: DEBUG

And here’s the log preceding the error:

api_1       | 2023-12-15T18:12:33.871690833Z: INFO	▶ [DATABASE] 107 [SQL] SELECT `id`, `name`, `username`, `password`, `email`, `status`, `avatar_provider`, `avatar_file_id`, `issuer`, `subject`, `email_reminders_enabled`, `discoverable_by_name`, `discoverable_by_email`, `overdue_tasks_reminders_enabled`, `overdue_tasks_reminders_time`, `default_project_id`, `week_start`, `language`, `timezone`, `deletion_scheduled_at`, `deletion_last_reminder_sent`, `frontend_settings`, `export_file_id`, `created`, `updated` FROM `users` WHERE (username = ? OR email = ?) LIMIT 1 [<my_username> <my_username>] - 775.659µs

Did you try resting the password?

No, because I actually don’t know how to do it without being connected to my account first.
How do I do this?

While digging a bit more in the documentation, I’ve found CLI | Vikunja so I suppose that must be it (not sure why I haven’t found it the first time :person_shrugging: ).

Anyway, before trying that, I had the curiosity to run vikunja user list first and it seems the users are not there:

2023-12-15T19:13:50.146038997Z: INFO	▶ [DATABASE] 055 [SQL] SELECT `id`, `name`, `username`, `password`, `email`, `status`, `avatar_provider`, `avatar_file_id`, `issuer`, `subject`, `email_reminders_enabled`, `discoverable_by_name`, `discoverable_by_email`, `overdue_tasks_reminders_enabled`, `overdue_tasks_reminders_time`, `default_project_id`, `week_start`, `language`, `timezone`, `deletion_scheduled_at`, `deletion_last_reminder_sent`, `frontend_settings`, `export_file_id`, `created`, `updated` FROM `users` [] - 299.756µs
+----+----------+-------+--------+---------+---------+
| ID | USERNAME | EMAIL | STATUS | CREATED | UPDATED |
+----+----------+-------+--------+---------+---------+
+----+----------+-------+--------+---------+---------+

I confirm they are still in the mysql database.

Could that be that Vikunja actually struggles to access this database somehow?

Looks like it yes. Especially in combination with the empty SQL query log. Can you uppercase the environment variables and try again?

Well, as mentioned earlier, using the uppercase name is leading to a migration error, which may be a step forward actually.

The error is:

api_1       | 2023-12-18T10:09:30.852249507Z: CRITICAL	▶ migration/Migrate 051 Migration failed: migration 20221113170740 failed: Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COLUMN `list_id` TO `project_id`' at line 1

Does it work if you use mysql 8 or mariadb? 5.7 is EOL and not really supported anymore.

Ah, good shot! I’ll try that.
When I’ve started, I actually had a bit of trouble finding an image that was working well for the DB as I’m on arm64 (Raspberry Pi), but I can retry to find one.
If you have a suggestion of a docker image that is working well for arm64 and vikunja API, please let me know. :slight_smile: