scotch-io / scotch-box

Scotch Box is a preconfigured Vagrant Box with a full array of LAMP Stack features to get you up and running with Vagrant in no time.
http://box.scotch.io
2.7k stars 546 forks source link

locale LC_ALL & LANGUAGE are not set #237

Closed flurinduerst closed 8 years ago

flurinduerst commented 8 years ago

Output from locale on Scotch Box VM

vagrant@wpdist:/var/www$ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE=de_CH.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=
vagrant@wpdist:/var/www$

When trying to push a database with Wordmove we get the following error:

/home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/wordmove-2.0.0/lib/wordmove/sql_adapter.rb:44:in `gsub!': invalid byte sequence in US-ASCII (ArgumentError)

Adding export LANGUAGE=en_US.UTF-8 and export LC_ALL=en_US.UTF-8 solves the problem, but this gets reset every time we exit the VM. Is this an ubuntu specific thing?

maxpou commented 8 years ago

Hi, Got the same problem. Here is 2 solutions to fix it permanently:

echo "export LANGUAGE=en_US.UTF-8">>~/.bashrc
echo "export LC_ALL=en_US.UTF-8 ">>~/.bashrc
# Edit /etc/default/locale file (with sudo)
LANGUAGE="en_US.UTF-8"
LC_ALL="en_US.UTF-8"

I hope this will help you.

Edit : replace .bash_profile with .bashrc in first solution

flurinduerst commented 8 years ago

works perfectly. thanks a lot!

flurinduerst commented 8 years ago

after executing the first solution (which fixes the language-problem) and restarting the vm, I can't execute commands like ll (for ls -l) on the VM anymore. The .bashrc aliases aren't working anymore.

I tested it on two scotchbox installations, and it happend after I've added those commands to the .bash_profile like you suggested :/

maxpou commented 8 years ago

Opps my bad sorry guy.

  1. Remove bash_profile file (rm ~/.bash_profile)
  2. Try same commands in /.bashrc file (not .bash_profile)

    echo "export LANGUAGE=en_US.UTF-8">>~/.bashrc
    echo "export LC_ALL=en_US.UTF-8 ">>~/.bashrc
  3. exit ssh (exit) and vagrant ssh (Now ll will work)
  4. echo $LANGUAGE will output "en_US.UTF-8" as expected :-)

Further more information about .bashrc / .bash_profile file : http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html

I update last answer right now ;-)

flurinduerst commented 8 years ago

awesome. thanks for the article, learned something today :)

maxpou commented 8 years ago

You're welcome :wink: