Friday, May 6, 2016

ERROR: S3 error: 400 (InvalidRequest): The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256.

Solution :
Your s3cmd has older version, you need to upgrade it. Download latest one and use the file everywhere.
https://sourceforge.net/projects/s3tools/files/s3cmd/1.6.1/
I faced this problem on 1.1 version of s3cmd, I downloaded latest and got 1.6. After that I did not get the error.


How to use the downloaded folder.
1) Extract the folder and open it.
2) Now run your s3cmd command using this downloaded folder.
 /home/ubuntu/s3cmd-1.6.1/s3cmd ls s3://

/home/ubuntu/s3cmd-1.6.1/s3cmd -c /home/ubuntu/.s3cfg put /tmp/file.sql s3://bucketname


Server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting

There are three modules related to this settings. 
prefork, worker and event

First find which module is activated using

a2query -M

Now change its conf file in mods-available. 

In following case, prefork is enabled, so make changes in mpm_prefork.conf

Open file mpm_prefork.conf and increase the MaxRequestWorkers settings according to your RAM.

MaxRequestWorkers
A simple calculation for MaxRequestWorkers would be: 

(Total Memory – Critical Services Memory) / Size Per Apache process

In this case the server has 3400Mb of memory allocated, 

250Mb used by mySQL and each Apache thread averages about 30Mb. 
MaxRequestWorkers = (3400– 250) / 30
therefore MaxRequestWorkers = 105

Restart Apache. Check here too.

Cannot allocate memory: fork: Unable to fork new process in ubuntu

There are three modules related to this settings. 
prefork, worker and event

First find which module is activated using

a2query -M

Now change its conf file in mods-available. 

In following case, prefork is enabled, so make changes in mpm_prefork.conf

MaxConnectionsPerChild
If MaxConnectionsPerChild is 0, then the process will never expire.
Setting MaxConnectionsPerChild to a non-zero value limits the amount of memory that process can consume by (accidental) memory leakage.

MaxRequestWorkers
A simple calculation for MaxRequestWorkers would be: 

(Total Memory – Critical Services Memory) / Size Per Apache process

In this case the server has 3400Mb of memory allocated, 

250Mb used by mySQL and each Apache thread averages about 30Mb. 
MaxRequestWorkers = (3400– 250) / 30
therefore MaxRequestWorkers = 105

/etc/apache2/mods-available/mpm_prefork.conf
 <ifmodule mpm_prefork_module>   
    StartServers          5
    MinSpareServers          5
    MaxSpareServers         10
    MaxRequestWorkers       100
    MaxConnectionsPerChild  1000
</ifmodule>
Restart Apache.

Not able to change permission or execute files in ubuntu

When your file is in NTFS partition, you are not allowed to change permission or execute file.

You need to add permissions for the partition.

Find UUID of all partitions using
sudo blkid

Open file /etc/fstab
and add following line for each partition which should be auto-mounted with executable file permissions.
UUID=12102C02102CEB83 /media/root ntfs-3g auto,users,exec,permissions 0 0

UUID of the partition can be found using above mentioned command and /media/root is the directory where you want the partition should be mounted

Now partition files have changeable and executable permissions.