Moulinette broken ( ValueError: unknown locale: UTF-8)

Hi All,

since 1 or two week, my yunohost block (die) with impossible to do anything (ssh connection, website, etc.) I have to restart and for a week, it’s ok.

after a look, it’s seems to be link to the firewall.
on command line, I have that error on lots of command…

pi@yunohost:~ $ sudo yunohost 
Traceback (most recent call last):
  File "/usr/bin/yunohost", line 219, in <module>
    timeout=opts.timeout,
  File "/usr/lib/python2.7/dist-packages/moulinette/__init__.py", line 133, in cli
    'parser_kwargs': parser_kwargs,
  File "/usr/lib/python2.7/dist-packages/moulinette/core.py", line 357, in init_interface
    return interface(amap, **kwargs)
  File "/usr/lib/python2.7/dist-packages/moulinette/interfaces/cli.py", line 352, in __init__
    m18n.set_locale(get_locale())
  File "/usr/lib/python2.7/dist-packages/moulinette/interfaces/cli.py", line 139, in get_locale
    lang = locale.getdefaultlocale()[0]
  File "/usr/lib/python2.7/locale.py", line 543, in getdefaultlocale
    return _parse_localename(localename)
  File "/usr/lib/python2.7/locale.py", line 475, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
pi@yunohost:~ $ ^C

any idea ?

thanks.

Eh that’s weird …

Are you able to reproduce the issue by running this in the command line ?

 python -c "import locale; print( locale.getdefaultlocale())"

yes

pi@yunohost:~ $  python -c "import locale; print( locale.getdefaultlocale())"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/locale.py", line 543, in getdefaultlocale
    return _parse_localename(localename)
  File "/usr/lib/python2.7/locale.py", line 475, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8

Well those locale things are always mysterious to me.

Some stuff on the internet points to running export LC_ALL=en_US.UTF-8 in your terminal, then these should work.

If you want this to be done automatically, you can add this line at the end of your .bashrc file in your user (so e.g. if you’re connected with admin, edit the file with nano /home/admin/.bashrc, add the line at the end of the file, then save/close with Ctrl+X)

1 Like

thanks, it’s help. (but that means, my root cause somewhere else :-D).

You mean the export LC_ALL=en_US.UTF-8 worked ?

About the root cause, well, as said those things are always a bit mysterieous :wink:

Depending on how your system was setup, sometimes those things are configured with default, and sometimes they aren’t … So maybe it’s just related to your hardware/VPS setup, idk… (e.g. maybe your VPS provider doesnt configure locales by default somehow)

1 Like

Hi there,

I would like to mention that I came across the same issue.
For me, it happens some relatively long times after the yunohost installation. It was working properly without any trouble on a raspberry pi 3.
I think this issue arrive after some “working” or “in progress” apps, but unfortunately I was not aware of this soon enough to be more precise.

(I add the line in the .bashrc, thanks :slightly_smiling_face:)