简体   繁体   中英

gnome-terminal doesn't work maybe because of locale setting

I installed Antergos (easy version of Arch) with the Japanese environment. But I wanted to chaned the language to English, so I reffer the wiki article then run some commands after uncomment #en_US.UTF-8 UTF-8 in /etc/locale.gen and edit /etc/locale.conf into following:

LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_PAPER=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_ALL=

The problem starts from here.

I restarted my computer and found that gnome-terminal doesn't work. I substituted eshell on Emacs and run gnome-terminal command, then got error messages:

(process:1202): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.
Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0: Error calling StartServiceByName for org.gnome.Terminal: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.gnome.Terminal exited with status 8

The output of locale command is following:

locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=ja_JP.utf8
LC_TIME=ja_JP.utf8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=ja_JP.utf8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=ja_JP.utf8
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT=ja_JP.utf8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

What changes some part of locale setting into Japanese? Or other reasons which terminate gnome-terminal exist?

I have tried solutions sugestted here https://bbs.archlinux.org/viewtopic.php?id=180103 .

Thank you.

I had the same problem some time ago. I fixed my locale config running this command

sudo localedef -f UTF-8 -i en_US en_US.UTF-8

The meaning of status code 8 is documented on gnome's website here :

The environment that gnome-terminal-server is started with does not correctly set the locale to a UTF-8 locale. Consult your distribution's documentation on how to fix this. Note that is it not relevant to check the locale settings from a different terminal (eg xterm); what counts is the environment that the session dbus-daemon passes to the processes it starts.

So you're right, this is probably due to locale settings. I don't quite understand all the details, but if I set ~/.xinitrc to exec gnome-session and then run startx , I get a similar error to yours.

However, if instead of running startx , I start the gdm display manager (via systemctl start gdm.service on Arch), I can spawn a gnome-terminal correctly. So if you're okay with using gdm, that may be a solution. Lightdm also works, though SLiM doesn't (from my experience).

In the past, I also had to install the vte3 package for gnome-terminal to work, so make sure that's installed as well. And FWIW, sudo gnome-terminal seems to always work.

Did you think to regenerate your locales after you had edited your /etc/locale.gen file ?

locale-gen

I think in your explanation you mixed the /etc/locale.gen and the /etc/locale.conf files. Be sure you edited the correct file with the correct values.

Ok this is how I solved it; sudo locale-gen --purge --no-archive

Then; sudo update-initramfs -u

Nothing with locale worked for me. Once changed back the default python version (3.5 on ubuntu16), terminal worked just fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM