enable server

Fix Genymotion virtual devices start error


Recently I was doing some work on hybrid mobile app development. In past days I used windows for mobile app development particular Android Development with Android Studio on Android.

This time I was running Ubuntu and installed Genymotion. Created virtual devices and I encountered issue which reported that “Virtualbox was somehow unable to assign IP to virtual device” and always linked me to this Genymotion FAQ (https://www.genymotion.com/#!/support?chapter=collapse-nostart#faq). I tried every possible way to get rid of this problem. Tried solution given in the above page. After many failed attempts finally got the solution.

1. Disable firewall (ufw)

$ sudo ufw disable
$ sudo service ufw stop 

2. Configure the Network Interface in vitualbox as shown in below screenhosts.
Host only networks

Configure Adapter - 1

Enable Server

Match your settings as shown in above screenshots. Save the settings and re-start the Genymotion virtual devices. Wait for few seconds and it should start to show up.

if you have any confusions drop your comments.


Walkthrough on remote access to Ubuntu14.04


I often access my ubuntu machine remotely and today I will be describing how I setup my machine to access it remotely from anywhere through internet. This is not a step by step guide rather it’s a kind of walkthrough and giving overview on how I knitted each bits and pieces to get the job done. To understand this post, you will need to have basic understanding of IP addresses, basic understanding on router, port forwarding, installing/uninstalling applications on Ubuntu, webserver for hosting php files, basic understanding of cron jobs on linux.

Let’s get to the point, at first I installed xrdp on my Ubuntu box and then installed xfce4. I found this http://www.tweaking4all.com/software/linux-software/use-xrdp-remote-access-ubuntu-14-04/ link very helpful. I won’t explain how to install xrdp and xfce4. Follow the link and you will have xrdp and xfce4 installed at the end of that post.

Now the next part is to configure the router. At first enable the remote management port in your router. This instruction differ from router to router so find the instruction that suits to your case. After that forward the port 3389 to your local network IP (for e.g. This local IP will be generally one assigned by your router to your local machine, if DHCP is enabled in your router otherwise you’ll have to manually assign static IP to your local machine. Now the most important part is to get dynamic IP. This dynamic IP is what other users on internet will use to access your computer directly. This dynamic IP varies everytime you make connections to your ISP. Each time your router connects to ISP, each time it gets a new IP assigned by ISP so knowing this IP is crucial part. this IP will be used to access your router remotely and then configure port forwarding to the local machine. I am using a php script to get the dynamic IP. I found a little PHP snippet that does the job of finding the ISP assigned IP address (WAN IP).

//Filename : ip.php

$externalContent = file_get_contents('http://checkip.dyndns.com/');
preg_match('/Current IP Address: ([\[\]:.[0-9a-fA-F]+)</', $externalContent, $m);
$externalIp = $m[1];
$date = new DateTime();
echo "Last updated :". $date->format("m/d/Y H:i:s a");
echo PHP_EOL;
echo "WAN IP: ".$externalIp;

The output is

Last updated :10/17/2014 21:30:02 pm

Save the above php snippet in ip.php and put it inside htdocs of your local webserver. In my case, I have kept ip.php file in my webserver’s test folder accessible at http://test/ip.php.

I have set cron job in my machine that runs ip.php file and saves the out on wan.txt file. I have another shell script (ftp.sh) which uploads this wan.txt file to my personal web-space. Now, this uploaded wan.txt is accessible from internet at (http://www.samundra.com.np/wan/wan.txt). I am now able to get the dynamic address assigned to my machine everytime. Below is the cronjob settings and ftp.sh contents.


echo "Uploading ip.txt via ftp"
ftp -inv $HOST << EOF user $USER $PASS put "wan.txt" "wan.txt" bye

Put the appropriate settings on HOST, USER, PASS and then save the ftp.sh and put in the same location where you have kept ip.php.

Cronjob settings

*/5 * * * * /usr/bin/wget -q -O wan.txt http://test/ip.php
*/5 * * * * /var/www/test/ftp.sh

Those were all, what I did for getting my machine to internet. I have configured various services on my machine and use them on regular basis using remote access. When you are exposing your machines to the wild you need to take precautions and use tight security measures which I haven't mentioned here. Hope this sharing helps someone out there.

Let me know your comments and feedbacks. I will try to answer your queries as soon as possible.

[Solved] Mount of root filesystem failed – Ubuntu


I `dist-upgrade` my system yesterday. And there were few issues with locale package with my terminal. I manually edited the file `/etc/default/locale` and in hasty copy pasted the few codes found online at (http://askubuntu.com/questions/33025/locale-settings-are-not-right-how-can-i-reset-them). I then saved and restarted my laptop to see the changes. Bang ! I began to receive the error.

Mount of root filesystem failed.
A maintenance shell will now be started.
CONTROL-D will terminate this shell and reboot the system.
Give root password for maintenance
(or type CONTROL-D to continue):

I tried to recover with system recovery option but then I got the following error message.
Highlighted in red.

Recovery Menu (filesystem state:read-only)
resume Resume normal boot

Recovery Menu (filesystem state:read-only)

I then first ran the system scan on my linux partition.

# fdisk -l

List all the partition and clearly shows that /dev/sda7 is the Linux partition.
Output of fdisk -l

# e2fsck -C0 -p -f -v /dev/sda7

Since, I guessed the problem might have been caused due to corrupt locale file, I wanted to fix that first to see if that solves the problem and it did finally. I first mounted the root partition, so that it is no longer readonly.

# mount -ro remount,rw /
# vi /etc/default/locale

The first command remounts the root linux partition as read/write so that I can make changes to the files. I then opened the /etc/default/locale in vi and added the missing tag. Saved the file and then restarted the computer.

# reboot

Note: All of the above commands are carried out as root so you have to be very careful before running any unknown commands at this point, you might delete the system files and make the situation more worse. I won’t be responsible if anything happens to your computer after you run the above commands.

After success restart I got my laptop normal. Hope this helps you.

Introduction to drush for drupal development


What is drush ?

Drush is very popular and useful tool for drupal developers. It provides us shell access to the drupal commands and functions which otherwise had to be accessed using the menus provided in the drupal administration. It helps us to enable/disable modules, installs  dependency modules automatically, manage users, permissions etc. For complete feature of drush browse this page.

In short drush is just like other command line tools ūüôā Sweet.

Drush official page is http://drupal.org/project/drush

drush was initially created for linux/mac environments however it can be run on windows as well.

Drush can be installed in linux,mac and windows. But runs faster in linux, at least I felt so personally.

For Ubuntu
Type the following command

$ sudo apt-get install drush

when asked enter your computers password and hit enter

For Other Linux Distributions
Download the source from drush source extract it and then follow the readme.txt.

Actually you download the shell script for the drush and make it executable for the current user by adding the path to drush in environment variable so that it’s always available for the execution. To¬†use Drush from the command line, you’ll need a CLI-mode capable PHP binary¬†version 5.2 or greater.

For Windows
1. Visit http://drush.ws/drush_windows_installer
2. Download Drush 5.8 Windows Installer
3. Follow the Installation Guide

How to verify I you have installed drush successfully or not ?
– execute command ‘drush version’ at command prompt, it should show you output something like “drush verison 5.8”. It means you have successfully configured drush.

How to use drush ?
– cd into the root folder of your drupal project. For eg. my drupal project is in /media/BACKUP/htdocs/news/
– then I use “cd /media/BACKUP/htdocs/news”

Then to clear the cache I use “drush cc all” and response is

‘all’ cache was cleared in /media/BACKUP/htdocs/news#default ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬† ¬†¬†[success]

You can try with other commands like “drush en module-name”

Hope this gives your short introduction on drush usage for drupal development. If you want to know more information about this then drop comments. Thanks.