Geekflare is supported by our audience. We may earn affiliate commissions from buying links on this site.
Share on:

perl: warning: Setting locale failed. – Fixed in CentOS 8

unix login prompt
Invicti Web Application Security Scanner – the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning™.

Getting warning about “setting locale failed” while executing Perl on CentOS 8?

I was trying to run Nikto and got this error.

[root@lab program]# ./nikto.pl -h $IPADDRESS
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_CTYPE = "UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
[root@lab program]#

It was on DO server which I used SSH terminal to connect from macOS. If you are encountering this error, here is how you can fix.

Solution

Export the following locale on your terminal and run the program.

export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

It ran smoothly to me and hope it helps you too.

This is fine if you just need to do one time. However, if you need to run it periodically then you may want to set this in profile so it loads during logon.

  • Go to the user’s home directory
  • Modify .bash_profile (assuming you are using bash) using vi
  • Add the following and save the file
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

That’s all!

Now, I can run Perl 😊

Thanks to our Sponsors
More great readings on Linux
Power Your Business
Some of the tools and services to help your business grow.
  • Invicti uses the Proof-Based Scanning™ to automatically verify the identified vulnerabilities and generate actionable results within just hours.
    Try Invicti
  • Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data.
    Try Brightdata
  • Semrush is an all-in-one digital marketing solution with more than 50 tools in SEO, social media, and content marketing.
    Try Semrush
  • Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches.
    Try Intruder