Unable to login to my Gitea instance (UI, admin...) - facing 500 error
-
Hey folks
I've checked if the issue arises recently to anyone before publishing this error report but couldn't find any recent related issue.
I'm not able to authenticate nor reset password for my Gitea app and I'm clueless on what to do to fix things.
I've tried resetting the password of my Gitea user using command-line but that's not enough.Context: User/Password seem accepted by Gitea but the 2FA seems broken as I always end up with a 500 error.
Logs only mention :Feb 14 17:46:332024/02/14 16:46:33 ...ters/web/auth/2fa.go:80:TwoFactorPost() [E] UserSignIn: not in LinkAccount session
I've tried also clearing all cookies, or using Private/Incognito browser mode, but didn't help.
I've tried resetting my password but I never receive any email from Gitea.It seems the error was already mentioned in the past years :
Any clue how to fix this ? Can we disable 2FA ?
I didn't touch the Gitea configuration recently, except changing the username but I could login without issue until recently.
Thanks in advance for any clue.
Recently I had a few automatic reboots of Gitea following out of memory errors.In the past weeks I had encountered the error (500) occasionnaly but I could usually log in again using Incognito mode.
-
Are you using Cloudron usermanagment or is that user a Gitea local user? Tbh I don't know if changing usernames is working well for the app, most apps can't deal with this easily.
Also do you know with which update this started and can if you restore the app to before that, does it work again? -
-
Thank you for your support and feedback already ! I'm not sure when it started, but I see in my browser history I encountered 2FA errors regularly since I started using Gitea.
I'm using Cloudron based login but I'm unsure if the login/password flow ever worked using a local gitea user.
Do I need to backup my git repos etc if I restore the app to a previous state ? I'm unsure what are the risks associated with this process like losing or breaking things as I never used this functionality in the past. -
So if you use Cloudron user management, you actually don't need gitea 2fa setup, since the app is integrated with OpenID by now and thus the 2fa setup from Cloudron itself is used.
If you run
sudo -u git /home/git/gitea/gitea -c /run/gitea/app.ini admin user list
in the webterminal, do you see that user with 2FA enabled? Sadly it seems it does not show if a user is local or from an external auth source, also I haven't yet found a cli method to disable 2FA, but maybe if you can login with a local admin user you can remove 2FA for your main user?Regarding the restore, it would restore all data to the state of that backup, note that each backup is associated with an app package version, which will also be restored accordingly. If you want to be very sure first, you could also use the clone from backup feature and perform some testing in a test instance.
-
Thanks ! Running this command shows a single account as a result
root@a45580f2-9906-49b6-a090-476ecd0ec3ac:/home/git# sudo -u git /home/git/gitea/gitea -c /run/gitea/app.ini admin user list ID Username Email IsActive IsAdmin 2FA 1 sansguidon morgan@zoemp.be true true true
What I have done to solve the problem :
- From the terminal I've created an admin user
root@a45580f2-9906-49b6-a090-476ecd0ec3ac:/home/git# sudo -u git /home/git/gitea/gitea -c /run/gitea/app.ini admin user create --username redacted --password redacted --admin --email redacted New user 'superadmin' has been successfully created!
- I've logged into Gitea with the newly created admin user with just the username and password provided and have proceeded immediately to change the password as expected.
- Via https://gitea.my.domain/admin/users I find a way to edit my other blocked user and update the authentication source to
cloudron
, reset the 2FA, and link it with the Cloudron account by setting the username so once the account is updated, Gitea shows 2FA is disabled for that account. - When I login either by username/password or via Cloudron it works immediately.
-
-
With pleasure ! And and in the end I've deleted the new admin account because I'm paranoid
root@a45580f2-9906-49b6-a090-476ecd0ec3ac:/home/git# sudo -u git /home/git/gitea/gitea -c /run/gitea/app.ini admin user list ID Username Email IsActive IsAdmin 2FA 1 sansguidon morgan@zoemp.be true true false 3 superadmin bonjour@zoemp.be true true false root@a45580f2-9906-49b6-a090-476ecd0ec3ac:/home/git# sudo -u git /home/git/gitea/gitea -c /run/gitea/app.ini admin user delete Command error: You must provide the id, username or email of a user to delete root@a45580f2-9906-49b6-a090-476ecd0ec3ac:/home/git# sudo -u git /home/git/gitea/gitea -c /run/gitea/app.ini admin user delete --id 3 2024/02/15 14:46:55 ...s/storage/storage.go:176:initAttachments() [I] Initialising Attachment storage with type: local 2024/02/15 14:46:55 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /app/data/appdata/attachments 2024/02/15 14:46:55 ...s/storage/storage.go:166:initAvatars() [I] Initialising Avatar storage with type: local 2024/02/15 14:46:55 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /app/data/appdata/avatars 2024/02/15 14:46:55 ...s/storage/storage.go:192:initRepoAvatars() [I] Initialising Repository Avatar storage with type: local 2024/02/15 14:46:55 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /app/data/appdata/repo-avatars 2024/02/15 14:46:55 ...s/storage/storage.go:198:initRepoArchives() [I] Initialising Repository Archive storage with type: local 2024/02/15 14:46:55 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /app/data/appdata/repo-archive 2024/02/15 14:46:55 ...s/storage/storage.go:208:initPackages() [I] Initialising Packages storage with type: local 2024/02/15 14:46:55 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /app/data/appdata/packages 2024/02/15 14:46:55 ...s/storage/storage.go:219:initActions() [I] Initialising Actions storage with type: local 2024/02/15 14:46:55 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /app/data/appdata/actions_log 2024/02/15 14:46:55 ...s/storage/storage.go:223:initActions() [I] Initialising ActionsArtifacts storage with type: local 2024/02/15 14:46:55 ...les/storage/local.go:33:NewLocalStorage() [I] Creating new Local Storage at /app/data/appdata/actions_artifacts root@a45580f2-9906-49b6-a090-476ecd0ec3ac:/home/git# sudo -u git /home/git/gitea/gitea -c /run/gitea/app.ini admin user list ID Username Email IsActive IsAdmin 2FA 1 sansguidon morgan@zoemp.be true true false