LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-19-2014, 07:25 AM   #1
schmatzler
Member
 
Registered: Jan 2011
Location: Germany
Distribution: Slackware64 -current + Multilib
Posts: 411

Rep: Reputation: 181Reputation: 181
System locale broken


I just booted up my Slackware and my system locale is broken. Apparently there are some PATH variables garbled into it. When I run "locale" on a terminal I get this weird output:

Code:
locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=de_DE.utf8PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/blender:/usr/lib64/java/bin:/usr/lib64/java/jre/bin:/usr/lib64/kde4/libexec:/usr/lib64/qt/bin:/usr/share/texmf/bin
LC_CTYPE="de_DE.utf8PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/blender:/usr/lib64/java/bin:/usr/lib64/java/jre/bin:/usr/lib64/kde4/libexec:/usr/lib64/qt/bin:/usr/share/texmf/bin"
LC_NUMERIC="de_DE.utf8PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/blender:/usr/lib64/java/bin:/usr/lib64/java/jre/bin:/usr/lib64/kde4/libexec:/usr/lib64/qt/bin:/usr/share/texmf/bin"
LC_TIME="de_DE.utf8PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/blender:/usr/lib64/java/bin:/usr/lib64/java/jre/bin:/usr/lib64/kde4/libexec:/usr/lib64/qt/bin:/usr/share/texmf/bin"
LC_COLLATE=C
LC_MONETARY="de_DE.utf8PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/blender:/usr/lib64/java/bin:/usr/lib64/java/jre/bin:/usr/lib64/kde4/libexec:/usr/lib64/qt/bin:/usr/share/texmf/bin"
LC_MESSAGES="de_DE.utf8PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/blender:/usr/lib64/java/bin:/usr/lib64/java/jre/bin:/usr/lib64/kde4/libexec:/usr/lib64/qt/bin:/usr/share/texmf/bin"
LC_PAPER="de_DE.utf8PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/blender:/usr/lib64/java/bin:/usr/lib64/java/jre/bin:/usr/lib64/kde4/libexec:/usr/lib64/qt/bin:/usr/share/texmf/bin"
LC_NAME="de_DE.utf8PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/blender:/usr/lib64/java/bin:/usr/lib64/java/jre/bin:/usr/lib64/kde4/libexec:/usr/lib64/qt/bin:/usr/share/texmf/bin"
LC_ADDRESS="de_DE.utf8PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/blender:/usr/lib64/java/bin:/usr/lib64/java/jre/bin:/usr/lib64/kde4/libexec:/usr/lib64/qt/bin:/usr/share/texmf/bin"
LC_TELEPHONE="de_DE.utf8PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/blender:/usr/lib64/java/bin:/usr/lib64/java/jre/bin:/usr/lib64/kde4/libexec:/usr/lib64/qt/bin:/usr/share/texmf/bin"
LC_MEASUREMENT="de_DE.utf8PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/blender:/usr/lib64/java/bin:/usr/lib64/java/jre/bin:/usr/lib64/kde4/libexec:/usr/lib64/qt/bin:/usr/share/texmf/bin"
LC_IDENTIFICATION="de_DE.utf8PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/blender:/usr/lib64/java/bin:/usr/lib64/java/jre/bin:/usr/lib64/kde4/libexec:/usr/lib64/qt/bin:/usr/share/texmf/bin"
I just looked into my home folder, but there is nothing suspicious in the .bashrc, only this (which I need for building Android):

Code:
export CCACHE_DIR=/ccache
export USE_CCACHE=1
In /etc/profile.d/lang.sh: Also nothing suspicious, just this:

Code:
#!/bin/sh
# Set the system locale.  (no, we don't have a menu for this ;-)
# For a list of locales which are supported by this machine, type:
#   locale -a

# en_US is the Slackware default locale:
export LANG=de_DE

# 'C' is the old Slackware (and UNIX) default, which is 127-bit
# ASCII with a charmap setting of ANSI_X3.4-1968.  These days,
# it's better to use en_US or another modern $LANG setting to
# support extended character sets.
#export LANG=C

# There is also support for UTF-8 locales, but be aware that
# some programs are not yet able to handle UTF-8 and will fail to
# run properly.  In those cases, you can set LANG=C before
# starting them.  Still, I'd avoid UTF unless you actually need it.
export LANG=de_DE.utf8

# Another option for en_US:
#export LANG=en_US.ISO8859-1

# One side effect of the newer locales is that the sort order
# is no longer according to ASCII values, so the sort order will
# change in many places.  Since this isn't usually expected and
# can break scripts, we'll stick with traditional ASCII sorting.
# If you'd prefer the sort algorithm that goes with your $LANG
# setting, comment this out.
export LC_COLLATE=C

# End of /etc/profile.d/lang.sh
I'm kind of lost at the moment - but I guess you guys have some more ideas how to fix this, right?

Edit: I just noted that when I do "export LANG=de_DE.utf8" all the errors vanish. But it should run fine right after the boot.

Last edited by schmatzler; 02-20-2014 at 10:38 AM.
 
Old 02-19-2014, 07:56 AM   #2
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,873

Rep: Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982Reputation: 4982
Looks like one of your profile/environment files is missing a newline between:
LANG= and PATH= assignments.

I'd suggest trying to track it down with a "grep -R 'LANG=' /etc" and see if anything obvious shows up.
 
Old 02-19-2014, 08:25 AM   #3
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Your /etc/profile.d/lang.sh file has two settings (there should only be one and that may be your problem):
Code:
export LANG=de_DE
and
export LANG=de_DE.utf8
You may want to use the UTF-8 setting and try commenting-out export LANG=de_DE.

You will need to log out and log back in again for the change to take effect.

That may cure one or perhaps both problems; typing locale should produce something like this:
Code:
locale
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=C
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=
All the PATH= should not be there.

Hope this helps some.
 
Old 02-20-2014, 07:51 AM   #4
schmatzler
Member
 
Registered: Jan 2011
Location: Germany
Distribution: Slackware64 -current + Multilib
Posts: 411

Original Poster
Rep: Reputation: 181Reputation: 181
Sadly, the both solutions did not work. Grepping /etc/ just returned lang.sh and lang.csh and I edited both of them so they just have one export line in it.

I even deleted the .bashrc - what wonders me is that this behaviour "just happened" - I can't remember fiddling with the system files before I encountered it. The only thing I did whas deleting the dropbox slackbuild I built some time before, but nothing in there is fiddling with system files either.
 
Old 02-20-2014, 09:02 AM   #5
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Just in case...

Here's what your /etc/profile.d/lang.sh file should looks like:
Code:
cat /etc/profile.d/lang.sh
#!/bin/sh
# Set the system locale.  (no, we don't have a menu for this ;-)
# For a list of locales which are supported by this machine, type:
#   locale -a

# en_US is the Slackware default locale:
#export LANG=en_US

# 'C' is the old Slackware (and UNIX) default, which is 127-bit
# ASCII with a charmap setting of ANSI_X3.4-1968.  These days,
# it's better to use en_US or another modern $LANG setting to
# support extended character sets.
#export LANG=C

# There is also support for UTF-8 locales, but be aware that
# some programs are not yet able to handle UTF-8 and will fail to
# run properly.  In those cases, you can set LANG=C before
# starting them.  Still, I'd avoid UTF unless you actually need it.
export LANG=en_US.UTF-8

# Another option for en_US:
#export LANG=en_US.ISO8859-1

# One side effect of the newer locales is that the sort order
# is no longer according to ASCII values, so the sort order will
# change in many places.  Since this isn't usually expected and
# can break scripts, we'll stick with traditional ASCII sorting.
# If you'd prefer the sort algorithm that goes with your $LANG
# setting, comment this out.
export LC_COLLATE=C

# End of /etc/profile.d/lang.sh
You would replace the "en_US" with "de_DE" for German, which is
Code:
locale: de_DE           directory: /usr/lib64/locale/de_DE
-------------------------------------------------------------------------------
    title | German locale for Germany
   source | Free Software Foundation, Inc.
  address | http://www.gnu.org/software/libc/
    email | bug-glibc-locales@gnu.org
 language | German
territory | Germany
 revision | 1.0
     date | 2000-06-24
  codeset | ISO-8859-1
(you get this with locale -av | pg or more).

You should not have edited /etc/profile; at the bottom of the file you'll find
Code:
# Append any additional sh scripts found in /etc/profile.d/:
for profile_script in /etc/profile.d/*.sh ; do
  if [ -x $profile_script ]; then
    . $profile_script
  fi
done
unset profile_script
which is used to execute what's found in /etc/profile.d -- if you've added anything in /etc/profile, probably a good idea to remove it.

Look around in /etc/profile.d, particularly if you have edited any file in there and made additions (also check /etc/profile for any additions you may have made).

One way to do "special" things in /etc/profile.d is what I do because I do not use BASH on any of my systems. I use KornShell and I place an executable file in /etc/profile.d to set environment variables when a user logs in:
Code:
cat ksh.sh
#!/bin/sh
#ident	"$Id$"
#
#	Name:		$Source$
#	Version:	$Revision$
#	Modified:	$Date$
#	Purpose:	set local environment variables for Korn Shell
#	Author:		T. N. Ronayne
#	Date:		1 Oct 2009
#	$Log$
# Set the HOST environment variable
export HOST="`uname -n`"
# Set ksh93 visual editing mode:
if [ "$SHELL" = "/bin/ksh" ]; then
#  VISUAL=emacs		# ugh
#  VISUAL=gmacs		# double ugh
   VISUAL=vi		# ah, elegence
fi
# Set a default shell prompt:
#PS1='`hostname`:`pwd`# '
# Do these anyway in case sombody uses a different shell
if [ "$SHELL" = "/bin/pdksh" ]; then
 PS1='! $ '
elif [ "$SHELL" = "/bin/ksh" ]; then
 PS1='${HOST}-${USER}-${PWD}: '
elif [ "$SHELL" = "/bin/zsh" ]; then
 PS1='%n@%m:%~%# '
elif [ "$SHELL" = "/bin/ash" ]; then
 PS1='$ '
else
 PS1='\u@\h:\w\$ '
fi
PS2='> '
export PS1 PS2
This file is taken from /etc/profile and modified (the visual editing mode and the ksh prompt). Because the content of /etc/profile.d is executed after /etc/profile is executed, the setting in this file replace the settings in /etc/profile. Works for me.

The only place you would ever execute the locale utility is in /etc/profile.d/lang.sh; i.e., never in a user .basrc or .profile or any other file.

Also, setting the PATH environment would be done like this:
Code:
#	change the PATH a little
export PATH=.:${HOME}/bin:${PATH}
That is done in my home directory .profile file to place the bin directory in my home directory prior to the system PATH (the colons are mandatory there to separate PATH environment settings). I am aware than doing this is questionable practice (having my own bin directory preceding the system PATH) but I am always aware that my search path is set this way and I do a lot of programming that gets tested and debugged in my home directory so I'm good. I don't necessarily recommend this, it's just to show how to modify the PATH.

Looking at your first post, it looks like there's an edit somewhere in /etc (maybe in profile, maybe in /etc/profile.d that is causing problems and you may want to extract the default /etc/profile file from the distribution source (complicated) or simply replace your /etc/profile with this one (which is unedited):
Code:
cat /etc/profile
# /etc/profile: This file contains system-wide defaults used by
# all Bourne (and related) shells.

# Set the values for some environment variables:
export MINICOM="-c on"
export MANPATH=/usr/local/man:/usr/man
export HOSTNAME="`cat /etc/HOSTNAME`"
export LESSOPEN="|lesspipe.sh %s"
export LESS="-M"

# If the user doesn't have a .inputrc, use the one in /etc.
if [ ! -r "$HOME/.inputrc" ]; then
  export INPUTRC=/etc/inputrc
fi

# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"

# For root users, ensure that /usr/local/sbin, /usr/sbin, and /sbin are in
# the $PATH.  Some means of connection don't add these by default (sshd comes
# to mind).
if [ "`id -u`" = "0" ]; then
  echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
  if [ ! $? = 0 ]; then
    PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
  fi
fi

# I had problems with the backspace key using 'eval tset' instead of 'TERM=',
# but you might want to try it anyway instead of the section below it.  I
# think with the right /etc/termcap it would work.
# eval `tset -sQ "$TERM"`

# Set TERM to linux for unknown type or unset variable:
if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
 TERM=linux
fi

# Set ksh93 visual editing mode:
if [ "$SHELL" = "/bin/ksh" ]; then
  VISUAL=emacs
#  VISUAL=gmacs
#  VISUAL=vi
fi

# Set a default shell prompt:
#PS1='`hostname`:`pwd`# '
if [ "$SHELL" = "/bin/pdksh" ]; then
 PS1='! $ '
elif [ "$SHELL" = "/bin/ksh" ]; then
 PS1='! ${PWD/#$HOME/~}$ '
elif [ "$SHELL" = "/bin/zsh" ]; then
 PS1='%n@%m:%~%# '
elif [ "$SHELL" = "/bin/ash" ]; then
 PS1='$ '
else
 PS1='\u@\h:\w\$ '
fi
PS2='> '
export PATH DISPLAY LESS TERM PS1 PS2

# Default umask.  A umask of 022 prevents new files from being created group
# and world writable.
umask 022

# Notify user of incoming mail.  This can be overridden in the user's
# local startup file (~/.bash.login or whatever, depending on the shell)
if [ -x /usr/bin/biff ]; then
 biff y 2> /dev/null
fi

# Append any additional sh scripts found in /etc/profile.d/:
for profile_script in /etc/profile.d/*.sh ; do
  if [ -x $profile_script ]; then
    . $profile_script
  fi
done
unset profile_script
It's a Good Idea to never edit /etc/profile but to place a .profile in your home directory to alter environment settings (as the example above).

When you log in, /etc/profile is executed (it executes the content of /etc/profile.d) then your .profile file is executed if it exists. This is true for BASH, KornShell or just Bourne Shell if you choose to use that. If you're using BASH, a .bashrc is executed last. That's the chain and somewhere you've got something goofy that's causing problems; you can compare the files above with yours to hopefully find what's different (or simply use them as a starting point).

Bear in mind that the "profile chain" is only executed when you log in -- if you make any changes, you will need to log out and log back in for them to take effect.

Hope this helps some.

Last edited by tronayne; 02-20-2014 at 11:39 AM.
 
Old 02-20-2014, 10:32 AM   #6
schmatzler
Member
 
Registered: Jan 2011
Location: Germany
Distribution: Slackware64 -current + Multilib
Posts: 411

Original Poster
Rep: Reputation: 181Reputation: 181
Quote:
Originally Posted by tronayne View Post
You should not have edited /etc/profile;
I didn't, but: THANKS!

I just looked into my $HOME/.profile and guess what was in there? Right:

Code:
export LANG=de_DE.utf8PATH="/usr/local/sbin:/usr/sbin:/sbin:$PATH"
PATH="/usr/local/sbin:/usr/sbin:/sbin:$PATH"
I don't know how and why this got there but I deleted it and everything is back to normal now
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to add new locale to my system. poplinux Linux - Newbie 5 03-05-2013 02:04 AM
How to change the locale by setting the system default locale letdoit Slackware 6 08-18-2011 03:34 AM
[SOLVED] How to set the system locale? catkin Slackware 6 03-06-2010 10:41 AM
system locale sanjay2k4 Linux - Software 3 06-14-2006 11:47 AM
C locale and system locale johnnydangerous Fedora 4 04-11-2005 03:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration