Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 241
tubo Avatar asked Jan 10 '23 05:01

tubo


2 Answers

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
like image 107
Frederico Cabral Avatar answered Mar 05 '23 19:03

Frederico Cabral


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 (e.g. 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.

like image 34
Ponkadoodle Avatar answered Mar 05 '23 18:03

Ponkadoodle