Tuesday, January 8, 2019

Linux System - date not changed using command line

If you are trying to change date of a Linux system using command `date -s`, it shows changed date as a result but when you run date command again, it shows old date. You are getting this issue because there may be reason that NTP is enabled.

Solution :

Disable the NTP using command.

sudo timedatectl set-ntp 0

Now change date again using `date -s` command. Now date should be changed successfully.

ERROR: The Compose file './docker-compose.yml' is invalid because Unsupported config option for services 'healthcheck'

While building and starting the container with command

docker-compose up -d

You get following error

ERROR: The Compose file './docker-compose.yml' is invalid because:
Unsupported config option for services.db: 'healthcheck'
Unsupported config option for services.redis: 'healthcheck'


Solution :
Check your docker-compose version.

docker-compose --version 

Your docker-compose has lower version than 1.9.0. Upgrade docker compose using pip install and check docker version in /usr/local/bin/docker-compose.

/usr/local/bin/docker-compose --version

After upgrading if you are getting same issue again, check your docker compose version again using

docker-compose --version
/usr/local/bin/docker-compose --version

If both are different, use upgraded docker-compose with absolute path like

/usr/local/bin/docker-compose up -d

Nginx ssl error : Failed SSL: error:0D0680A8

If you are getting this error while restarting / reloading nginx after making changes in ssl configuration, following solution may work for you.

Error :
[emerg] 26062#26062: PEM_read_bio_X509_AUX(".com.key") failed (SSL: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:Type=X509_CINF error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error:Field=cert_info, Type=X509 error:0906700D:PEM routines:PEM_ASN1_read_bio:ASN1 lib)


Solution :
1. Make sure you have generated correct private key file for your domain.
2. Make sure you have generated correct digital certificate file (crt) for your domain.
3. Make sure you have added private key file for attribute ssl_certificate_key and digital certificate file for attribute ssl_certificate in your nginx configuration file.

 ssl_certificate_key /etc/nginx/ssl/domain.com.key;
 ssl_certificate /etc/nginx/ssl/domain/960668e6d2dd456e.crt;