Saturday, December 19, 2015

grub rescue error

grub rescue error : unknown filesystem

If you have tried following commands and still you are getting grub rescue error.
ls
ls (hd0,msdosx)/ #where x is the number depends on ls output.In this case,it is 6
set prefix=(hd0,6)/boot/grub
set root=(hd0,6)
insmod normal
normal
If insmod normal command is not working and showing unknown file system error.

Solution :
Boot your linux with pendrive or cd/dvd.
Select option "Run without installing". Now you can open terminal.
You need to scan the filesystem to resolve errors. Run command
sudo fsck /dev/sda1
where /dev/sda1 is the root partition of your hard disk.

Once it scans and checks complete filesystem, reboot your system.
You will not end up with grub rescue error.

/var/tmp/mongo/contrib/php-ssl.h:33:25: error: openssl/evp.h: No such file or directory

Compilation error : mongo compilation error :
/var/tmp/mongo/contrib/php-ssl.h:33:25: error: openssl/evp.h: No such file or directory

Solution :

You need to install package openssl-devel

Run following command on Centos/Fedora/RHEL
yum install openssl-devel

Now try to compile your package again, you will not get this error.

mktemp: failed to create file via template ‘/tmp/tmp.XXXXXXXXXX’: No space left on device

mktemp: failed to create file via template ‘/tmp/tmp.XXXXXXXXXX’: No space left on device

Not able to create new files, Not able to restart apache or mysql, Not able to run find or similar commands because of above error.

Solution :

You need to check two things on your system, first remaining space and second usage of inodes.

Delete some large files and make some empty space.

But if your hard disk is not full and sufficient space is there but still you are getting this error, there is fair enough chance that inode may be the reason.

If used inodes are 100% then you can not create any more files or restart servers or execute find command etc. Every new file or directory needs inode number and if all inodes are used, you can not create new.

Now how to check use inode %. Simply run command :
df -i

Here you can see total number of inode and used number of inode. If you have used all inodes, it means some program is creating large number of small files like any session directory of web application (ex- magento) or any similar program, You need to delete these all unused files and make some inodes free.

Once you have enough inodes, you can start creating files or restarting servers or making other tasks.

ffmpeg: error while loading shared libraries: libavdevice.so.55: cannot open shared object file: No such file or directory

ffmpeg compilation error on CentOS 

ffmpeg: error while loading shared libraries: libavdevice.so.55: cannot open shared object file: No such file or directory

After compilation of ffmpeg on Centos, you run the command ffmpeg and you get this error.

Solution :

Open file /etc/ld.so.conf and add the content in it.
sudo nano /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/lib
/usr/local/lib

Save file and run command.
ldconfig
Now run the command ffmpeg, you will not get this error.


Tuesday, December 15, 2015

Friday, November 6, 2015

Install VLC Media Player 1.1.13 in ubuntu

Install VLC Media Player 1.1.13 The Luggage in ubuntu 10.04
sudo add-apt-repository ppa:n-muench/vlc2
sudo apt-get install vlc

Ubuntu: Run vlc player as root

Open VLC player as root in Linux

Run following command :
sed -i 's/geteuid/getppid/' /usr/bin/vlc
Now you will be able to open vlc player as root user.

Saturday, October 10, 2015

git using http- gtk warning : cannot open display

Solution :
Run Command
unset SSH_ASKPASS
Note :
To remove this error permanently, add this command in your ~/.bashrc file.

/bin/sh: 1: r.js: not found

Solution :
Run Command :

npm install requirejs

Error in plugin 'gulp-shell'

Solution :
Run command
npm install gulp-shell

xubuntu : could not mount /dev/sda1 read-write is write-protected

Solution :
Run command

fsck -Af

Can't locate MongoDB.pm

Solution :
Run command
cpan Mojolicious::Plugin::Mongodb

Can't locate Data/Entropy/Algorithms.pm

Solution :

Run command
cpan Data::Entropy::Algorithms

Can't locate Crypt::Eksblowfish::Bcrypt

Solution :
Run command

CPAN Crypt::Eksblowfish::Bcrypt

Can't locate autodie.pm

Solution :
Run Command

cpan autodie

Can't locate Digest/Perl/MD5.pm in @INC

Solution :
Run command
cpan Digest::MD5

Can't locate CPAN.pm in @INC

If you are using CentOS/RHEL/Fedora and you get this error, Run following command to solve the error.
yum install perl-CPAN

Tuesday, September 8, 2015

gulp : watch error - Waiting…Fatal error: watch ENOSPC

gulp : watch error - Waiting…Fatal error: watch ENOSPC

Run command :
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Tuesday, August 18, 2015

ERROR:nacl_fork_delegate_linux.cc(314)] Bad NaCl helper startup ack (0 bytes)

Google Chrome Error :

Remove beta version if it is installed
sudo apt-get --purge remove google-chrome-beta
Remove stable version if it is installed

sudo apt-get --purge remove google-chrome-stable
Install stable version again suppose it is 36.

dpkg -i google-chrome-stable_current_i386_36.0.deb
 
If above solution is not working, Run following command in your terminal.

google-chrome --no-sandbox --user-data-dir

Monday, July 6, 2015

firefox start error - Couldn't load XPCOM

firefox start error - Couldn't load XPCOM

Check ubuntu is 32 bit or 64 bit and firefox is 32 bit or 64 bit.
Generally you get this when you install 32 bit firefox on 64 bit ubuntu.


Check your firefox is 32 bit or 64 bit, run in firefox
about:


If you get
Build identifier: Mozilla/5.0 (X11; Linux i686; rv:36.0) Gecko/20100101 Firefox/36.0
Note: i686, i386, i586 are 32-bit builds.

and if you get
Build identifier: Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0
Note: x86_64 is 64-bit build.

Download 64 bit firefox from here.
Download 32 bit firefox from here.

DBD::Pg perl module hasn't been fully installed

install_driver(Pg) failed: Can't locate DBD/Pg.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at (eval 3) line 3.
Perhaps the DBD::Pg perl module hasn't been fully installed
sudo yum install perl-DBD-Pg
If you are using ubuntu, Run
sudo apt-get install libdbd-pg-perl

Friday, June 5, 2015

Install Zend Framework in XAMPP Ubuntu or any other Linux

Install Zend Framework 2 on XAMPP Linux


Ist method :
First change the directory.
cd /opt/lampp/htdocs
Now clone the framework using following git command :
git clone git://github.com/zendframework/ZendSkeletonApplication.git
Now change the directory again.
cd ZendSkeletonApplication
Run Command :
/opt/lampp/bin/php composer.phar self-update
Now
/opt/lampp/bin/php composer.phar install
and finally run command
curl -#L https://github.com/zendframework/ZendSkeletonApplication/tarball/master | tar xz --strip-components=1
Now you can open the zend frame work on your localhost using
http://localhost/ZendSkeletonApplication/public/

IInd method :
Run these commands :
cd /opt/lampp/htdocs
git clone git://github.com/zendframework/ZendSkeletonApplication.git --recursive
Now try to open framework using
http://localhost/ZendSkeletonApplication/public/

Thursday, May 14, 2015

ImportError: No module named pygtk

It means, the python your package is using is not the correct one or source package python.

Find using command `which python`.
If it is /usr/local/bin/python


Rename this file , the original python file will be in /usr/bin/python


Now run your package again.

Thursday, April 2, 2015

Ubuntu / Centos - Linux - Check Hyperthreading is enabled or not

Check Hyperthreading status :

Run command :
cat /proc/cpuinfo

If the number of siblings is equal to the number of cores then you have CPUs which are not hyperthreading or hyperthreading is switched off, If the number of siblings is 2x the number of cores then you have a hyperthreading CPU with hyperthreading switched on.

Friday, March 13, 2015

ssh-add - Add keys permanent

Keys are removed after reboot, Add ssh keys permanent

If you add private keys or .pem files using ssh-add and reboot your system, they are disappeared.

To add the keys permanently, here is the solution.

Suppose your key file is filename.pem and it is in Documents. In this case, Add the following command in your .bashrc file.


ssh-add /root/Documents/filename.pem 2>/dev/null

 
Now this key will be added permanently in your listing.


You can add as many keys you want.

Monday, February 23, 2015

Make xubuntu desktop classic

Remove Unity theme from xubuntu and install classic desktop


Install :
sudo apt-get install xubuntu-desktop gksu leafpad synaptic

Wednesday, February 18, 2015

AWS - Amazon - Stopping the instance changes my public IP

AWS - Public IP should not be changed

When you stop and start instance, it changes your public IP. If you do not want to change every time, Here is a solution for you.
You need to create Elastic IP for it. 
It will generate a new IP and it will not be changed.

EC2 > Elastic IPs (under network and security)
click on Allocate New address - A new IP will be generated
Now connect this IP to your instance.
Select the new created public IP. Click on the Associated Address.
Enter your instance name. It will show current private IP and current public IP in the drop down.
Now associated with it. Now your instance is connected to new created public IP.
Now if you stop or start your instance, public IP will not be changed.



Friday, January 2, 2015

Keep Python Server Running even after closing the terminal



Suppose you use following command to run your python server
python manage.py runserver
But once you close the terminal, process is killed and python server is stopped automatically.
This can be a bigger problem if server is placed remotely and you want to keep it running always whether your system is turned on or turned off.

Here is a solution for you. Use nohup with your command.
nohup your-command &

In this case, Run this command
nohup python manage.py runserver &
Now if you close the terminal, server still runs.

postgres: Postgres-XC: must start as either a Coordinator (--coordinator) or Datanode (--datanode)

Postgresql Server Error in Ubuntu :
postgres: Postgres-XC: must start as either a Coordinator (--coordinator) or Datanode (--datanode)

To remove this error, remove the package
apt-get --purge remove postgres-xc
But if you are not able to remove it because of an error, Find all processes of postgres using
ps aux | grep postgres
or
ps aux | grep psql

and kill all one by one. Now try to remove again.

Now install these packages:
apt-get install postgresql-client-common
apt-get install postgresql-common
apt-get install postgresql-9.3
apt-get install postgresql-client-9.3
apt-get install postgresql-contrib-9.3

* No PostgreSQL clusters exist; see "man pg_createcluster"

psql error : * No PostgreSQL clusters exist; see "man pg_createcluster"

If you are trying to start postgresql server and you get this error.
Here is solution for you.

First you need to find the server version of your postgresql then you need to create cluster.

Suppose your server version is 9.3
pg_createcluster 9.3 main --start


psql: could not connect to server: No such file or directory

 psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?


 If you are trying to open command prompt of postgresql using command psql and it gives above error it means your postgresql server is not started, you need to start it first.
service postgresql start
If it is giving error postgresql: unrecognized service, it means you are not starting correct service, you need to verify the correct name of the service.
Is it postgresql-9.3 or postgresql-9.4 or postgresql-8.4?

Now restart it after confirmation.
service postgresql-9.3 start
or
service postgresql-9.4 start
or
service postgresql-8.4 start

psql: FATAL: Ident authentication failed for user "root"

Postgresql error
psql: FATAL:  Ident authentication failed for user "root"

If you run command psql on terminal as root user and you get the error
psql: FATAL:  Ident authentication failed for user "root"
Here is solution for you. 

To resolve this error, Run these two commands on your terminal.
sudo -u postgres createuser root
It might give you this message
could not change directory to "/root"
Do not worry about it, when it asks
Shall the new role be a superuser? (y/n)

Enter y and press return key.

and the other command is
sudo -u postgres createdb root -O root
Now run command psql on terminal and you will log into postgresql command prompt as user root.

To check the list of postgresql databases, run command
\list

to quit the psql command prompt, run command
\q

Find Orientation of an image captured by a digital camera or mobile / cell phone

Download exiftool tar file from http://www.sno.phy.queensu.ca/~phil/exiftool/ and extract it. Now run these commands.
First change directory.
cd Image-ExifTool-9.78/
Run these commands one by one.

perl Makefile.PL
make
make test
make install

To find the orientation of a camera image run command after installation :

exiftool Orientation -n "/path/of/camera_image.jpg"
Do not use downloaded image, make sure it is clicked by digital camera.

Note : Orientation means the correct position of the image with respect to the camera button when it was clicked.

ssh: Could not resolve hostname bitbucket.org: Name or service not known

If you are trying to run git commands to pull and push and you are getting this. Here is the solution for you.

Open file /etc/resolv.conf and add following line in it

nameserver 8.8.8.8
Now save the file and try to pull/push again.

Warning: No xauth data; using fake authentication data for X11 forwarding

Either you have changed your hostname or any similar activity on your system that's why other system is not identifying you.

Solution :
Run this command on terminal
xauth add :0 . `mcookie`
To check whether your hostname is added in the list or not, run
xauth list
Now ssh into other system, you will not get this error.

Received disconnect from IP: 2: Too many authentication failures for root

Received disconnect from : 2: Too many authentication failures for root

You are getting this error because your public keys are not saved on the server and it is not prompting for password so the public key authentication is failed, it throws you back on the command prompt with error.


The solution is simple. Either you need to save your public keys on server in authorized_keys file or set PubkeyAuthentication=no in your command. Now it will ask for password.

ssh -o PubkeyAuthentication=no server-IP
Example :
If you want to loginto server whose IP is 192.168.0.10, Run

ssh -o PubkeyAuthentication=no 192.168.0.10