Author Topic: [SOLVED] [CentOS 6.2] setlocale issue  (Read 16577 times)

0 Members and 1 Guest are viewing this topic.

Offline Rick

  • Jr. Member
  • **
  • Posts: 6
  • Karma: 0
  • Gender: Male
  • I've just joined!
    • View Profile
    • Awards
[SOLVED] [CentOS 6.2] setlocale issue
« on: August 02, 2012, 09:58:33 pm »
Hi there,

Dont know if I post at the correct forum but ok. I do have a little 'annoying' issue on my CentOS 6.2 installation.
Every time I connect with SSH or just on the terminal via VMWare vSphere I see this message:

Code: [Select]
-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8)

But I also see it when I run 'make' or 'configure'.

What can I do to fix this?

Thanks in advance!
« Last Edit: August 02, 2012, 11:13:05 pm by Rick »

Offline Mark Greaves (PCNetSpec)

  • Hero Member
  • *****
  • Posts: 18277
  • Karma: 479
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • Awards
Re: [CentOS 6.2] setlocale issue
« Reply #1 on: August 02, 2012, 10:20:59 pm »
Try adding:-

Code: [Select]
export LC_CTYPE="en_US.UTF-8"

to

~/.bash_profile

[EDIT]

Is the locale OK for root ?

The last posting here may be of interest:
https://www.centos.org/modules/newbb/viewtopic.php?topic_id=32334
« Last Edit: August 02, 2012, 10:31:15 pm by Mark Greaves (PCNetSpec) »
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Offline Rick

  • Jr. Member
  • **
  • Posts: 6
  • Karma: 0
  • Gender: Male
  • I've just joined!
    • View Profile
    • Awards
Re: [CentOS 6.2] setlocale issue
« Reply #2 on: August 02, 2012, 10:30:25 pm »
I've added it but it still occurs.

This is the content of the ~/.bash_profile:

Code: [Select]
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
export LC_CTYPE="en_US.UTF-8"

And no this occurs under root

Offline Mark Greaves (PCNetSpec)

  • Hero Member
  • *****
  • Posts: 18277
  • Karma: 479
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • Awards
Re: [CentOS 6.2] setlocale issue
« Reply #3 on: August 02, 2012, 10:32:08 pm »
Take a look at the edit above.

[EDIT]

I also forgot to mention, you'd need to log off/on again before the edit to ~/.bash_profile would take affect.
« Last Edit: August 02, 2012, 10:38:45 pm by Mark Greaves (PCNetSpec) »
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Offline Mark Greaves (PCNetSpec)

  • Hero Member
  • *****
  • Posts: 18277
  • Karma: 479
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • Awards
Re: [CentOS 6.2] setlocale issue
« Reply #4 on: August 02, 2012, 10:49:25 pm »
What's the output from:
Code: [Select]
locale

as both root and your user ?
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Offline Rick

  • Jr. Member
  • **
  • Posts: 6
  • Karma: 0
  • Gender: Male
  • I've just joined!
    • View Profile
    • Awards
Re: [CentOS 6.2] setlocale issue
« Reply #5 on: August 02, 2012, 10:54:38 pm »
I fixed it now using this fix:

Code: [Select]
cat /etc/environment
this file should be empty

Then create it using
Code: [Select]
vi /etc/environment

And add the following lines:

Code: [Select]
LANG=en_US.utf-8
LC_ALL=en_US.utf-8

Offline Mark Greaves (PCNetSpec)

  • Hero Member
  • *****
  • Posts: 18277
  • Karma: 479
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • Awards
Re: [CentOS 6.2] setlocale issue
« Reply #6 on: August 02, 2012, 11:01:44 pm »
Nice .. and thanks for the solution, seems a lot of people are having this issue in CentOS .. and either there are multiple fixes, or conflicting information.
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Offline Rick

  • Jr. Member
  • **
  • Posts: 6
  • Karma: 0
  • Gender: Male
  • I've just joined!
    • View Profile
    • Awards
Re: [CentOS 6.2] setlocale issue
« Reply #7 on: August 02, 2012, 11:06:33 pm »
Yes indeed. But I also see it with Fedora and Debian users.
But the main thing is that this solution works without installing anything etc so.

Think is a generic solution

Offline Mark Greaves (PCNetSpec)

  • Hero Member
  • *****
  • Posts: 18277
  • Karma: 479
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • Awards
Re: [CentOS 6.2] setlocale issue
« Reply #8 on: August 02, 2012, 11:16:49 pm »
Mmm .. seems it's all over the web ???
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Offline Rick

  • Jr. Member
  • **
  • Posts: 6
  • Karma: 0
  • Gender: Male
  • I've just joined!
    • View Profile
    • Awards
Re: [SOLVED] [CentOS 6.2] setlocale issue
« Reply #9 on: August 02, 2012, 11:36:54 pm »
Already tried a few things before I ran into this solution.
But as you also said there some solutions which can conflict with some other things..

But now the solution is also known here :)

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal