Tuesday, October 29, 2019

Amzaon Linux syslog error: CRIT amazon-ssm-agent: caused by: EC2MetadataError: failed to make EC2Metadata request

Recently got this error from syslog: CRIT amazon-ssm-agent: caused by: EC2MetadataError: failed to make EC2Metadata request It is a EC2 Instance not management by amazon-ssm.

AWS Systems Manager Agent (SSM Agent) is Amazon software that can be installed and configured on an Amazon EC2 instance, an on-premises server, or a virtual machine (VM). SSM Agent makes it possible for Systems Manager to update, manage, and configure these resources. The agent processes requests from the Systems Manager service in the AWS Cloud, and then runs them as specified in the request.

It is safe to drop the package amazon-ssm-agent.

First check and stop the status:
# systemctl status amazon-ssm-agent.service
● amazon-ssm-agent.service - amazon-ssm-agent
   Loaded: loaded (/usr/lib/systemd/system/amazon-ssm-agent.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-10-28 17:04:27 EDT; 1 day 3h ago
 Main PID: 3285 (amazon-ssm-agen)
   CGroup: /system.slice/amazon-ssm-agent.service
           └─3285 /usr/bin/amazon-ssm-agent

Oct 28 23:39:27 local amazon-ssm-agent[3285]: ...

# systemctl stop amazon-ssm-agent.service
Drop the package:
# yum erase amazon-ssm-agent
Loaded plugins: etckeeper, extras_suggestions, langpacks, priorities, update-motd
Resolving Dependencies
--> Running transaction check
---> Package amazon-ssm-agent.x86_64 0:2.3.662.0-1.amzn2 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

 Package                              Arch                       Version                                  Repository                       Size
 amazon-ssm-agent                     x86_64                     2.3.662.0-1.amzn2                        @amzn2-core                      61 M

Transaction Summary
Remove  1 Package

Installed size: 61 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
etckeeper: pre transaction commit
  Erasing    : amazon-ssm-agent-2.3.662.0-1.amzn2.x86_64                                                                                    1/1
etckeeper: post transaction commit
Counting objects: 6, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 597 bytes | 597.00 KiB/s, done.
Total 6 (delta 5), reused 0 (delta 0)
  Verifying  : amazon-ssm-agent-2.3.662.0-1.amzn2.x86_64                                                                                    1/1

  amazon-ssm-agent.x86_64 0:2.3.662.0-1.amzn2


Thursday, April 4, 2019

WordPress new post editor has encountered an unexpected error

I tried:

  • Disabled all plugins (included SEO) and browser addons.
  • Attempt recovery doesn't work. Error code.
  • Switch to other themes.

Error Code:

TypeError: Cannot read property 'show_ui' of undefined
    at https://www.milliondollarserver.com/wp-includes/js/dist/editor.min.js?ver=9.0.11:55:241342
    at i (https://www.milliondollarserver.com/wp-includes/js/dist/vendor/lodash.min.js?ver=4.17.11:6:91)
    at An.filter (https://www.milliondollarserver.com/wp-includes/js/dist/vendor/lodash.min.js?ver=4.17.11:99:338)
    at https://www.milliondollarserver.com/wp-includes/js/dist/editor.min.js?ver=9.0.11:55:241307
    at ph (https://www.milliondollarserver.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:97:88)
    at eg (https://www.milliondollarserver.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:125:307)
    at fg (https://www.milliondollarserver.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:126:168)
    at wc (https://www.milliondollarserver.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:138:237)
    at fa (https://www.milliondollarserver.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:137:115)
    at ng (https://www.milliondollarserver.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3:149:69)

  • WordPress 5.1.1
  • Nginx 1.15
  • PHP-FPM 7.2
  • wp-supercache
Here is how I fix it:
#vi /etc/nginx/wp-supercache

location / {
    try_files $cachefile $uri $uri/ /index.php;
Changed to:
location / {
	try_files $cachefile $uri $uri/ /index.php$is_args$args;
Restart Nginx to apply the changes:
# sudo systemctl restart nginx
Related Bug: https://github.com/WordPress/gutenberg/issues/9912

Saturday, March 23, 2019


Launch Instance: latest Amazon Linux 2 AMI

# Update Linux and install essential packages
sudo yum -y update

# Install php72 using amazon-linux-extras
sudo amazon-linux-extras install php7.2

# Install Nginx 1.12 using amazon-linux-extras
sudo amazon-linux-extras install nginx1.12

# Install mariadb using amazon-linux-extras
sudo amazon-linux-extras install lamp-mariadb10.2-php7.2
## this will install apache/httpd as well, which we don't need.
### uninstall httpd
sudo yum earse httpd httpd-tools
# install mariadb-server should be version 10.2 or higher
sudo yum install mariadb-server
To enable nginx, php-fpm and mardb services on boot:
sudo systemctl enable nginx
sudo systemctl enable php-fpm
sudo systemctl enable mariadb
To start all 3 service:
sudo systemctl start php-fpm
sudo systemctl start nginx
sudo systemctl start mariadb
sudo mysql_secure_installation

Amazon Linux 2 add fail2ban from epel

Amazon Linux team did a great work to make it easy and clean at same time.

 The epel repo is no longer enable by default like the olden days.

This keep the rpm packages as slim as possible.

To enable epel, just one command:

# sudo amazon-linux-extras install epel
# sudo yum update
# sudo yum install fail2ban

Friday, March 22, 2019

Amazon Linux 2 Systemctl commands timeout - systemd issue

A long live AWS EC2 vm gave me this when I try to check the httpd running status:
systemctl status httpd
Failed to get properties: Connection timed out
According google search: https://serverfault.com/questions/712928/systemctl-commands-timeout-when-ran-as-root I tried both:
kill -9 1
systemctl daemon-reexec
None of them works. The [reboot] only flack a bit and kick me out of system but did not really reboot. I have to run:
systemctl --force --force reboot
To force it reboot. Love systemd!

Sunday, March 10, 2019

How to reset check_mk admin password

My Windows 10 Laptop just crashed after latest Intel patch upgrade.

Forgot to save the admin password on one of the latest check_mk site I built.
su - mysite

cd etc

ls -l htpasswd

OMD[mysite]:~/etc$ ls -l htpasswd
Example: check_mk version 1.4:
check_mk version 1.5:
htpasswd htpasswd omdadmin          # set password for user *omdadmin*

New password: 

Re-type new password:
You should be good! Have a nice day!

Monday, February 25, 2019

recommend Script to remove Windows 10 bloatware

Recommend a great Script to remove Windows 10 bloatware.

You can find it here:


Just download the zip and run in PowerShell by right click: Windows10Debloater.ps1
If you like GUI: Windows10DebloaterGUI.ps1

  1. Appreciate Richard Newton's great work.
  2. I did not run white list, because I do not want anything except the 'Core Windows 10'.
  3. If you really really need keep some Windows 10 bloatware, please run Windows10SysPrepDebloater.ps1 before you start the main .PowerShell script.
  4. The only one I may keep is the Mail which crashed every time I check the Gmail folders.
  5. I sill using Windows 10 as my Main working OS and Outlook as my Main Email client. But not a fan of any bloatware.