Friday, December 9, 2016

ssh error - Agent admitted failure to sign using the key


Solution : 1

ssh login using command

SSH_AUTH_SOCK=0 ssh server-ip

Example : SSH_AUTH_SOCK=0 ssh username@192.168.0.xx


Solution : 2

Run Command
ssh-add

Ubuntu Boot Error - Fixing Recursive Fault Issue


Solution :

sudo nano /etc/default/grub
Change the line
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash” 
to
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi=off"
And then update grub
sudo update-grub

Monday, November 14, 2016

PHP Parse error: syntax error, unexpected '$value' (T_VARIABLE)

PHP Parse error:  syntax error, unexpected '$value' (T_VARIABLE)

If you are getting this error for specific php keywords used in code like yield, you need to upgrade your php version. May be you have php 5.4 or lower version, upgrade it to php 5.5 or php 5.6 or higher.

PHP Fatal error: Call to undefined function mb_strpos()


Solution :

php-mbstring package is not installed on your Linux distribution.

Install it.

If you are using Debian or Ubuntu
sudo apt-get install libapache2-mod-php5
If you are using Fedora or CentOS
yum install php-mbstring

Restart apache and try again.

date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.

Set following value in php.ini file


date.timezone = 'Asia/Kolkata'

It depends on your timezone. Set your timezone in php.ini
You may face this error if this line is commented.

Restart Apache and try again.

SQLSTATE[HY000]: General error: 1364 Field doesn't have a default value

Solution :

Go on mysql prompt and run following command.


mysql> SET GLOBAL sql_mode=''

Make sure no value has been set for attribute sql_mode in the file my.cnf.

Monday, October 10, 2016

mysql default current_timestamp error

The DEFAULT CURRENT_TIMESTAMP support for a DATETIME (datatype) was added in MySQL 5.6.

It is now possible to achieve this with DATETIME fields since MySQL 5.6.5

Previous versions can't do that with DATETIME.But you can do it with TIMESTAMP.


Upgrade your mysql with this version and you will not get this error again.

Ubuntu : apt-get upgrade : ubuntu The following packages have been kept back

Solution :

To solve this issue, Run command :

sudo apt-get dist-upgrade

Ubuntu 16.04 - Enable ssh root login

Steps :

a) Edit file /etc/ssh/sshd_config
sudo nano /etc/ssh/sshd_config

b) Change following attribute.
FROM:
PermitRootLogin prohibit-password
TO:
PermitRootLogin yes


c) sudo service ssh restart

gitlab large size files push issue

error: RPC failed; result=22, HTTP code = 413
fatal: The remote end hung up unexpectedly, gitlab large file size push issue

Steps :

1) Upgrade gitlab with latest version. Right now current version is 8.12.4

2) Increase file size in /etc/gitlab/gitlab.rb under nginx section.
  nginx['enable'] = true
  nginx['client_max_body_size'] = '250m'


3) Increase max attachment size in http://gitlab.domain/admin/application_settings


4) Reconfigure gitlab and restart system.

Tuesday, September 6, 2016

Netbeans : Next button of installer is not working

If you are trying to install Netbeans on Ubuntu 15.10 and Next button of the installation wizard is disabled so you are not able to install Netbeans. Here is the solution for you.

Install : oracle-java8-installer to solve above issue

sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

Now try to install Netbeans again. Next button of the wizard should be enabled now.

Friday, August 5, 2016

windows 7 and ubuntu dual boot : windows 7 boots in background but showing distorted screen of ubuntu

If you have installed Windows 7 and Ubuntu as a dual boot and when you boot windows 7, it loads a distorted screen of Ubuntu although you can hear the windows 7 start up sound but you are not able to do anything because nothing is displayed.

Here is the solution.
sudo nano /etc/default/grub
Now Uncomment following line.
GRUB_TERMINAL="console"

Update the grub.
sudo update-grub

Restart your system.
sudo reboot

Thursday, August 4, 2016

ejabberd Error : large number of users are crashing ejabberd

CRASH REPORT Process  with 0 neighbours exited with reason: {process_limit,{max_queue,}} in p1_fsm:terminate/8 line

CRASH REPORT Process <0.645.0> with 0 neighbours exited with reason: {process_limit,{max_queue,2706}} in p1_fsm:terminate/8 line 755

Solution : 1
May be, you have added all your users under one shared roster group. If you remove the group, you will not get the error again.

But if you remove the shared roster group, your users will not be able to see the other users in client like pidgin.
 
If you create multiple shared roster groups, Users of one group will not be able to see users of other group so they can not chat with each other. Bad Idea.

Solution : 2
In your shared roster group, you might have used @all@ parameter to add all users in one group. ejabberd is trying to list all users at once and it is crashing in this process.

You can change @all@ to @online@. Now ejabberd lists all online users only and this is definitely less than total number of users. In this condition ejabberd has less load and chances of crashing is less too.

But you have really a big database and you have 2000-3000 users are online simultaneously, then you should try solution 3.


Solution : 3
Add attribute
max_fsm_queue: 10000
under section port 5222: in the ejabberd.yml config file in following way
listen:
-
    port: 5222
    module: ejabberd_c2s4
    certfile: "/home/ubuntu/ejabberd-16.06/conf/server.pem"
    starttls: true
    resume_timeout: 0
    protocol_options:
      - "no_sslv3"
    max_stanza_size: 65536
    shaper: c2s_shaper
    access: c2s
    max_fsm_queue: 10000
  Restart ejabberd.

You should not get this error again.

Ubuntu boot error : fixing recursive fault but reboot is needed


While booting ubuntu, you are not able to reach upto Login screen. It appears with long list of errors and finally you get "fixing recursive fault but reboot is needed"

Solution :
Boot ubuntu in recovery mode and open command prompt
Now edit following grub file.


sudo nano /etc/default/grub
Change the line

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" 
to
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi=off"
sudo update-grub
sudo reboot

You should not get the error again and Login screen should be opened successfully.

Friday, July 8, 2016

ejabberd : Other users are not visible after login


Uncomment line

{mod_shared_roster,[]},

in config file of ejabberd and restart ejabberd.

config file - /etc/ejabberd/ejabberd.cfg 

Now you can see option "shared roster group".

Create a group and add users in the group. You can see all users of same group after login.

Thursday, June 9, 2016

ejabberd : No other options except virtualhosts in admin

ejabberd : All links missing, partial admin appears

sudo nano /etc/ejabberd/ejabberd.cfg


Find lines
{acl, admin, {user, "", "localhost"}}.
%% Hostname
{hosts, ["localhost"]}.


and replace it with


{acl, admin, {user, "admin", "localhost"}}.
%% Hostname
{hosts, ["localhost"]}.




Restart ejabberd

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.

Sunday, April 10, 2016

XAMPP - wrong ELF class: ELFCLASS64

If you have added an extension in your php.ini and you are getting this error while restarting XAMPP or running command  /opt/lampp/bin/php -v as well as as extension is not working, it means you are using 64 bit .so file(extension) in 32 bit XAMPP.

You can get this error while installing ioncube loader .so file, mongo.so file or in similar extension.

Download 32 bit version of .so file and put it in right place in xampp directory.
Mention it in php.ini file and Restart xampp .

Your extension should not be failed this time.

Browse files of Android mobile on ubuntu by bluetooth

To browse files of Android phone (memory card), you should have obex installed on your Ubuntu.
sudo apt-get install obexfs obexftp

Now you should have a server on your android phone. Install app "Bluetooth File Transfer" on your Android phone. When you open the app, it starts FTP (File Transfer Protocol) and OPP (object push profile) services on two different ports.

Start Bluetooh of android device and ubuntu and make both discoverable. Now mount your Android device on Ubuntu.
sudo obexfs -b android:device:id /mount/directory
Make sure mounted directory is empty.

To find your android device id, run command 
hcitool scan
Make sure your phone is discoverable and bluetooth is turned on.

Suppose your device id is 00:19:99:4c:68:12 and mounted directory on Ubuntu is /mnt/user.
Run command on ubuntu
sudo obexfs -b 00:19:99:4c:68:12 /mnt/user
Make sure you have started Bluetooth File Transfer app in your phone.

Now you can see all your memory card files in the directory /mnt/user.

I got maximum transfer speed 30 kbps from phone to system or vice versa. The only advantage I found, I need not carry USB cable and my Laptop usb port is not used in this process. Otherwise it is not useful for bigger transfer, sometimes it loses the connection and sometimes it is really annoying.

Saturday, March 12, 2016

ProxySet: unknown lbmethod lbmethod=byrequests; balancer://mycluster

apache2 error : While creating Load Balancer
ProxySet: unknown lbmethod lbmethod=byrequests; balancer://mycluster

If you are getting above error after setting Load Balancer in your conf file while restarting apache, you need to enable following module in apache.

Run following command 
sudo a2enmod lbmethod_byrequests

Now Restart apache.

Tuesday, February 16, 2016

Not able to find sendmail log

If you are not able to see log in /var/log/mail.log and file is empty, check the mail logs in /var/log/syslog
tail -n 25 /var/log/syslog

pecl install stomp error

configure: error: Cannot find OpenSSL's libraries
ERROR: `/var/tmp/stomp/configure --with-openssl-dir=/usr' failed


Solution :
While installing stomp using pecl, it asks
OpenSSL install prefix (no to disable SSL support) [/usr] :
Type yes and press return key.


Do not leave the input blank.

Server sent passive reply with unroutable address. Using server address instead

Filezilla Error : Server sent passive reply with unroutable address. Using server address instead

Solution :
In FileZilla, click on Edit > Settings.
1) Under Connection, click on FTP and choose Active as the Transfer Mode.
2) Under Connection, under FTP, click on Active mode and choose “Ask your operating system for the external IP address” (the default setting).
3) Under Connection, under FTP, click on Passive mode and choose “Fall back to active mode” (this is an optional setting).

Remove Apache server info from web page header

If you are using Ubuntu or Debian
Edit file  /etc/apache2/conf-enabled/security.conf

Change “ServerTokens OS” to “ServerTokens Prod”

and
Change “ServerSignature On” to “ServerSignature Off”

Restart apache.

If you are using CentOS, RHEL or fedora
Edit file /etc/httpd/conf/httpd.conf

Change “ServerTokens OS” to “ServerTokens Prod”
and
Change “ServerSignature On” to “ServerSignature Off”

Restart apache. 

If there are no entries of these lines, add both lines in the file.
Restart apache

Apache remove php version info from the web page header


Edit your php.ini and set following attribute.

expose_php = off
Restart apache.