LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Arch
User Name
Password
Arch This Forum is for the discussion of Arch Linux.

Notices

Reply
 
Search this Thread
Old 01-19-2012, 10:05 AM   #1
Gaidal
LQ Newbie
 
Registered: May 2002
Location: Sweden
Distribution: Arch x64
Posts: 29
Blog Entries: 2

Rep: Reputation: 0
su - user -c sets locale variables to "POSIX"


I need to run SBCL in a UTF-8 environment in a VM running Arch. When I log in as the dedicated user and run the start script, it runs in UTF-8 and works fine. However I need to start it through a (bash) script, and when I run it with:

su - user -c /var/lib/.../start-script

it runs in an environment with all language variables set to POSIX, which causes errors.
I have set LOCALE to en_US.UTF-8 in rc.conf and checked locale.gen, and both the root and the user use this normally. Running locale as root shows all variables set properly to en_US.UTF-8.
Yet when I do su - user -c locale, it's all set to POSIX.

How is this possible, who is this user su runs as, what should I do?

EDIT: It works if I do:
su - user -c export LANG=en_US.UTF-8 && /var/lib/.../start-script
I don't understand why this is required.

EDIT: I read about some update late last year, which made /etc/profile.d/locale.sh obsolete (?) and made /etc/locale.conf take precedence over /etc/rc.conf. Following those instructions isn't working for me though. Moving locale.sh and using /etc/locale.conf sets all vars to POSIX for all users; if I keep it it's still the same as I originally described.

Last edited by Gaidal; 01-20-2012 at 02:06 AM.
 
Old 01-20-2012, 10:50 PM   #2
eeekster
Member
 
Registered: Sep 2011
Posts: 157

Rep: Reputation: Disabled
Try it with "su" instead of "su -". The dash causes su to load the users's environment instead of using what you already have.
 
Old 01-21-2012, 12:02 AM   #3
Gaidal
LQ Newbie
 
Registered: May 2002
Location: Sweden
Distribution: Arch x64
Posts: 29
Blog Entries: 2

Original Poster
Rep: Reputation: 0
So omitting the hyphen makes it use the root's environment? It might kind of work since root does use unicode, but optimally I *want* su to load that user's environment, and that's not what it does with "su -". The user also has all locale variables set to unicode.

What I want to do is to run the process as that user, in that user's environment, from a bash script at boot time.
 
Old 01-21-2012, 02:35 PM   #4
eeekster
Member
 
Registered: Sep 2011
Posts: 157

Rep: Reputation: Disabled
Where is the user getting the LANG setting?
 
Old 01-26-2012, 12:06 AM   #5
Gaidal
LQ Newbie
 
Registered: May 2002
Location: Sweden
Distribution: Arch x64
Posts: 29
Blog Entries: 2

Original Poster
Rep: Reputation: 0
Sorry for the delay, celebrated the Chinese New Year...

I only have LOCALE=en_US.UTF-8 in /etc/rc.conf, and don't set any locale variables manually anywhere else, for any user... And it works everywhere except this
Code:
su - user -c
case.

Someone mentioned that perhaps su - user clears all environment settings, that would make more sense with these results.
 
  


Reply

Tags
environment variable, locale, posix, root, su


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
PostFix + ISPConfig mail return "unknown user" or "no such user here" Jacky444 Linux - Server 1 02-10-2010 04:21 PM
perl: warning: Falling back to the standard locale ("C"). walterbyrd Debian 11 05-14-2009 08:50 AM
trouble using wine + 2-cd sets "cannot eject volume" beeblequix Linux - Software 4 11-02-2007 09:16 AM
"locale not supported by Xlib, locale set to C" Irad Linux - Software 3 06-25-2006 03:59 PM
cupsd, many "modprobe: can't locale device /dev/usbxx" at boot.. bit7 Linux - Software 0 01-16-2004 01:40 AM


All times are GMT -5. The time now is 07:53 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration