Error with locale when pushing git over ssh

Recenlty I switched to RhodeCode. I installed it on a new Debian Buster virtual machine. RhodeCode is running fine for Mercurial. But when I try to push a git repository over SSH an error occured. Pushing git over https is working well. Also pulling and cloning git over SSH are working.

Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 222 bytes | 111.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Traceback (most recent call last): remote: File “hooks/pre-receive”, line 10, in
remote: from vcsserver import hooks
remote: File “/opt/rhodecode/store/gw4159sv035nv616qkpc7m5vhhf9asn8-python2.7-rhodecode-vcsserver-4.17.3/lib/python2.7/site-packages/vcsserver/hooks.py”, line 36, in
remote: from vcsserver.hgcompat import get_ctx
remote: File “/opt/rhodecode/store/gw4159sv035nv616qkpc7m5vhhf9asn8-python2.7-rhodecode-vcsserver-4.17.3/lib/python2.7/site-packages/vcsserver/hgcompat.py”, line 31, in
remote: from mercurial import extensions
remote: File “/opt/rhodecode/store/s4nnxsslk0x3frd51nrnadk5jfh4fh6k-python2.7-mercurial-4.9.1/lib/python2.7/site-packages/mercurial/extensions.py”, line 22, in
remote: from . import (
remote: File “/opt/rhodecode/store/s4nnxsslk0x3frd51nrnadk5jfh4fh6k-python2.7-mercurial-4.9.1/lib/python2.7/site-packages/mercurial/cmdutil.py”, line 23, in
remote: from . import (
remote: File “/opt/rhodecode/store/s4nnxsslk0x3frd51nrnadk5jfh4fh6k-python2.7-mercurial-4.9.1/lib/python2.7/site-packages/mercurial/crecord.py”, line 33, in
remote: locale.setlocale(locale.LC_ALL, u’’)
remote: File “/opt/rhodecode/store/6rjyfgq8yrnzwsc4x9b6mlwi6h9qhay6-python-2.7.15/lib/python2.7/locale.py”, line 581, in setlocale
remote: return _setlocale(category, locale)
remote: locale.Error: unsupported locale setting To ssh://HOSTNAME/GROUP/REPO
! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to ‘ssh://USER@HOSTNAME/GROUP/REPO’

Things I already tried:
Download locale archive (https://issues.rhodecode.com/issues/5297#note-12) and add LOCALE_ARCHIVE environment to the .bashrc of the user running RhodeCode, also tried supervisor.ini
Also tried setting LC_ALL=C in supervisor.ini.

Hi,

This is a know issue with never operating systems shipping with later glibc. Please check this:

https://docs.rhodecode.com/RhodeCode-Enterprise/known-issues/known-issues.html#fedora-23-ubuntu-18-04

Hi marcin,

Thanks for your answer.
Made the changes again in supervisor.ini, also tried setting in the start up script. Rebooted the machine. Still getting the error. Is theire away to check if Rhodecode is receiving the new environment variables?

Not really, but it could be ssh issue, could you also post locale command output on your machine ?

We also think possibly in the begining of the file above we could add this as we do for HTTP protocol.

# due to Mercurial/glibc2.27 problems we need to detect if locale settings are
# causing problems and "fix" it in case they do and fallback to LC_ALL = C
try:
    locale.setlocale(locale.LC_ALL, '')
except locale.Error as e:
    log.error(
        'LOCALE ERROR: failed to set LC_ALL, fallback to LC_ALL=C, org error: %s', e)
    os.environ['LC_ALL'] = 'C'

The git client machine is Windows.

chcp = 850

In /opt/rhodecode/store/gw4159sv035nv616qkpc7m5vhhf9asn8-python2.7-rhodecode-vcsserver-4.17.3/lib/python2.7/site-packages/vcsserver/hooks.py I added

import locale
# due to Mercurial/glibc2.27 problems we need to detect if locale settings are
# causing problems and "fix" it in case they do and fallback to LC_ALL = C
try:
    locale.setlocale(locale.LC_ALL, '')
except locale.Error as e:
    log.error('LOCALE ERROR: failed to set LC_ALL, fallback to LC_ALL=C, org error: %s', e)
    os.environ['LC_ALL'] = 'C'

I needed the extra import locale because otherwise it was failing to start. After restarting rhodecode issue still exists.