martes, 10 de diciembre de 2013

Decompress .deb packages content

You probably had noticed that these are more personal notes tnat a real blog;

So in the same sense this is how to uncompress debian packages and see its content.

To decompress a deb file an 'ar' command is used:

# ar vx zncrypt_3.3.0-720ubuntu1~precise_amd64.deb
x - debian-binary
x - control.tar.gz
x - data.tar.gz
root@kozlex:/home/agonzalez/bugs/git/master_upstar/zncrypt/remove# ls
control.tar.gz  debian-binary                               zncrypt-kernel-module_3.3.0-720ubuntu1~precise_all.deb
data.tar.gz     zncrypt_3.3.0-720ubuntu1~precise_amd64.deb

Now this there are normal tar files, uncompress with tar:

# tar -xvf control.tar.gz

# ls
conffiles       data.tar.gz    postinst
control         debian-binary  zncrypt_3.3.0-720ubuntu1~precise_amd64.deb
control.tar.gz  md5sums        zncrypt-kernel-module_3.3.0-720ubuntu1~precise_all.deb

P.S. Some flags

lunes, 9 de diciembre de 2013

django - Add a haysack Full Text Search in a model window

Well, I have been creating a website and found a way to "popou" a modal window that would contain an FTS.

The credits of this procedure are not mine, these belong to
Mike Hibbert:
Kevin Lew:

You can follow mikes tutorial to setup an FTS. I will do somethig similar adding the Lew's modal window.

I will start by creating the model window.

1. Add the code in a template where you cant to add the link that will call the model window:

<a href="#dialog_presenter" name="modal">Add presenter jquery</a>

#dialog presenter is the div name of the model window.

2. Add the corresponding div, might be at the top of your html.

    <!-- #dialog is the id of a DIV defined in the code below -->
    <div id="boxes">

        <!-- #customize your modal window here -->
        <div id="dialog_presenter" class="window">
            <b>Select presenter to add </b>

            <!-- close button is defined as close class -->
            <a href="#" class="close">Close it</a>

        <!-- Do not remove div#mask, because you'll need it to fill the whole screen -->
        <div id="mask"></div>

Notice that so far had jkust been added "select presenter to Add" ... Nothing else in the model window.

3.  Add some style:

    /* Z-index of #mask must lower than #boxes .window */
    #mask {
    #boxes  .window {

    /* Customize your modal window here, you can add background image too */
    #boxes #dialog_presenter  {

4. Add the javascript for a modal window:

    $(document).ready(function() {   
        //select all the a tag with name equal to modal
        $('a[name=modal]').click(function(e) {
            //Cancel the link behavior
            //Get the A tag
            var id = $(this).attr('href');
            //Get the screen height and width
            var maskHeight = $(document).height();
            var maskWidth = $(window).width();
            //Set height and width to mask to fill up the whole screen
            //transition effect       
            //Get the window height and width
            var winH = $(window).height();
            var winW = $(window).width();
            //Set the popup window to center
            $(id).css('top', winH/2-$(id).height()/2);
            $(id).css('left', winW/2-$(id).width()/2);
            //transition effect
        //if close button is clicked
        $('.window .close').click(function (e) {
            //Cancel the link behavior
            $('#mask, .window').hide();
        //if mask is clicked
        $('#mask').click(function () {


5. Now for FTS install whoosh and haysack:

pip install whoosh
pip install django-haystack

6. Add to your project

WHOOSH_INDEX = os.path.join(PROJECT_DIRECTORY,'whoosh/')

    'default': {
        'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',

Also... add also to INSTALLED_APPS haytack and django


7. Now I would recommend to follow Mikes youtube's tutorial for FTS, it is clear and complete, just keep in mind that your modal window div would be like:

    <!-- #dialog is the id of a DIV defined in the code below -->
    <div id="boxes">
        <!-- #customize your modal window here -->
        <div id="dialog_presenter" class="window">
            <b>Select presenter to add </b>
            <h3> search </h3>
            {% csrf_token%}
            <input type="text" id="search_presenter" name="search_presenter" />
            <ul id="search-results-presenter">

            <!-- close button is defined as close class -->
            <a href="#" class="close">Close it</a>
        <!-- Do not remove div#mask, because you'll need it to fill the whole screen -->
        <div id="mask"></div>

Notice that the search input is what the FTS uses as source textbox.

I will just remark the most important steps:

8.- As already said in 7, add the search input.

9.- on ajax.js (java script) add:


    $('#search_presenter').keyup(function() {

            type: "POST",
            url: "/ticwiapp/search_user_add_presenter_ajax/",
            data: {
                'search_text' : $('#search_presenter').val(),
                'csrfmiddlewaretoken' : $("input[name=csrfmiddlewaretoken]").val()
            success: searchSuccessPresenter,
            dataType: 'html'



function searchSuccessPresenter(data, textStatus, jqXHR)

Where search-results-presenter are the results shown in the <ul> of step 7.

10. on urls file addthe udr and view that will attend the javascript of step 9.

url(r'^search_user_add_presenter_ajax/$', 'myapp.views.search_user_add_presenter_ajax'),

11. on myapp views add myapp.views.search_user_add_presenter_ajax like:

def search_user_add_presenter_ajax(request):

    args = {}
    args['user'] = request.user
    # Follow create a haystack object instead a queryset
    args['all_users']  = SearchQuerySet().autocomplete(content_auto=request.POST.get('search_text',''))

    return render_to_response('search_user_add_presenter_ajax.html',args)

12. Create search_user_add_presenter_ajax.html template, this is specified in the return of step 11.

Follow is an example:

{% load static %}

{% if all_users.count > 0 %}
{% for one_user in all_users %}
<br>  {{ one_user.object.first_name }} {{ one_user.object.last_name }}
<a href = "/ticwiapp/add_presenter_now/{{ }}/{{ }}/registered">Add presenter </a>
{% endfor %}

{% else %}

<p>No users in database!</p>

{% endif %}

There you are!! Enjoy!

 P.D. Looks like Egyptians had invented flags

martes, 3 de diciembre de 2013

Could not get lock /var/lib/dpkg/lock

Well... I was in the middle of an installation when I pressed ctrl+c .. that broke tha installation but didn't released the apt-get install locks...

Fixing it:

So simple... 

# rm /var/lib/apt/lists/lock

# rm /var/cache/apt/archives/lock

This is more a personal note.. anyway there are more published solutions:

P.S. Do you like to see the red flag?

jueves, 21 de noviembre de 2013

phpmyadmin on ubuntu connecting to mysql by phyton

Just follow these links and few more steps:

Then enable design view, this is really useful

Now you can setup python for apache2:

don't forget to install python-mysqldb

apt-get install python-mysqldb

restart apache:

/etc/init.d/apache2 restart

Now let's try a small db connection:

agonzalez@kozlex:~/django-dev$ cat /var/www/

import MySQLdb

# enable debugging
import cgitb

print "Content-Type: text/plain;charset=utf-8"

print "Hello World!"

# connect
mydb = MySQLdb.connect(host="", user="root", passwd="root",

cursor = mydb.cursor()

# execute SQL select statement
cursor.execute("SELECT * FROM test")

# get the number of rows in the resultset
numrows = int(cursor.rowcount)

# get and display one row at a time.
for x in range(0,numrows):
    row = cursor.fetchone()
    print (row[0], "-->", row[1])

def index(req):
  return row[1];


That should work although the prints are not shown!

P.D.  Libya flag is the only country flag with single color and no design.

Read an ISO content on ubuntu

Has been a while since I don't add something here.. I've been working with PXE to overwrite an MBR and I found a small tip that I share now...

To install PXE is needed to install some files from alternate ubuntu, what I did is to get the iso, mount it and find what I need.


To read an iso content on ubuntu:

# sudo mkdir /mnt/iso
# sudo mount -o loop -t iso9660 ubuntu-12.04.3-alternate-amd64.iso /mnt/iso

agonzalez@kozlex:/mnt/iso$ ls /mnt/iso/
boot  cdromupgrade  dists  doc  EFI  install  isolinux  md5sum.txt  pics  pool  preseed  README.diskdefines  ubuntu

Annnnd... there it is... I found what I need..

agonzalez@kozlex:/mnt/iso$ find . -name  pxelinux.0

P.D. The vatican is also a country and its flag and is one of the two sqare flags in the world.

domingo, 1 de septiembre de 2013

Uninstall MySql on a Mac OS X

Today I tried to install mysql for mac and I Installed it for MAc OS X 10.7 when I have installed 10.6 version..

Well there is a bug cause the installed didn't warn me and I faced the bug described in:

To fix this I followed some steps from:

This is a copy of previous link solution:

Table of Contents [hide]


To completely uninstall MySql OS X it is neccessary to remove numerous files.


You unable to install an older version of MySql even though you thought you have removed everything.


To uninstall MySQL and completely remove it (including all databases) from your Mac do the following:
  • Open a terminal window
  • Use mysqldump to backup your databases to text files!
  • Stop the database server
  • sudo rm /usr/local/mysql
  • sudo rm -rf /usr/local/mysql*
  • sudo rm -rf /Library/StartupItems/MySQLCOM
  • sudo rm -rf /Library/PreferencePanes/My*
  • edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
  • rm -rf ~/Library/PreferencePanes/My*
  • sudo rm -rf /Library/Receipts/mysql*
  • sudo rm -rf /Library/Receipts/MySQL*
  • sudo rm -rf /private/var/db/receipts/*mysql*
The last three lines are particularly important as otherwise, you can't install an older version of MySQL even though you think that you've completely deleted the newer version!

Might be also helpful:

P.S. No flags today.. it's Sunday!

viernes, 30 de agosto de 2013

GlusterFS 3.2.x On Ubuntu 12.04 with ext4 encrypted with dmcrypt

Follow are my history steps, these steps were created from :



Only difference is that I used ext4 instead of xfs.

Configure every gluster server with follow steps:

# losetup /dev/loop1 storage_space2
# cryptsetup luksFormat /dev/loop1
# cryptsetup isLuks /dev/loop1 && echo success
# cryptsetup luksDump /dev/loop1
# dmsetup info bricks
# mkfs.ext4 /dev/mapper/bricks
# mkdir /bricks
# mount /dev/mapper/bricks /bricks/
# vi /etc/crypttab
# vi /etc/fstab
# mount -a
# mount -l
# blkid -o full

Create at only once server the gluster volume:

# gluster vol create dmvolume replica 2
# volume group info
# gluster volume  info
# echo "Hola" > /bricks/File1
# cat /bricks/File1
# gluster volume set dmvolume auth.allow
# gluster volume stop dmvolume
# gluster volume start dmvolume

Now go to yor gluster client and mount gluster volume:

# mkdir /mnt/dm
# mount -t glusterfs gluster1:/dmvolume /mnt/dm
# mount -l
# ls /mnt/dm
# vi /mnt/dm/File_to_break
# cat /mnt/dm/File_to_break

Go back to your Server and list the created file

  # ls /bricks/dmvolume
  # cat /bricks/dmvolume/File_to_break

P.S. Have you seen your country round flag?

martes, 27 de agosto de 2013

Configure VM IP Address on Ubuntu 12.04

Step by step

1.- Go to virtual box,  select your vm and go to settings-> network
2.- Then on the attached to: select Brifged adapter
3.- Go to advanced and click on update button of Mac Address
4.- Start the VM
5.- remove the file /etc/udev/rules.d/70-persistebt-net.rules
6. Edit your /etc/network/interfaces, change "dhcp" to "static" like:
auto eth0
iface eth0 inet static

7.- do a #/etc/init.d/networking restart and see ifconfig
8.- If not gettin the ip ... reboot
9.- Check ifconfig, you should have an IP now

If not then do
10.- # sudo dhclient eth0

There you go, you have an IP

P.S. Did you know every pirate had its own flag?

jueves, 22 de agosto de 2013

Debugging a kernel module using gdb

These are some steps to find a simple bug because a NULL pointer.

0. gdb should be installed
# yum install gdb

1. add '-g -O' options (without quotes) at the EXTRA_CFLAGS variable of your Makefile file. This will add symbols to your created .ko module file

EXTRA_CFLAGS += -O2 -Wall -Wno-unused -fno-strict-aliasing -Werror -g -O

2. Make the module

3. execute:
agonzalez@kozlex:~/bugs/b/zncrypt/src/module/zncrypt$ gdb ./zncryptfs.ko
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
Reading symbols from /home/agonzalez/bugs/b/zncrypt/src/module/zncrypt/zncryptfs.ko...done.
There you are, symbols were read

4. Other option once you are in gdb shell, add symbols from 0x0:

(gdb) add-symbol-file zncryptfs.ko 0x0
add symbol table from file "zncryptfs.ko" at
    .text_addr = 0x0
(y or n) y
Reading symbols from /home/agonzalez/bugs/b/zncrypt/src/module/zncrypt/zncryptfs.ko...done.

5. Your symbols are loaded, you can dissassemble your culprit function, in my case zncrypt_remove_inode().

(gdb) disassemble zncrypt_remove_inode
Dump of assembler code for function zncrypt_remove_inode:
   0x00000000000008d5 <+0>:    push   %rbp
   0x00000000000008d6 <+1>:    mov    %rsp,%rbp
   0x00000000000008d9 <+4>:    callq  0x8de <zncrypt_remove_inode+9>
   0x00000000000008de <+9>:    mov    (%rdi),%rax
   0x00000000000008e1 <+12>:    mov    0x10(%rdi),%rdx
   0x00000000000008e5 <+16>:    mov    0xc0(%rdx),%rdx
   0x00000000000008ec <+23>:    mov    %rdx,0x20(%rax)
   0x00000000000008f0 <+27>:    mov    (%rdi),%rax
   0x00000000000008f3 <+30>:    mov    0x8(%rdi),%rdx
   0x00000000000008f7 <+34>:    mov    0xd0(%rdx),%rdx
   0x00000000000008fe <+41>:    mov    %rdx,0x130(%rax)
   0x0000000000000905 <+48>:    mov    0x18(%rdi),%rdx
   0x0000000000000909 <+52>:    mov    0x20(%rdi),%rax
   0x000000000000090d <+56>:    mov    %rax,0x8(%rdx)
   0x0000000000000911 <+60>:    mov    %rdx,(%rax)
   0x0000000000000914 <+63>:    movl   $0x100100,0x18(%rdi)
   0x000000000000091b <+70>:    movl   $0xdead0000,0x1c(%rdi)
   0x0000000000000922 <+77>:    movl   $0x200200,0x20(%rdi)
   0x0000000000000929 <+84>:    movl   $0xdead0000,0x24(%rdi)
   0x0000000000000930 <+91>:    callq  0x935 <zncrypt_remove_inode+96>
   0x0000000000000935 <+96>:    pop    %rbp
   0x0000000000000936 <+97>:    retq  
End of assembler dump.

5. Check the offset of your stack trace. In my case I had an Oops and the stack trace shows:

Aug 22 12:06:59 kozlex kernel: [ 464.774484] BUG: unable to handle kernel NULL pointer dereference at (null)
Aug 22 12:06:59 kozlex kernel: [ 464.799669] <ffffffffa04ee9b9>zncrypt_remove_inode+0x39/0x40 zncryptfs

6. You can see from 4 that the start address for zncrypt_remove_inode is 0x00000000000008d5, then add the offset of your stacktrace zncrypt_remove_inode+0x39 (see 5)

7. Do the addition of  0x8d5 + 0x39  = 0x90e

8. Then do follow command with the culprit address:

(gdb) list * 0x90e
0x90e is in zncrypt_remove_inode (include/linux/list.h:88).
83     * This is only for internal list manipulation where we know
84     * the prev/next entries already!
85     */
86    static inline void __list_del(struct list_head * prev, struct list_head * next)
87    {
88        next->prev = prev;
89        prev->next = next;
90    }
92    /**

9. There you go... Line 88 is where the NULL pointer fails...

10. Figure out where is you error by dissassembling previous functions and do what you know to do.

P.S. The first flag of the world is...

miércoles, 14 de agosto de 2013

Transfer files from/to android using ubuntu

Some easy steps..

Your ubuntu and android should be connected to the same wifi.

1. Install FTP Server App on your android smarthphone
2. Intall Filezilla on ubuntu
3. Start your FTP server at your smartphone. This gives you IP, user, password, port.
4. Conntec from FileZilla to you FTP server

You can transfer now whatever ypu need on any direcition.

P.S. There is a micro flag

martes, 13 de agosto de 2013

Configure a VM IP Address on redhat or centos

First go to virtual Box, your VM ->Settings -> Network ->Advanced

Display the Advance options and click the refresh button for Mac Address, then click OK

Now start the VM and login.

Remove from  HWADDR line from /etc/sysconfig/network-scripts/ifcfg-eth0

You should remove something like:

HWADDRR ="08:00:27:B2:F8L58"

Change eth0 by eth1 from ifcfg-eth0


Then add


Now restart network:

#sudo /etc/init.d/network restart

ifconfig will show you now your new IP address

P.S. most common flag colors are...

Accessing a virtual Box VM using telnet and serial port

alright alright alright, I am updating with steps that do the same and might can be easier to follow:
On behalf of my dear friend Sergio Pena.

There are some critical kernel panics that may freeze your system leaving you without a clue about what happened.
These kernel panics display a partially kernel stack trace on your system console, but not enough to do a complete debug of the error.
In order to get the complete kernel stack trace, we can get those kernel messages through the Linux serial port.

Let's follow these steps to configure your Linux system and a VirtualBox machine to get those kernel messages. 

Step 1: Configure the Linux Boot (Grub) to send kernel messages to the Serial Port

Edit the /boot/grub/menu.lst file, and add the following two lines before hiddenmenu config options:
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
Scroll down and find out kernel line and append the following config options:
console=tty0 console=ttyS0,9600
At the end, your menu.lst should looks like this:
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title CentOS (2.6.32-358.11.1.el6.x86_64)
 root (hd0,0)
 kernel /vmlinuz-2.6.32-358.11.1.el6.x86_64 ro root=/dev/mapper/vg_centos63-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_centos63/lv_swap rd_LVM_LV=vg_centos63/lv_root rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM console=tty0 console=ttyS0,9600
 initrd /initramfs-2.6.32-358.11.1.el6.x86_64.img

Now reboot your system.
Every kernel message will be sent to the serial port after boot.

Step 2: Configure VirtualBox to connect to Linux over a Serial Port

The next part is to enable the serial port on the virtual machine running on VirtualBox.
Open the settings for the machine on Virtualbox. Go to "Serial Ports". In the Port 1 tab enable the "Enable Serial Port" option. Use the following settings:
Port Number : COM1
Port Mode : Host Pipe
Create Pipe (Enabled)
Port/File Path : /tmp/vserial

Click on the OK button.
Now start the target machine. 

Step 3: Use 'socat' & 'telnet' commands to connect to Linux through the Serial Port

Now it is time to connect to your Linux serial port in order to catch those kernel messages.
We'll use the socat command to convert a Unix socket to a TCP port, and then connect to the serial port through telnet. 
Install the 'socat' utility package.
apt-get install socat
Then, in a terminal session, execute the following socat command to convert the Unix socket stream to a TCP port stream.
socat UNIX-CONNECT:/tmp/vserial TCP-LISTEN:7000
If everything goes fine, the socat command will be stuck. So, open another terminal session to execute your telnet command.
telnet localhost 7000
If the connection is successful, then you'll see an output like this:
Connected to localhost.
Escape character is '^]'.
That's it. You can start now seeing any kernel message that appears after your telnet session.



This is an easy way to connect to a VM by telnet using the serial port

For example, I have a  Centos 6.2 VM installed with Virtual Box.

Instead of using ssh because you would loose connection on a kernel panic

You can use telnet to see the stack trace.

Once the VM is started - Go to your local host and in a terminal type:

# socat UNIX-CONNECT:/tmp/centos62 TCP-LISTEN:7000

Notice that /tmp/centos62 is my VM (virtual Box) virtual serial port

Open a new terminal and type:

$ telnet localhost 7000

You will be asked for login/password; go ahead and start navigating on your VM

Do all operations you want over telnet or ssh and if a kernel oops happen then it will be shown on your local terminal where 'telnet localhost 7000' was issued. You will see the entire stack trace instead just part of it.


P.S. Which is the prettiest flag?

miércoles, 26 de junio de 2013

Installing Riak and encrypting it with zNcrypt; aesni enabled on ubuntu

Riak is a bigdata database that is useful to save large amounts of data, the company that offers support for it is named, there is a lot of tutorials at basho site to install riak and configure.

This is a resume of the steps to setup a quick single node on a riak ring.

It is assumed that zNcrypt is already installed.

To install riak on ubuntu follow steps from:

Basically 4 commands are needed:

# curl | sudo apt-key add -
# sudo bash -c "echo deb $(lsb_release -sc) main > /etc/apt/sources.list.d/basho.list"
# sudo apt-get update
# sudo apt-get install riak

Configuring Riak:

You need to modify /etc/riak/app.config and /etc/riak/vm.args

1. Get yout local ip

2. Update vm.args

Change "-name riak@127.0.0." "-name riak@YOUR_IP"
3. update app.config

pb_ip: Replace with the IP address of the Riak node.

 {pb_ip,   "" }
Change to:
 {pb_ip,   "xx.xx.xx.xx" }

Then update http to your IP

{http, [ {"", 8098 } ]} 

change to :

{http, [ {"xx.xx.xx.xx", 8098 } ]},

Where xx.xx.xx.xx is your node ip.

4. Create Riak directories

# mkdir /mnt/r
# mkdir/mnt/r/bitcask

/mnt/r/ring and /mnt/r/kv_node are automatically created when  riak is started

IMPORTANT: If riask has been started reviously, when updating app.config and vm.args you had changed app.config and vm.args this would make changes at your vk_node so the previous stored information about this cluster not is not updated automatically, remove directories ring, kv_node and bitcask/*   (If you already have sensitive data written DON'T remove bitcask/*)

Configuring dmcrypt to encrypt with zNcrypt.

Creating a 1 Gb file:

# sudo dd if=/dev/zero of=1gb.file bs=50M count=20

then losetup

#losetup /dev/loop0 1gb.file

Now prepare device at zNcrypt:

# zncrypt-prepare  /dev/loop0 /mnt/dmcrypted

Now enable aes-ni

root@ip-10-191-34-140:/home/ubuntu/basho_bench# modprobe aesni_intel
root@ip-10-191-34-140:/home/ubuntu/basho_bench# lsmod | grep aesni
 aesni_intel            55664  0
cryptd                 20530  1 aesni_intel
aes_x86_64             17255  1 aesni_intel

then add zncryt acl rule

# zncrypt acl --add --rule="ALLOW @riak  *   /usr/lib/riak/erts-5.9.1/bin/beam.smp"
Type MASTER passphrase:
1 rule(s) were added

and encrypt:

# zncrypt-move encrypt @riak /var/lib/riak /mnt/dmcrypted


Doesn't respond 'riak ping'?

Make sure about 4 things

1.- check thet there is not already an idle riak priocess running
#psaux | grep riak

If there is something kill it.. Muahaha

2.- Make sure that kv_node, riank and bitcask directories are owned by 'riak' user, if not set it up

3. You probably had not removed previous node config, so remove kv_node, ring and bitcask/*

4. /mnt/r/ should be owned by riak user:

# chown riak:riak /mnt/r

Do you need to execute basho_bench?

If it is required to create the graphics you might see follow issue:

ubuntu@ip-10-68-22-201:~/basho_bench$ make results
priv/summary.r -i tests/current
/usr/bin/env: Rscript --vanilla: No such file or directory
make: *** [results] Error 127

To resolve it you can find the fix at:

In short
If make results fails with the error /usr/bin/env: Rscript –vanilla: No such file or directory please edit priv/summary.r and replace the first line with the full path to the Rscript binary on your system

In my case it is:
 #!/usr/bin/env Rscript --vanilla

ubuntu@ip-10-68-22-201:~/basho_bench$ Rscript
The program 'Rscript' is currently not installed.  You can install it by typing:
#sudo apt-get install r-base-core
ubuntu@ip-10-68-22-201:~/basho_bench$ apt-get install r-base-core

ubuntu@ip-10-68-22-201:~/basho_bench$ which Rscript

#!/usr/bin/Rscript --vanilla

Then execute:

#sudo make results

If you see an error like:

The downloaded packages are in
Loading required package: methods
Error: could not find function "getopt"
Execution halted
make: *** [results] Error 1

Ths is ok, just try to make results again.

There you go, your graphics are there:

ubuntu@ip-10-68-22-201:~/basho_bench$ ls tests/current/
console.log.0         error.log.0           get_latencies.csv     summary.csv           update_latencies.csv 
crash.log.0           errors.csv            log.sasl.txt          summary.png           voxer300.config 

P.S. The most important flag we live for, doesn't exist.

lunes, 17 de junio de 2013

Upgrading a debian linux kernel

Download the tar file you want to build/install.

For example has been downloaded from

Untar it to a folder and cd to that folder

Then install make-dpkg it is really useful and performs multiple make commands like make clean, make modules, make modules_install automatically and will create the .deb files.

# apt-get install make-kpkg

Then issue the make commands (these might take a while, make sure you have enough disk space):

#make-kpkg --append-to-version foo     --revision 3.10rc5 --initrd kernel_image modules_image
#fakeroot make-kpkg --append-to-version foo        --revision 3.10rc5 --initrd kernel_image kernel_headers

.deb files are created one directory up to the current, so go there and install them:

# dpkg -i linux-image-3.10.0-rc5foo_3.10rc5_amd64.deb

# dpkg -i linux-headers-3.10.0-rc5foo_3.10rc5_amd64.deb

NOTE: While installing linux-headers you might receive an error where cannot be found the build directory, that is ok just go and create the symlink to the kernel-headers like:

# ln -s /usr/src/linux-headers-3.10.0-rc5foo/ /lib/modules/3.10.0-rc5foo/build

Try to install the headers again!

Finally update the grub2

# update-grub2

You can make sure that your new kernel is listed in grub.cfg as a menuentry:
#vi /boot/grub/grub.cfg
menuentry 'Ubuntu, with Linux 3.10.0-rc5foo' --class ubuntu --class gnu-linux --class gnu --class os {
        gfxmode $linux_gfx_mode
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='(hd0,msdos2)'
        search --no-floppy --fs-uuid --set=root 5ba53145-aaa1-4c5c-a157-7523ae919646
        linux   /boot/vmlinuz-3.10.0-rc5foo root=UUID=5ba53145-aaa1-4c5c-a157-7523ae919646 ro   quiet
        initrd  /boot/initrd.img-3.10.0-rc5foo

reboot now!   .. check your 'uname -r'; kernel  should've been updated.

P.S. There is a place where the sunrise is great ant their flag is ...

Intalling Google DNS (Enom) at an EC2-AWS Amazon Instance

I wanted to document this even when there is some info about it on the web.

It is not really clear how to use ENOM DNS Manager when purchasing a DNS by GOOGLE, although it is finally easy.

In short:

1.- Launch your EC2 instance
2.- Create an Elastic IP
3.- Associate the Elastic IP with your instance ID
4.- Go to your enom account and create Host Record like '@' on the first field and 'xx.xx.xx.xx' as your Address (where xx.xx.xx.xx is your elastic IP)
5.- Be patient Enom will not do the change immediately, it might delay 15 minutes or 2 days (worst case).

P.S. Someone else though about fun with flags

Installing DataStax Enterprise with Ansible

You can see in other blogs how to install ansible on Ubuntu, this time it is just shown how to install DSE using Ansible.


You need to be registered at Datastax so you could get an user/passwd to get Datastax DSE.

It is assumed that you already have Ansible configured and have a servers group named "dse.

You can follow follow post to install ansible:

Do a quick test:

$ ansible dse -m ping -u ubuntu | success >> {
    "changed": false,
    "ping": "pong"

To install DSE on ubuntu, we need to make sure that:

- JNA is installed

- Oracle java6 is installed
- You have a Datastax user/password. Get it from:

Installing JNA:

ansible dse -a "sudo apt-get install libjna-java" -u ubuntu -y

Installing Java6 on Ubuntu 12.04 x64:

First enable non-interctive mode

# echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections

# echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections

Install Java:

# sudo apt-get install oracle-java6-installer -y

make sure java is running:

# java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

1. Add to sources list datastax repository with your user/passwd and install dse:

# deb stable main

curl -L | sudo apt-key add -

# sudo apt-get update

# sudo apt-get install dse-full -y

Enable Solr and Hadoop at SDE

To enable Solr and Hadoop follow variables need to be set to ‘1’ at /etc/default/dse config file:


Start Datastax Enterprise.
Start the service with:

# sudo dse cassandra -s

2. Open new terminal and verify DSE is running and operational.

# sudo dsetool ring -h localhost

Output should look similar to the example below:
Address         DC          Rack        Status State   Load            Owns                Token       Solr        rack1       Up     Normal  9.29 MB         100.00%             33015982249869676890

# sudo /etc/init.d/dse stop

2.  To verify that the cluster node is up and running execute:

# nodetool ring -h localhost
Note: Ownership information does not include topology, please specify a keyspace.
Address         DC          Rack        Status State   Load            Owns                Token                                     Analytics   rack1       Up     Normal  4.38 MB         100.00%             42053256256062917965909574476650479427      
You can issue hadoop commands to make sure that it is working correctly:

# dse hadoop fs -mkdir my_test_dir

# dse hadoop fs -ls
Found 1 item
drwxrwxrwx   - root root          0 2013-04-23 16:56 /user/root/my_test_dir

If the directory created is listed then hadoop service works!

If you want to verify Hadoop deeper you can follow Hadoop demos:

P.S. You can see the flags of there world!