DEV Community

Heddi Nabbisen
Heddi Nabbisen

Posted on • Updated on

sqlcmd's error: "locale::facet::_S_create_c_locale name not valid"

If the locale of your OS is NOT English, you might meet the error below, when the installation of sqlcmd, a Microsoft SQL Server 2017's client command line tool, has finished and you try to use it.

$ /opt/mssql-tools/bin/sqlcmd
terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid

Besides, you can see your locale this way:

$ locale
LANG=ja_JP.UTF-8
LANGUAGE=
LC_CTYPE="ja_JP.UTF-8"
LC_NUMERIC="ja_JP.UTF-8"
LC_TIME="ja_JP.UTF-8"
LC_COLLATE="ja_JP.UTF-8"
LC_MONETARY="ja_JP.UTF-8"
LC_MESSAGES="ja_JP.UTF-8"
LC_PAPER="ja_JP.UTF-8"
LC_NAME="ja_JP.UTF-8"
LC_ADDRESS="ja_JP.UTF-8"
LC_TELEPHONE="ja_JP.UTF-8"
LC_MEASUREMENT="ja_JP.UTF-8"
LC_IDENTIFICATION="ja_JP.UTF-8"
LC_ALL=

They are my Debian's.

Well, let's try to solve the problem.
* There is an easier way in the post comment. Thank you, scientronic92 :)

Add a line to the bottom of /etc/locale.gen like this:

+ en_US.UTF-8 UTF-8

Then run:

$ sudo /usr/sbin/locale-gen

I hope your problem is solved after the process :)

Thank you for your reading.
Happy computing.

Discussion (3)

Collapse
scientronic92 profile image
scientronic92

Thank you for sharing. But I found this helpful commands:

export LANG=en_US.UTF-8
locale-gen en_US.UTF-8

It helped me with using mssql-tools.

Collapse
nabbisen profile image
Heddi Nabbisen Author

Dear scientronic92,
Thank you for your comment.
That is an easier and simpler.
I have updated my post to add the link :)

Collapse
scientronic92 profile image
scientronic92

Thanks a lot, heddi.