Posts Tagged: Troubleshooting

How to solve “Falling back to the standard locale” in Ubuntu

ubuntuSometimes you may get an error like this:

perl: warning: Setting locale failed.

perl: warning: Please check that your locale settings:

LANGUAGE = (unset),

LC_ALL = (unset),

LC_PAPER = “pt_BR.UTF-8”,

LC_ADDRESS = “pt_BR.UTF-8”,

LC_MONETARY = “pt_BR.UTF-8”,

LC_NUMERIC = “pt_BR.UTF-8”,

LC_TELEPHONE = “pt_BR.UTF-8”,

LC_IDENTIFICATION = “pt_BR.UTF-8”,

LC_MEASUREMENT = “pt_BR.UTF-8”,

LC_TIME = “pt_BR.UTF-8”,

LC_NAME = “pt_BR.UTF-8”,

LANG = “en_US.UTF-8”

are supported and installed on your system.

perl: warning: Falling back to the standard locale (“C”).

Click Continue reading to see how to fix this!

Continue reading

How to fix “Can’t locate Search/Xapian.pm in @INC”

perlError: Can’t locate Search/Xapian.pm in @INC (you may need to install the Search::Xapian module) (@INC contains: /path/to/something /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at (eval 143) line 2. BEGIN failed–compilation aborted at (eval 143) line 2.

To fix this on Ubuntu 14.04, just run:

sudo apt update && sudo apt install libsearch-xapian-perl

How to fix “Can’t locate Sort/Naturally.pm in @INC”

perlCan’t locate Sort/Naturally.pm in @INC (you may need to install the Sort::Naturally module) (@INC contains: /path/to/something /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at (eval 145) line 2.
BEGIN failed–compilation aborted at (eval 145) line 2.

To fix this on Ubuntu 14.04, just run:

sudo apt update && sudo apt install libsort-naturally-perl

How to disable Apache logs

apacheTo reduce disk writes or silence access logs on a local lab server, update your Apache configuration in /etc/apache2/ (note that Ubuntu/Debian Apache 2.4 uses conf-available/ and 000-default.conf instead of legacy conf.d/ and default):

1. Disable the global vhost access log config:

sudo a2disconf other-vhosts-access-log

2. Inside your VirtualHost files (/etc/apache2/sites-available/000-default.conf and default-ssl.conf), comment out CustomLog:

#CustomLog ${APACHE_LOG_DIR}/access.log combined

3. Validate and reload Apache:

sudo apache2ctl configtest && sudo systemctl reload apache2

Operational Warning: You can silence errors with ErrorLog /dev/null on disposable test VMs, but in staging or production keep ErrorLog active (or raise LogLevel warn) so crashes, permission failures, and TLS errors remain diagnosable.

Recovering a Lost Amazon EC2 SSH Key

amazon-ec2If you lose your Amazon EC2 SSH key and can’t log in to your instance, this isn’t a big problem as long as your instance is EBS-based and uses an Elastic IP.

1. Upload your new SSH key, or use one generated by AWS.

2. Create an AMI of your instance.

3. Launch a new instance from your AMI and select the new SSH key.

4. Log in to your instance with the default user (ubuntu or ec2-user, depending on your original AMI).

5. Reassign the Elastic IP to the new instance.

6. Turn off the old instance and terminate it.

Modern Alternatives (No Instance Replacement Required): Today you can usually regain access without cloning an AMI by connecting via AWS Systems Manager Session Manager, pushing a temporary key through EC2 Instance Connect, or stopping the instance to attach its root EBS volume to a temporary rescue VM and updating ~/.ssh/authorized_keys directly.