Can't log in to gogs

Since installing Version 102 of gogs I’ve been unable to log in to it.

I see there has been a recent thread about being unable to log into Nextcloud due to a change in the Users app. Could it be something similar?

The gogs username is the system user.

What do you select in authentication type? It should be syncloud.
If still what is the login name? admin is a reserved name and cannot be used.
If still failing can you make few attemtps and send logs from Settings - Support right away so we can check?

I selected syncloud as the auth type. I tried with local as well, just in case, but that was obviously not right. I made a couple of attempts to login and then went to Support and sent logs.

The username is trevor. This is the same as the admin username. I can use that username and password to log in to the users app, so that presumably means that I am using the correct password.

I think I’ve done something bad. I tried updating the record in the Users app, with the same password etc, and now I don’t seem to be able to log into nextcloud. I can log into the syncloud app and to the Users app, but trying to log into nextcloud complains about there having been too many login attempts.

My Thunderbird was trying to log in every so often (to get calendar info) and the nextcloud app on the Windows desktop was as well, but both of these are failing so much I shut them down.

Nextcloud now says Wrong Username or Password.

I put in the fix from Login nexcloud Failed - Syncloud and I can now get into Nextcloud. Still can’t get into Gogs.

Yes there is an issue, looks like only happens on arm32, I am adding a few automated tests to reproduce this issue on our build server and try to come up with a fix asap.

working with gogs to find a solution: arm32 ldap login error: unaligned 64-bit atomic operation · Issue #7153 · gogs/gogs · GitHub

1 Like

Hi, I managed to fix arm32 login issue with latest unreleased GOGS version pre v0.13 (hopefully they did not break a lot of other stuff)

You can upgrade as usual but you need to run this command to create a db backup first:

sudo -E -H -u git /snap/gogs/current/postgresql/bin/pg_dumpall.sh -p 5433 -h /var/snap/gogs/common/database -f /var/snap/gogs/current/database.dump

Then upgrade from the store.
Fresh install or future upgrades do bot need the command above.

I’m afraid that hasn’t fixed it. I’m still getting the “Username or password is not correct.” message. I’ve sent you some new logs in case it’s something different causing it.

Can you run the command above and show the output?

root@odroid-xu3and4:~# sudo -E -H -u git /snap/gogs/current/postgresql/bin/pg_dumpall.sh -p 5433 -h /var/snap/gogs/common/database -f /var/snap/gogs/current/database.dump
could not change directory to "/root": Permission denied
root@odroid-xu3and4:~# cd /var/snap/gogs/current
root@odroid-xu3and4:/var/snap/gogs/current# ls -l
total 4752
drwxr-xr-x 2 git git    4096 Sep  7 16:24 config
-rw-r--r-- 1 git git 4858312 Sep  8 15:57 database.dump
root@odroid-xu3and4:/var/snap/gogs/current#

I assumed, despite the error message, that it had worked because the database.dump seems to have been created.

ok, upgrade went ok and you are on latest 157 version right?
if yes can you try to login again and send logs right away?

Yes, I’m on version 157.
I’ve just tried again and sent the logs.

ok, you have an old GOGS install before LDAP auth migrate from uid to cn.

Can you run this command:

/snap/gogs/current/bin/psql.sh -c 'update login_source set cfg = '"'"'{"Host":"localhost","Port":389,"SecurityProtocol":0,"SkipVerify":false,"BindDN":"","BindPassword":"","UserBase":"","UserDN":"cn=%s,ou=users,dc=syncloud,dc=org","AttributeUsername":"cn","AttributeName":"cn","AttributeSurname":"","AttributeMail":"mail","AttributesInBind":false,"Filter":"(\u0026(objectclass=inetOrgPerson)(cn=%s))","AdminFilter":"(objectClass=inetOrgPerson)","GroupEnabled":false,"GroupDN":"","GroupFilter":"","GroupMemberUID":"","UserUID":""}'"'"' where name = '"'"'syncloud'"'"';' gogs

@boris That’s got it! Thanks very much.

Sorry. That got me past logging in, but there is a problem when I try to access any repos. I’m getting a 500 status with messages like

An error has occurred : get commit by path “ArtnetDisplay.sln”: exit status 255 - error: could not lock config file /home/git/.gitconfig: File exists

Application Version: 0.13.0+dev

The file is there. and contains

[user]
        email = gogs@fake.local
        name = Gogs
[core]
        quotepath = false
[init]
        templateDir = /snap/gogs/157/git/usr/share/git-core/templates

The files in that folder are:

drwxr-xr-x 4 git  git  4096 Sep 10 10:21 .
drwxr-xr-x 7 root root 4096 Sep  6  2019 ..
-rw-r--r-- 1 git  git   220 Nov  5  2016 .bash_logout
-rw-r--r-- 1 git  git  3515 Nov  5  2016 .bashrc
-rw-r--r-- 1 git  git   141 Sep 10 10:21 .gitconfig
-rw-r--r-- 1 git  git   675 Nov  5  2016 .profile
drwx------ 2 git  git  4096 Jul  5  2019 .ssh
drwxr-xr-x 3 git  git  4096 Mar 16  2019 snap

I’ve tried rebooting the server, and I also tried renaming the .gitconfig file, but it just created a new one and gave the same error.

unfortunately I do not have the old version of gogs (gogs_20050326_armhf.snap) to test the upgrade.
I think as soon as you push from command line it breaks the UI and I think it only happened after upgrading from that old version. I am still trying add a test to reproduce it with current version to make sure it does not happen for the next upgrade. If the problem is still there I will fix it and release the update if it is not there probably it was only in that old version.

You could wait for an update or you can remove gogs (only if you have all git repos locally) then install it again create empty repos and force push your local copies. OF cause if you have other things like issues or settings they will be lost (if you do not make a backup first).

I was already beginning to think I might need to wipe it and start again. As it happens, for the first time in years, I’m not actually using it day to day at the moment. I thought I had all of it backed up nightly to bundles on my PC (and then off to remote storage) but I hadn’t checked for a while, and the backups haven’t been working, which is rather embarrassing.

(The backups are done on Windows by a Linqpad script run from Task Scheduler. I was using Linqpad 6, but I uninstalled it after putting Linqpad 7 on and didn’t think to search the entire disk for anything using it).

I just tried running the backup script (which uses the api and a pre-existing token) and that still works, so I have backups of all my stuff (although a few other people have stuff on there).

For now, there’s no great urgency about having it running. If I need to use any of the repos I can unbundle them and handle it that way temporarily, so I think I’ll wait and see if a new release sorts it. But if it turns out to not be fixable I can wipe and restart.

I was actually able to reproduce this error and write a test, this is indeed an incorrect way using git on my side in this gogs update, I am trying to fix it and push an update, so if you can wait a day or two maybe you could just update (and maybe delete .gitconfig one more time).