Friday, 27 March 2015

How To Upgrade Ubuntu 14.04 Trusty To Ubuntu 14.10 Utopic

Do you want to upgrade to Ubuntu 14.10 from Ubuntu 14.04/13.10/13,04/12,10/12.04, or older version on your system? Just follow the simple steps given below. Please note that you can’t directly upgrade from 13.10 to 14.04. First, you should upgrade from 13.10 to 14.04, and then upgrade from 14.04 to 14.10. Clear? Good. Now, Let us start the upgrade process.
Though, the steps provided below are compatible for Ubuntu 14.10, It might work for other Ubuntu derivatives such as Lubuntu 14.10, Kubuntu 14.10, and Xubuntu 14.10 as well.
Important: Before upgrading, don’t forget to backup your important data to any external device like USB hdd or CD/DVD.

Desktop Upgrade

Before going to upgrade, we need to update the system. Open up the Terminal and enter the following commands.
sudo apt-get update && sudo apt-get dist-upgrade
The above command will download and install the available latest packages.
Reboot your system to finish installing updates.
Now, enter the following command to upgrade to new available version.
sudo update-manager -d
Software Updater will show up and search for the new release.
After a few seconds, you will see a screen like below that saying: “However, Ubuntu 14.10 is available now (you have 14.04)”. Click on the buttonUpgrade to start upgrading to Ubuntu 14.10.
Software Updater_001
The Software Updater will ask you to confirm still you want to upgrade. Click Start Upgrade to begin installing Ubuntu 14.10.
Release Notes_002
Please Note: This is a beta release. Do not install it on production systems. The final stable version will be released in a couple of hours.
Now, the Software Updater will prepare to start setting up new software channels.
Distribution Upgrade_003
After a few minutes, the software updater will notify you the details the number of packages are going to be removed, and number of packages are going to be installed. Click Start upgrade to continue. Make sure you have good and stable Internet connection.
Untitled window_004
Now, the updater will start to getting new packages. It will take a while depending upon your Internet connection speed.
Distribution Upgrade_005
Distribution Upgrade_001
After a while, you’ll be asked to remove unnecessary applications. Finally, clickRestart to complete the upgrade.
Congratulations! Now, you have successfully upgraded to Ubuntu 14.10.
Details_002
That’s it.. Start using the new Ubuntu version.

Server Upgrade

To upgrade from Ubuntu 14.04 server to Ubuntu 14.10 server, do the following steps.
Install the update-manager-core package if it is not already installed:
sudo apt-get install update-manager-core
Edit the file /etc/update-manager/release-upgrades,
sudo nano /etc/update-manager/release-upgrades
and set Prompt=normal or Prompt=lts as shown below.
# Default behavior for the release upgrader.

[DEFAULT]
# Default prompting behavior, valid options:
#
#  never  - Never check for a new release.
#  normal - Check to see if a new release is available.  If more than one new
#           release is found, the release upgrader will attempt to upgrade to
#           the release that immediately succeeds the currently-running
#           release.
#  lts    - Check to see if a new LTS release is available.  The upgrader
#           will attempt to upgrade to the first LTS release available after
#           the currently-running one.  Note that this option should not be
#           used if the currently-running release is not itself an LTS
#           release, since in that case the upgrader won't be able to
#           determine if a newer release is available.
Prompt=normal
Now, it is time to upgrade your server system to latest version using the following command:
sudo do-release-upgrade -d
Follow the on-screen instructions. You’re done!!.
Cheers!!

Upgrade To Firefox 30 On Ubuntu via Official Repository

Users wanting to upgrade can to via the terminal or Synaptic.
From Terminal.
sudo apt-get update
sudo apt-get install firefox
firefox_from_terminal
Using Synaptic
Launch Synaptic
Refresh package for latest updates.
Search for Firefox
Right click on firefox and Select Mark for upgrade.
Mark_Firefox_for_upgrade
Apply changes.
apply changes
wait for download and upgrade.
firefox_upgrade_2
You’re done.

HHVM – An Open Source PHP Virtual Machine Developed By Facebook

HHVM, stands for HipHop Virtual Machine, is an open source virtual machine developed by Facebook development team. It is designed for executing massive amount of codes written in Hack and PHP languages. HHVM gives superior performance, and improves the efficiency of PHP execution, and increases the productivity for the developers. The developers says that compared with the regular Zend PHP 5.2 engine + APC, HHVM has realized over a 9x increase in web request throughput and over a 5x reduction in memory consumption for Facebook. This is how Facebook handling millions of active users everyday. According to this blog, the wordpress sites running with HHVM delivers better overall performance, approximately 63%, than the websites which are running using traditional LAMP stack (Apache, MySQL, and PHP). Sounds awesome? Indeed!
HHVM will work on all modern operating systems such as GNU/Linux, Windows, and Mac OS.
HHVM has many features including the following:
  • The Hack Language;
  • JIT Compilation;
  • HNI;
  • FastCGI support;
  • Increasing PHP5 Parity;
  • hphpd debugger;
  • … and more.
Well, let us see how to install it on a Linux system.

Installing HHVM On Ubuntu 14.04

Run the following commands to add HHVM repository, and install hhvm package.
wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add -
echo deb http://dl.hhvm.com/ubuntu trusty main | sudo tee /etc/apt/sources.list.d/hhvm.list
sudo apt-get update
sudo apt-get install hhvm
For other distribution’s installation instructions, please refer the official page given in the bottom this article.
After the installation has finished, you may get the following result.
In my Ubuntu 14.04 server, I got the following result.
[...]

* HHVM is installed.
* 
* Running PHP web scripts with HHVM is done by having your webserver talk to HHVM
* over FastCGI. Install nginx or Apache, and then:
* $ sudo /usr/share/hhvm/install_fastcgi.sh
* $ sudo /etc/init.d/hhvm restart
* (if using nginx)  $ sudo /etc/init.d/nginx restart
* (if using apache) $ sudo /etc/init.d/apache restart
* 
* Detailed FastCGI directions are online at:
* https://github.com/facebook/hhvm/wiki/FastCGI
* 
* If you're using HHVM to run web scripts, you probably want it to start at boot:
* $ sudo update-rc.d hhvm defaults
* 
* Running command-line scripts with HHVM requires no special setup:
* $ hhvm whatever.php
* 
* You can use HHVM for /usr/bin/php even if you have php-cli installed:
* $ sudo /usr/bin/update-alternatives --install /usr/bin/php php /usr/bin/hhvm 60
********************************************************************
Setting up libpaper-utils (1.1.24+nmu2ubuntu3) ...
Processing triggers for libc-bin (2.19-0ubuntu6.1) ...
As you see in the above result, HHVM gives us the script to install and configure FastCGI for our webserver.
For example, If you use apache web server, then run the following commands:
sudo /usr/share/hhvm/install_fastcgi.sh
sudo /etc/init.d/hhvm restart
sudo /etc/init.d/apache restart
For nginx web server, run the following commands:
sudo /usr/share/hhvm/install_fastcgi.sh
sudo /etc/init.d/hhvm restart
sudo /etc/init.d/nginx restart
If you want to start hhvm service automatically on ever reboot, run the following command:
sudo update-rc.d hhvm defaults
Now, check whether HHVM is installed properly by running the following command.
hhvm -a
Oops! You might get the following error.
hhvm: error while loading shared libraries: libgmp.so.10: cannot open shared object file: No such file or directory
To fix this error, install the missing dependency package “libgmp10″ by entering the following command:
sudo apt-get install libgmp10
Then, restart the hhvm service:
sudo service hhvm restart
You should be able to see something like this:
hhvm -a
Welcome to HipHop Debugger!
Type "help" or "?" for a complete list of commands.

Note: no server specified, debugging local scripts only.
If you want to connect to a server, launch with "-h" or use:
  [m]achine [c]onnect <servername>

hphpd> 
Type quit to return back to your Terminal session.
The following command shows you how to use hhvm.
 hhvm --help
Sample output:
Usage:

   hhvm [-m <mode>] [<options>] [<arg1>] [<arg2>] ...

Options:
  --help                                display this message
  --version                             display version number
  --php                                 emulate the standard php command line
  --compiler-id                         display the git hash for the compiler
  --repo-schema                         display the repository schema id
  -m [ --mode ] arg (=run)              run | debug (d) | server (s) | daemon |
                                        replay | translate (t)
  -a [ --interactive ]                  Shortcut for --mode debug
  -c [ --config ] arg                   load specified config file
  -v [ --config-value ] arg             individual configuration string in a 
                                        format of name=value, where name can be
                                        any valid configuration for a config 
                                        file
  -d [ --define ] arg                   define an ini setting in the same 
                                        format ( foo[=bar] ) as provided in a 
                                        .ini file
  --no-config                           don't use the default php.ini
  -p [ --port ] arg (=-1)               start an HTTP server at specified port
  --port-fd arg (=-1)                   use specified fd instead of creating a 
                                        socket
  --ssl-port-fd arg (=-1)               use specified fd for SSL instead of 
                                        creating a socket
  --admin-port arg (=-1)                start admin listener at specified port
  --debug-config arg                    load specified debugger config file
  -h [ --debug-host ] [=arg(=localhost)]
                                        connect to debugger server at specified
                                        address
  --debug-port arg (=-1)                connect to debugger server at specified
                                        port
  --debug-extension arg                 PHP file that extends command 'arg'
  --debug-cmd arg                       executes this debugger command and 
                                        returns its output in stdout
  --debug-sandbox arg (=default)        initial sandbox to attach to when 
                                        debugger is started
  -u [ --user ] arg                     run server under this user account
  -f [ --file ] arg                     execute specified file
  -l [ --lint ] arg                     lint specified file
  -w [ --show ] arg                     output specified file and do nothing 
                                        else
  --temp-file                           file specified is temporary and removed
                                        after execution
  --count arg (=1)                      how many times to repeat execution
  --no-safe-access-check arg (=0)       whether to ignore safe file access 
                                        check
  --arg arg                             arguments
  --extra-header arg                    extra-header to add to log lines
  --build-id arg                        unique identifier of compiled server 
                                        code
  --instance-id arg                     unique identifier of server instance
  --xhprof-flags arg (=0)               Set XHProf flags

Testing PHP scripts using HHVM

Let us create a sample php scrip called unixmen.php.
vi unixmen.php
Add the following lines:
<?php

echo "HHVM is working\n";
Save and close the file.
Run the following command to test the script.
hhvm unixmen.php
Sample output:
HHVM is working

Configuring HHVM in the FastCGI mode with Apache Web server

As of version 3.0, HHVM no longer supports the built-in webserver, You should use your own webserver (nginx or apache) talking to HHVM over fastcgi.
First install apache web server in Ubuntu server as shown below.
sudo apt-get install apache2 -y
To check whether the apache is working, open up your web browser, and navigate to the URL http://ip-address. You may see the following like screen.
Apache2 Ubuntu Default Page: It works - Mozilla Firefox_001
Now, enter the following commands to configure HHVM in the FastCGI mode with apache web server.
sudo /usr/share/hhvm/install_fastcgi.sh
sudo /etc/init.d/hhvm restart
HHVM will be automatically configured for apache server, so you don’t have to do anything. You may notice that the php.ini, and server.ini files have been created automatically under the directory /etc/hhvm/.
sudo cat /etc/hhvm/php.ini
Sample output:
; php options

; hhvm specific 
hhvm.log.level = Warning
hhvm.log.always_log_unhandled_exceptions = true
hhvm.log.runtime_error_reporting_level = 8191
hhvm.mysql.typed_results = false
sudo cat /etc/hhvm/server.ini
Sample output:
; php options

pid = /var/run/hhvm/pid

; hhvm specific 

hhvm.server.port = 9000
hhvm.server.type = fastcgi
hhvm.server.default_document = index.php
hhvm.log.use_log_file = true
hhvm.log.file = /var/log/hhvm/error.log
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc

Configuring HHVM in the FastCGI mode with nginx Web server

Install nginx package:
sudo apt-get install nginx
To check whether the nginx server is working, open up your web browser, and navigate to the URL http://ip-address. You may see the following like screen.
Welcome to nginx! - Mozilla Firefox_002
Now, enter the following commands to configure HHVM in the FastCGI mode with nginx web server.
sudo /usr/share/hhvm/install_fastcgi.sh
sudo /etc/init.d/hhvm restart
HHVM will be automatically configured for nginx. You may see the hhvm.confwill be created automatically.
Let us check the contents of hhvm.conf file.
sudo cat /etc/nginx/hhvm.conf
Sample output:
location ~ \.(hh|php)$ {
    fastcgi_keep_conn on;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include        fastcgi_params;
}
If you have used php-fpm before, the above lines will look familiar to you.
Also, check /etc/nginx/sites-available/default file to verify whether thishhvm.conf has been included.
sudo cat /etc/nginx/sites-available/default
Sample output:
Scroll down to the server derivative. You should the file hhvm.conf has been included already.
[...]
server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /usr/share/nginx/html;
    index index.html index.htm;

    # Make site accessible from http://localhost/
    server_name localhost;
    include hhvm.conf;
[...]
That’s it. Cheers!

Tuesday, 3 March 2015

Install Skype On Ubuntu 14.10/14.04/12.04

Skype is a popular free voice over IP and instant messenger that can be used to text, video and voice calls over Internet. We can send Instant messages, Video messages,a and share files and videos to our friends and families from anywhere in the world. Also, we can call to landline and other mobile phones with competitive prices. Skype supports Windows, Mac, Linux, and many mobile devices such as Blackberry, Android, iOS, Windows phones, Tablets, and Smartphones as well.

Install Skype On Ubuntu 14.10/14.04/12.04

Prior to version Skype 4.3, it was available as binary file, so that users can only download the binary file from it’s official and install it manually. But, as of version 4.3, Skype is available in the Canonical Partners repository.
To enable the Canonical Partners repository, go to Software & Updates from Unity dash. Navigate to Other Software tab, and enable Canonical Partners repository.
Software & Updates_001
Click Close, and Reload buttons to update the cache.
Then, type the following command before installing skype
sudo apt-get update
Then, type the following command to install Skype.
sudo apt-get install skype
That’s it. Open Skype, and log in to your Skype account and stat chatting.
Skype™ 4.3 for Linux_002
Cheers!!

Fix Windows 8 (Dual Boot) NTFS Partition Mount Failure In Ubuntu

Below is error message viewed when you try mounting NTFS partitions:

no_no

Error mounting /dev/sda3 at /media/elliot/Data: Command-line `mount -t "ntfs" -o "uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,dmask=0077,fmask=0177" "/dev/sda3" "/media/elliot/Data"' exited with non-zero exit status 14: The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
Failed to mount '/dev/sda3': Operation not permitted
The NTFS partition is in an unsafe state. Please resume and shutdown
Windows fully (no hibernation or fast restarting), or mount the volume
read-only with the 'ro' mount option.

Reasons

After series of searches, reasons for this were

1. Windows didn’t shutdown properly or has been hibernated.
2. Fast start up has been enabled in Windows 8 (this is by default)

Solutions

1. Reboot Windows and then boot into Ubuntu.

2. Disable fast start up in Windows 8, by navigating to Control Panel –> Hardware and Sound –> Power Options –> System Setting –> Select What the power buttons does and un-check the Turn on fast startup.


You should be able to access you NTFS partitions now.

How To Migrate From MySQL To MariaDB On Linux

MariaDb is an enhanced drop-in replacement and community-developed fork of the MySQL database system. It was developed by MariaDB foundation, and is being led by original developers of MySQL. Working with MariaDB is entirely same as MySQL. After Oracle bought MySQL, it is not free and open source anymore, but MariaDB is still free and open source.
According to themukt,
What Oracle is doing wrong:
  • New ‘enterprise’ extensions in MySQL are closed source:
  • The bugs database is not public anymore
  • The MySQL public repositories are not anymore actively updated.
  • Security problems are not communicated nor addressed quickly (This is making Linux distributions very annoyed with Oracle)
  • Instead of fixing bugs, Oracle is removing features:
  • New code in MySQL 5.5 doesn’t have test cases anymore.
  • Some of the new code is surprisingly good by Oracle, but unfortunately the quality varies and a notable part needs to be rewritten before we can include it in MariaDB
Well, are you done with MySQL? Come on, let us migrate from MySQL to MariaDB. The migration method is much simpler than you think.

Let’s Migrate

For the testing purpose, let us create two sample databases called testdb1, and testdb2.
Log in to MySQL as root user using the following command:

mysql -u root -p

Enter the mysql root user password. You’ll be redirected to the mysql prompt.
Create test databases:
Enter the following commands from mysql prompt to create test databases.

mysql> create database testdb1;
Query OK, 1 row affected (0.00 sec)

mysql> create database testdb2;
Query OK, 1 row affected (0.00 sec)

To see the list of available databases, enter the following command:

mysql> show databases;

Sample output:
 +--------------------+
 | Database           |
 +--------------------+
 | information_schema |
 | mysql              |
 | performance_schema |
 | testdb1            |
 | testdb2            |
 +--------------------+
 5 rows in set (0.00 sec)

As see above, we have totally 5 databases including the newly created databases testdb1 and testdb2.

1. Backup existing databases

The first important step is to take backup of existing databases. To do that, enter the following command from the Terminal (not from MySQL prompt).

mysqldump --all-databases --user=root --password --master-data > backupdatabase.sql

Oops! I got the following error.

mysqldump: Error: Binlogging on server not active

To fix this error, we have to do a small modification in my.cnf file.

Edit my.cnf file:

On Debian/Ubuntu:
sudo vi /etc/mysql/my.cnf

On RPM based systems:
sudo vi /etc/my.cnf

Under [mysqld] section, add the following parameter.
log-bin=mysql-bin

Sample output of my my.cnf file.
 [...]
 [mysqld]
 #
 # * Basic Settings
 #
 user            = mysql
 pid-file        = /var/run/mysqld/mysqld.pid
 socket          = /var/run/mysqld/mysqld.sock
 port            = 3306
 basedir         = /usr
 datadir         = /var/lib/mysql
 tmpdir          = /tmp
 lc-messages-dir = /usr/share/mysql
 skip-external-locking
 log-bin=mysql-bin
 [...]

Save and exit file. Restart mysql server.

On RPM based systems:
sudo /etc/init.d/mysqld restart

On Debian based systems:
sudo /etc/init.d/mysql restart

Now, re-run the mysqldump command to backup all databases.

mysqldump --all-databases --user=root --password --master-data > backupdatabase.sql

Sample output:

Enter password:
 -- Warning: Skipping the data of table mysql.event. Specify the --events option explicitly.

The above command will backup all databases, and stores them in backupdatabase.sql in the current directory.

2. Stop MySQL services and remove all mysql packages

First, backup the my.cnf fie to a safe location.

Note: The my.cnf file will not be deleted when uninstalling MySQL packages. We do it for the precaution. During MariaDB installation, the installer will ask you to keep the existing my.cnf(old backup) file or to use the package containers version (i.e new one).

On RPM systems:
sudo cp /etc/my.cnf my.cnf.bak

On Deb systems:
sudo cp /etc/mysql/my.cnf my.cnf.bak

To stop mysql service, enter the following command from your Terminal.

On RPM based systems:
sudo /etc/init.d/mysqld stop

On Debian based systems:
sudo /etc/init.d/mysql stop
Then, remove mysql packages.

On RPM systems:
sudo yum remove mysql* mysql-server mysql-devel mysql-libs

The above command will take the backup of your current MySQL config file /etc/my.cnf to /etc/my.cnf.rpmsave.

On Debian based systems:
sudo apt-get remove mysql-server mysql-client

3. Install MariaDB

The latest CentOS 7 and Ubuntu 14.10, 14.04 contains MariaDB packages in their official repositories. If you want to use the most recent version MariaDb, add the MariaDB official repositories depending upon your OS version.

Install MariaDB On RHEL 7 based systems:

Create a file /etc/yum.repos.d/mariadb.repo,

vi /etc/yum.repos.d/mariadb.repo

Add the following lines:
# MariaDB 5.5 CentOS repository list - created 2014-12-09 08:11 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Update the repositories and install mariadb using the following commands:

sudo yum update 
sudo yum install MariaDB-server MariaDB-client

Start mysql service using the following command:

sudo /etc/init.d/mysqld start
sudo chkconfig mysqld on

Or,
sudo systemctl start mysqld
sudo systemctl enable mysqld

After installing MariaDB, you should set the database root user 
password. To do that, execute the following command from your Terminal.

mysql_secure_installation

Install MariaDB On Ubuntu 14.04:

Here are the commands to run to install MariaDB on your Ubuntu system:

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
sudo add-apt-repository 'deb http://mirror.mephi.ru/mariadb/repo/5.5/ubuntu trusty main'

Once the key is imported and the repository added you can install MariaDB with:

sudo apt-get update
sudo apt-get install mariadb-server

Keep in mind that during MariaDB installation, the installer will ask you either to use the existing my.cnf(old
 backup) file, or use the package containers version (i.e new one). You 
can either use the old my.cnf file or the package containers version. If
 you want to use the new my.cnf version, you can restore the contents of
 older my.cnf (We already have copied this file to safe location before)
 later.
For other versions, please refer the MariaDB official repositories page.

4. Copy contents of my.cnf.bak(old backup) file to new my.cnf file

To do that, enter the following command in Terminal. I have the old my.cnf.bak file in my current directory, so I simply copied the file using the following command:

On RPM systems:
sudo cp my.cnf.bak /etc/my.cnf

On DEB systems:
sudo cp my.cnf.bak /etc/mysql/my.cnf

5. Import Databases

Finally, let us import the old databases which we’ve created in the first step using the following command.

mysql -u root -p < backupdatabase.sql

That’s it. We have successfully imported the old databases.
Let us check if the databases are really imported. To do that, log in to mysql prompt using command:

mysql -u root -p

Run show databases; command from mysql prompt to check for the databases.

MariaDB [(none)]> show databases;

Sample output:
 +--------------------+
 | Database           |
 +--------------------+
 | information_schema |
 | mysql              |
 | performance_schema |
 | testdb1            |
 | testdb2            |
 +--------------------+
 5 rows in set (0.00 sec)

As you see in the above result all old databases including testdb1 and testdb2 have been successfully imported.

That’s all. Start using MariaDb.

Disclaimer: Be careful while using these steps in production environment. Also, refer the MariaDB official documentations for further clarifications. If you don’t know what you’re doing, please ask a Database administrator help. Don’t lose your precious database backup.

Good luck! 

Linux Basics: How To Convert Mp4 To MP3

Why do we need to convert from MP4 to MP3?
It saves spaces in our devices, and some of the basic model devices are not supported with mp4 extension. In this example, we are going to use ffmpeg to convert MP4 to MP3.
FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. It includes libavcodec – the leading audio/video codec library.
Install ffmpeg On Ubuntu
sudo apt-get install ffmpeg libavcodec-extra-53
Converting MP4 to MP3
Basic command:
ffmpeg -i filename.mp4 filename.mp3
Find out the more options of this command with man page. (man ffmpeg)
ffmpeg -i filename.mp4 -b:a 192K -vn filename.mp3
A stream specifier can match several stream, the option is then  applied to all of them. E.g. the stream specifier in “-b:a 128k” matches all audio streams.
By Script:
The following script is going to convert all file with extension .mp4 in the folder Music to .mp3.
#!/bin/bash
MP4FILE=$(ls ~/Music/ |grep .mp4)
for filename in $MP4FILE
do 
 name=`echo "$filename" | sed -e "s/.mp4$//g"`
 ffmpeg -i ~/Music/$filename -b:a 192K -vn ~/Music/$name.mp3
done

How To Find IP Conflicts In Linux

You all know what IP addresses are, right? How they are assigned to devices on a network to represent them. They are assigned by DHCP servers and the change frequently. Now there are two kinds of IP’s. The dynamic ones who change frequently (a few times a day) and the static ones who, as the name suggests, are static, as in they don’t change. Sometimes that creates conflicts. When a dynamic IP is assigned and there is already another device on the network with the same static IP. Or it can happen when there are more than one DHCP servers giving IP’s on the same network from the same subnet. If you’re having connectivity issues and suspect it is due to IP conflict you can use a tool called arp-scan to detect them.

This tool sends ARP (Address Resolution Protocol) packets on local network to collect the addresses. If there is multiple MAC addresses claiming the same IP address, then there is conflict.
To install arp-scan on Ubuntu or Debian type:

$ sudo apt-get install arp-scan

For Fedora, CentOS or Redhat:

$ sudo yum install arp-scan

To detect IP conflicts, run the following:

$ sudo arp-scan –I eth0 -l

An output example:

192.168.1.10   00:1b:a9:63:a2:4c       BROTHER INDUSTRIES, LTD.
192.168.1.30   00:1e:8f:58:ec:49       CANON INC.
192.168.1.33   00:25:4b:1b:10:20       Apple, Inc
192.168.1.37   10:9a:dd:55:d7:95       Apple Inc
192.168.1.38   20:c9:d0:27:8d:56       (Unknown)
192.168.1.39   d4:85:64:4d:35:be       Hewlett Packard
192.168.1.39   00:0b:46:e4:8e:6d       Cisco (DUP: 2)
192.168.1.40   90:2b:34:18:59:c0       (Unknown)


In this instance, the 19.168.1.39 IP is in conflict since it appears twice.