ArchThis Forum is for the discussion of Arch Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.