How to dowgrade linux(ubuntu) kernel to previous version

Recently we are bitten by the OOM bug in the ubuntu kernel version 4.4.0-59-generic. The fix will be released in updates channel tentatively on Feb 20 2017. We can’t wait till that time. So  We decided to roll back to the previous kernel version 4.4.0-57-generic.

To install the previous version

sudo apt-get install linux-image-4.4.0-57-generic linux-headers-4.4.0-57-generic

Now we need to select the installed kernel as default kernel to boot in the grub.

Finding out the offset of out kenel menu entry in /boot/grub/grub.cfg

 cat /boot/grub/grub.cfg  | grep "menuentry"

The output would be


if [ x”${feature_menuentry_id}” = xy ]; then
export menuentry_id_option
menuentry ‘Ubuntu’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-simple-cfda0544-9803-41e7-badb-43563085ff3a’ {
submenu ‘Advanced options for Ubuntu’ $menuentry_id_option ‘gnulinux-advanced-cfda0544-9803-41e7-badb-43563085ff3a’ {

menuentry ‘Ubuntu, with Linux 4.4.0-59-generic‘ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-59-generic-advanced-cfda0544-9803-41e7-badb-43563085ff3a’ {
menuentry ‘Ubuntu, with Linux 4.4.0-59-generic (recovery mode)’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-59-generic-recovery-cfda0544-9803-41e7-badb-43563085ff3a’ {
menuentry ‘Ubuntu, with Linux 4.4.0-57-generic’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-57-generic-advanced-cfda0544-9803-41e7-badb-43563085ff3a’ {
menuentry ‘Ubuntu, with Linux 4.4.0-57-generic (recovery mode)’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-57-generic-recovery-cfda0544-9803-41e7-badb-43563085ff3a’ {
menuentry ‘Ubuntu, with Linux 4.4.0-53-generic’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-53-generic-advanced-cfda0544-9803-41e7-badb-43563085ff3a’ {
menuentry ‘Ubuntu, with Linux 4.4.0-53-generic (recovery mode)’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-53-generic-recovery-cfda0544-9803-41e7-badb-43563085ff3a’ {
menuentry ‘Ubuntu, with Linux 4.4.0-51-generic’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-51-generic-advanced-cfda0544-9803-41e7-badb-43563085ff3a’ {
menuentry ‘Ubuntu, with Linux 4.4.0-51-generic (recovery mode)’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-51-generic-recovery-cfda0544-9803-41e7-badb-43563085ff3a’ {
menuentry ‘Ubuntu, with Linux 4.4.0-45-generic’ –-class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-45-generic-advanced-cfda0544-9803-41e7-badb-43563085ff3a’ {
menuentry ‘Ubuntu, with Linux 4.4.0-45-generic (recovery mode)’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-45-generic-recovery-cfda0544-9803-41e7-badb-43563085ff3a’ {


The boot kernel we want to select is menuentry ‘Ubuntu, with Linux 4.4.0-57-generic’ which is submenu of Advanced options for Ubuntu.

Now change GRUB_DEFAULT=0 in  /etc/default/grub to GRUB_DEFAULT=”Advanced options for Ubuntu>Ubuntu, with Linux 4.4.0-57-generic” and execute update-grub & reboot the machine.

After the machine comes up  check the kernel version using the command uname -r 


Posted in kernel, Linux, system administration | Leave a comment

Nodemcu Blink Example

Nodemcu Working LED Blink Example

-- Blink using timer alarm --
timerId = 0
dly = 1000
-- use D4
ledPin = 4
-- set mode to output
ledState = 0
-- timer loop
tmr.alarm( timerId, dly, 1, function()
ledState = 1 - ledState;
-- write state to D4
gpio.write(ledPin, ledState)

Posted in IoT | Leave a comment

Setting up Redis High Availability (HA) cluster using Sentinel

We were running redis server in one of our machine which serves one of our mirco service. The redis service was running happily for 3 months. One day suddenly redis server stopped responding because machine ran out of disk space. Initially, Redis was used by only one service. Over the months many service started using the same redis. When redis went down almost all our components came stand still.

Redis has grown to be the critical component of our system. We wanted it to be highly available and fault tolerant. We started exploring the HA options. There are two ways we can go with:

  1. Since our whole infra runs on AWS we can go with Elasticache
  2. We can setup our own HA cluster in EC2 machines.

The workload on the redis is very minimal regarding cpu , network, and memory with occasional bursts on load. We have decided to setup our own redis-server because the minimum cost required to run  a redis HA cluster in Elasticache is 130$.

Sentinel is very light on resource usage and easy to configure.  Our current setup goes like the following

1 Master (us-east-1a  zone)<— 1 Slave (us-east-1b zone)

3 sentinel servers in 3 availability zone.

After the setup when we killed the redis master the automatic promotion of slave didn’t happen. After lots of frustrating hours we found out that we have disabled SLAVEOF Command in the redis server config. Since we disabled the SLAVEOF Command, sentinal has no way of promoting the slave to master.  After we fixed the issue  sentinel promotion worked way cool.



Posted in Application Development, Cloud Computing, Database, elasticache, Linux, NoSQL, redis, sentinel | Leave a comment

mysql ssh tunneling on ec2 instance

ssh -L -i .ssh/MyKey.pem


This will connect to mysql running on on port 3306 through this  host with user name ec2-user whenever we connect localhost port 4000.

To connect to mysql server just point your mysql-workbench with hostname localhost and port 4000

Posted in Cloud Computing | Tagged , , , | Leave a comment

Setting up play framework 2.2.x with Intellij IDEA 13.x.x

Recently i tried to prototype an application with Play Framework 2.2. After going through official document i was able run the quickstart application. I want to integrate play development work with intellij IDEA 13 because IDEA is my preferred IDE after moving out from eclipse. I was using intellij IDEA 13 ultimate edition.

The IDEA should have following plugins installed.

scala , play framework , play framework 2.0(available only in ultimate edition)

To create a new app in terminal

play new fixit
cd fixit
play idea

I was faced with issue saying Cannot resolve symbol ‘index’ in IDEA. To fix

Open the myApp folder in IDEA. File –> Open Project–> [fixit]

Goto  File–> Project Strucuture –> Modules –>Select [fixit] –>  Sources [Tab]

Remove the following two folders from excluded.

target –> scala<version> –> classes_managed

target –> scala<version> –> src_managed

And add the src_managed and classes_managed to sources.

Final project structure should look like this.


Tip: Instead of creating new play application using idea I recommend you to use play command line.

Posted in Application Development | Tagged , | Leave a comment

How to install weighttp in Ubuntu?


a lightweight and simple webserver benchmarking tool.

To install weighttp in ubuntu we need to install libev (It is libev not libdev) using the following command

sudo apt-get install libev4 libev-dev

or we can install libev for any linux and unix oses  from source using the following set of commands

tar xvf libev-4.11.tar.gz
cd libev-4.11
sudo ./configure
sudo make
sudo make install

Get the source code of weighttp from the github using the following command.

git clone

cd weighttp
./waf configure
./waf build
sudo ./waf install

to uninstall
sudo ./waf uninstall

To run weighttp use the following command


Posted in Linux, webserver | Tagged , , , , , , , | Leave a comment

How to install dotcloud CLI in Fedora?

Hi Everyone,
I would like to share my experience in setting up dotcloud CLI(Command Line Interface ) in fedora 15 (LoveLock).

Step 1 :
We need to install easy_install to fetch & install python modules easily . Execute the following command
sudo yum install python-setuptools
Step 2 :
Then execute the following commands to install dotcloud CLI
sudo easy_install pip && sudo pip install dotcloud
Step 3:
Run dotcloud by executing following command
When you launch for the first time it will ask for the API Key which can be found under settings tab of your account
Please enter the API key , then it will create folder under your home directory with a name of .dotcloud which contains two files dotcloud.conf which contains URL and API Key in json format and dotcloud.key which used to upload your files to dotcloud git repo through ssh.

After that you can follow with the official documentation link.

Problems Faced:
i got the following error when i tried to push the contents to dotcloud server.
2012-01-04 16:16:40 [api] Deploy testhtml scheduled for revision = git-a92a5cf
2012-01-04 16:16:40 [api] Expected a type dictionary but got a type string in "dotcloud.yml", line 2, column 3

The above error is caused because of invalid dotcloud.yml .
contents of my dotcloud.yml are

The mistake i did was not giving a space between semicolon and static in the above code.
Corrected dotcloud.yml as follows
type: static

Posted in Cloud Computing | 1 Comment