Thursday, December 24, 2015

What is multitenancy - logically isolated- physically maynot be


Multitenancy is a reference to the mode of operation of software where multiple independent instances of one or multiple applications operate in a shared environment.

The instances (tenants) are logically isolated, but physically integrated.

The degree of logical isolation must be complete, but the degree of physical integration will vary.

The more physical integration, the harder it is to preserve the logical isolation.

The tenants (application instances) can be representations of organizations that obtained access to the multitenant application (this is the scenario of an ISV offering services of an application to multiple customer organizations).

The tenants may also be multiple applications competing for shared underlying resources (this is the scenario of a private or public cloud where multiple applications are offered in a common cloud environment).

ISV - independent software vendor

get remote host volumes in gluster

How do you get remote node's gluster volume(s):

gluster volume info --remote-host=gfvm4

yes , --remote-host= plays the key part here ;)

Monday, December 14, 2015

SIGTERM vs SIGKILL and some more


kill will send SIGTERM signal
- may stop OR not.
- may be ignored.

kill -9 will send SIGKILL signal
- carries little more weight than SIGTERM
- 9 indicates SIGKILL-  CANNOT be ignored by process
-  SIGKILL directly goes to the init process.
   - init will stop the process.

Processes into "uninterriptible sleep"(D state) cannot be killed by kernel either. Reboot is required.

SIGKILL: Terminates a process immediately. This signal cannot be handled (caught), ignored or blocked. (The "kill -9" command in linux generates the same signal).

SIGTERM: Terminates a process immediately. However, this signal can be handled, ignored or caught in code. If the signal is not caught by a process, the process is killed. Also, this is used for graceful termination of a process. (The "kill" command in linux if specified without any signal number like -9, will send SIGTERM)

SIGINT: Interrupts a process. (The default action is to terminate gracefully). This too, like, SIGTERM can be handled, ignored or caught. The difference between SIGINT and SIGTERM is that the former can be sent from a terminal as input characters. This is the signal generated when a user presses Ctrl+C. (Sidenote: Ctrl+C denotes EOT(End of Transmission) for (say) a network stream)

SIGQUIT: Terminates a process. This is different from both SIGKILL and SIGTERM in the sense that it generates a core dump of the process and also cleans up resources held up by a process. Like SIGINT, this can also be sent from the terminal as input characters. It can be handled, ignored or caught in code. This is the signal generated when a user presses Ctrl+\.

SIGSTP: Suspends a process. This too, can be handled, ignored or blocked. Since it does not terminate the process, the process can be resumed by sending a SIGCONT signal. This signal can be generated by pressing Ctrl+Z. (Sidenote: Ctrl+Z stands for substitute character which indicates End-of-File in DOS)

SIGHUP: (From Wikipedia): Hangs up a process when the controlling terminal is disconnected. This especially relates to modem/dial in connections. A process has to explicitly handle this signal for it to work. A good use is to "poke" a process and letting the process (as defined by the programmer) decide what to do with the signal is described here. Hence, SIGHUP can be handled,ignored or caught. This is the signal generated when a user presses Ctrl+D.


symbolic link affecting program behaviour

symbolic links affect program behaviour ? how?

In a C program, the command line is stored in argv, which is short for argument vector.

The progam's name is the first element of argv, i.e. argv[0].

Clearly in the case of halt and reboot, the program is changing its behavior based on argv[0].

# reboot

ps -p -o cmd or cat /proc/cmdline.

so in program depending upon argv[0] behaviour changes !


deleting a forked repo from github

 deleting a forked repo from github :

By far the easiest way is to log in gitHub account:
  1. Click to your repository {for example yourUsername/yourRepository for example igort/vuk}
  2. Then in the main toolbar of github click on Settings
  3. Scroll just a little bit down and you will find Delete this repository button
  4. When you click it another pop up will appear here you need to type in the name of your repository and click on the button below which says: I understand the consequences, delete the repository

setting evince as default pdf viewer

setting default viewer for an application:

for example, you want to set "evince" as the default pdf viewer for any pdf document.

go to properties -> open-with -> select the program (evince in our case) -> set as default.

thats it, any time you open any pdf it will open using evince application :)

I think this should be applicable for all Linux distros, but I use fedora by default ;)

Thursday, December 10, 2015

nfs server error

rpc.nfsd[4115]: rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)

Are you getting the above error while starting nfs server?

well, you need to manually start rpcbind service...then start nfs server.

Friday, December 4, 2015

Canon IP2870 reset Ink level and orange light meaning

Canon ip2870

This helps, So...
Canon IP2870 – Error Codes
Error Code    Description
Two flashes    Machine is out of paper or paper does not feed.
Three flashes    Paper jam.
Four flashes    The cartridge is not installed properly.
Five flashes    The cartridge is not installed properly.
Seven flashes    The cartridge is not installed in the correct position.
Eight flashes    Ink absorber is almost full.
Thirteen flashes    The remaining ink level cannot be detected.
Fourteen flashes    The cartridge cannot be recognised.
Fifteen flashes    The cartridge cannot be recognised.
Sixteen flashes    The ink has run out.

Canon IP2870 – Reset Ink Levels on the Cartridges

The Canon IP2870 cannot physically see inside the cartridges to find out how much ink is left. The copper contacts on the outside of the cartridge contain the ink level information. It is not possible to reset the ink levels to full. If you refill your cartridge, the printer will always show an empty cartridge message.

You can override the empty cartridge message by holding down the “stop / reset” button on the printer for around five seconds. The printer should continue printing, and use any of the remaining ink in the cartridge.

If the printer thinks that both cartridges are empty, you will receive a second error message, and you will need to hold the button for another five seconds.

If the circuitry on the cartridges is actually damaged this process will not work.

Friday, October 9, 2015

resetting your monitor resolution settings fedora

So, you have setup dual monitor in your fedora machine, and somehow the resolution seems to be goofed up.

Now, you want to fix it to default / normal.

Use this

$ xrandr -s 0

Monday, August 24, 2015

NFS permission denied error in client

I was trying to configure NFS, faced night mare of issues related to permission.

After some time figured out, adding netmask(24) fixed the error:
# cat /etc/exports

[ error faced:
mount.nfs: access denied by server while mounting ]

Also, whenever we change exports file , reload it by using exportfs -r

you can see what is exported via
#exportfs -s

Issue like this should not be present in docker kind of environment, I think.

You get ready made NFS configured server, you only start changing the options as per your requirement. :)

Monday, August 3, 2015

malloc - its failure and use of goto


//version 1
int function()
    void *x,*y,*z;

    x = malloc(10);
    if (!x)
        goto error1;

    y = malloc(20);
    if (!y)
        goto error2;

    z = malloc(50);
    if (!z)
        goto error3;

    goto out;

        return ERROR;
        return 0;

// version 1 making too much noise. There is absolutely NO issue in freeing a NULL pointer.
// version 2
int function()
    void *x,*y,*z;
    ret = 0;

    x = malloc(10);
    y = malloc(20);
    z = malloc(50);
    if (!x || !y || !z) {
        ret = ERROR;

    return ret; // Here I have the assumption that caller is NOT looking
            // for x,y,z memory access. Look version 3. if caller needs x,y,z

//version 3 - memory required by caller
int function()
    void *x = *y = *z = NULL;
    ret = 0;

    x = malloc(10);
    y = malloc(20);
    z = malloc(50);

    if (!x || !y || !z) {
        ret = ERROR;
        goto error;
    } else {
        goto out;

    return ret;

//version 4 - removing goto's - memory required by caller
int function()
    void *x = *y = *z = NULL;
    ret = 0;

    x = malloc(10);
    y = malloc(20);
    z = malloc(50);

    if (!x || !y || !z) {
        ret = ERROR;
    return ret;

Wednesday, July 22, 2015

Failed to create domain from - qemu error

 I run out of space on /var/lib/libvirt/images , so need to change the path where qcow2 image is stored(/home)?.

Tried creating vm from new location but faced the following error.

[root@gant qemu]# virsh create fedora21_3.xml
error: Failed to create domain from fedora21_3.xml
error: Cannot access storage file '/home/test/qemu_images/fedora21_3.qcow2' (as uid:107, gid:107): Permission denied

 Fix is we need to change the permission of whole directory path.

[root@gant qemu]# chmod 777 /home/test/

[root@gant qemu]# chmod 777 /home/test/qemu_images/

[root@gant qemu]# chmod 777 /home/test/qemu_images/fedora21_3.qcow2

[root@gant qemu]# virsh create fedora21_3.xml
Domain fedora21_3 created from fedora21_3.xml

[root@gant qemu]#

This is for a  development machine , so not recommended for anything else.

Tuesday, July 21, 2015

Hardlinks - usecase

How hardlinks can be used?

Please refer reference mentioned below for complete details.
This is how many modern file system backup programs work.

On day 1 you make an rsync copy of your entire file system:

backup@backup_server> DAY1=`date +%Y%m%d%H%M%S`
backup@backup_server> rsync -av -e ssh earl@ /var/backups/$DAY1/

On day 2 you make a hard link copy of the backup, then a fresh rsync:

backup@backup_server> DAY2=`date +%Y%m%d%H%M%S`
backup@backup_server> cp -al /var/backups/$DAY1 /var/backups/$DAY2
backup@backup_server> rsync -av -e ssh --delete earl@ /var/backups/$DAY2/

“cp -al” makes a hard link copy of the entire /home/earl/ directory structure from the previous day, then rsync runs against the copy of the tree.

If a file remains unchanged then rsync does nothing — the file remains a hard link. However, if the file’s contents changed, then rsync will create a new copy of the file in the target directory. If a file was deleted from /home/earl then rsync deletes the hard link from that day’s copy.

In this way, the $DAY1 directory has a snapshot of the /home/earl tree as it existed on day 1, and the $DAY2 directory has a snapshot of the /home/earl tree as it existed on day 2, but only the files that changed take up additional disk space. If you need to find a file as it existed at some point in time you can look at that day’s tree. If you need to restore yesterday’s backup you can rsync the tree from yesterday, but you don’t have to store a copy of all of the data from each day, you only use additional disk space for files that changed or were added.


Sunday, July 19, 2015

python script check for erros

want to check python script for errors without running?

flake8  src/

ofcourse you need to install flake8 first :)

secure connection failed error in firefox

secure connection failed error in firefox


install acroread adobe pdf reader on fedora

cd /tmp

## English version ##

## Fedora 22 ##
## English version ##
dnf install AdbeRdr9.5.5-1_i486linux_enu.rpm

## Install other needed packages on Fedora ##
dnf install nspluginwrapper.i686 libcanberra-gtk2.i686 adwaita-gtk2-theme.i686 PackageKit-gtk3-module.i686


Also, we need to add this line(below) in /usr/bin/acroread:
ldconfig /opt/Adobe/Reader9/Reader/intellinux/lib

 Then, you can launch acroread like :
sudo acroread &

This may be a recommended option, please use with caution.

fpaste utility to get your info to pastebin

To get entire info about your (fedora) system:
run this:
fpaste --sysinfo

$ fpaste --help
Usage: fpaste [OPTION]... [FILE]...
  send text file(s), stdin, or clipboard to the pastebin and return the URL.

  fpaste file1.txt file2.txt
  dmesg | fpaste
  (prog1; prog2; prog3) | fpaste
  fpaste --sysinfo -d "my laptop" --confirm
  fpaste -n codemonkey -d "problem with foo" -l python

USB printer connected to fedora 22

Configuring local printer in fedora

ServerName  localhost

In order to see the local printers (while using system-config-printer) , the above line (ServerName  localhost) needs to be added.

restart cups like: service cups restart

Please note you may need to comment your office(OR NETWORK) printer server in this configuration. I am still figuring out how to make both to work.

BUT, with this above option you should be able to configure your local printer.

PS: Somehow test printing from the properties dialog box is NOT working. BUT I am able to print from pdf/ text documents. (File-> Print) like that.

Friday, July 10, 2015

view image from command line

To view a image:

eog stands for  eye of gnome

Tuesday, July 7, 2015

webcam in fedora

want to use your webcam, install cheese
sudo yum install cheese

and invoke like

Friday, July 3, 2015

Adding printer Fedora

Want to add your local printer:

use  this interface:

PS: I have tough time to add printer using default GUI.

In /etc/cups/cupsd.conf

check whether following entry present
# Restrict access to the admin pages...

Order allow,deny
Allow localhost
Then, add printer.
Select default and you are done.  

vim-jedi plugin - autocomplete python

 sudo yum install vim-jedi.noarch -y

for autocomplete.
Selecting the function shows the function help.

// To load the module info
:Pyimport os

Apart from that, jedi-vim supports the following commands
  • Completion
  • Goto assignments g (typical goto function)
  • Goto definitions d (follow identifier as far as possible, includes imports and statements)
  • Show Documentation/Pydoc K (shows a popup with assignments)
  • Renaming r
  • Usages n (shows all the usages of a name)
  • Open module, e.g. :Pyimport os (opens the os module)
Leader means / here.
C - control space

Permission denied (publickey) - git access denied - ssh key issue

$ git pull
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
$ ssh-add ~/.ssh/id_rsa ^C

$cat ~/.ssh/

// copy the contents to whichever repository/

Now, try git pull it should work.

Wednesday, July 1, 2015

Upgrade Fedora 21 to Fedora 22

Fedora 21 to Fedora 22 Upgrade howto:

# Boot Fedora 21 first :)

# update the system
yum update

# Run this command to bring in all fedora 22 rpms ( takes lots of time - may be you want to run this overnight)
fedup --network 22

# Now , you may have faced some issues related to some packages which are all displayed at last, just
take those logs in text file. This helps just in case you face any issue in the future.

# Now, reboot the system , Select upgrade in grub menu.

# After installing packages, system will boot as fc22. :)

Post Fedora 22 update:

# update all packages in fc22
sudo dnf update

# If you want to have maximize, minimize buttons install this.

dnf install gnome-tweak-tool.noarch
Open gnome-tweak-tool  -> Windows -> ON Maximize, minimize buttons.

# You may want to explore more gnome-tweak-tool depending upon your needs.


Tuesday, June 16, 2015

encrypt / expiry date for shell script

Can you encrypt a shell script?
Can you set a expiry date so that shell script will no longer execute?

check this link:

Tuesday, June 9, 2015

sshfs fuse - howto

mkdir /mnt/gfvm1

sudo sshfs root@  /mnt/gfvm1

seems there is some bug in fuse.
ls -ltr /mnt on gfvm1 shows some special ?? chars

firefox image display issues

Firefox unable to display images present on the website

Unable to see small images on website:

check this option, it may be unchecked.

Contents -> Fonts and colors -> Advanced.

Allow pages to choose their own font - should be CHECKED.

Friday, May 29, 2015

merge two/more pdf files , rotate pdf file

How to join two pdf files (in Linux):
yum install pdfjam

# pdfjoin file1.pdf file2.pdf

Where file1.pdf and file2.pdf are the pdf files to be joined.

output will be file2_joined.pdf
(So, You need not specify this output file as part of pdfjoin command)


How to rotate a pdf file and then save (in Linux):

qpdfview /path/to/file1.pdf

rotate using menus. then just save the file. thats it :)


Wednesday, May 20, 2015

gluster NFS in Fedora 21

gluster volume start
gluster volume status

Now status does not show NFS ports, it is shown as N/A.

Ok, lets check whether any nfs server is running ?

In machine nfs server was running.

#systemctl status nfs-server

Now stop it
#systemctl stop nfs-server

Create the volume and check whether NFS ports are visible(like 2049).

Yes it is. :)

One weird thing, you atleast needs once to START(nfs server) and then STOP(nfs server) and then go ahead with creating volumes.

gluster has its own NFS server, you don't need to run NFS server in your machine.
You atleast needs once to start and stop the NFS server. I think something is configured / enabled here which is made use by glusterfs. This is most likely a bug.

Thursday, April 16, 2015

synchronous vs asynchronous socket

synchronous vs asynchronous socket calls.

Builds up slowly and explains nicely.

Wednesday, April 1, 2015

vim tools

google CCTree vim plugin

Some commands :

:CCTreeLoadDB cscope.out

:CCTreeTraceForward main


:CCTreeRecurseDepthMinus   //you can run this multiple times.. But It will reach a limit :)

:CCTreeRecurseDepthPlus   //you can run this multiple times.. But It will reach a limit :)

// for directory view

// To see all functions in single file

Sunday, March 29, 2015

Default OS after Fedora installation

grep menuentry /boot/grub2/grub.cfg
This will display all your grub entries

Highlight the entry you want to default to - for example Windows 7 (loader) (on /dev/sda1) Right click and choose copy


vi /etc/default/grub
Change the entry


GRUB_DEFAULT="Windows 7 (loader) (on /dev/sda1)"
i.e. paste the entry you want (including the quotes)

Save, then type

PS: Having this "Windows 7 (loader) (on /dev/sda1)" is enough.

grub2-mkconfig -o /boot/grub2/grub.cfg

thats it and this worked for me.


Tuesday, March 17, 2015

32GB restriction on microsd cards

Why there is a restriction on smartphone saying that it support microsd of size upto 32 GB.

Because specs says so::

Currently, microSD cards have a maximum capacity of 32GB as this is a limitation imposed by version 2 of the SD Specifications: “High Capacity SD Memory Card: More than 2GB (This version of specification limits capacity up to and including 32GB)”.

console access to VM

On the virtual machine, add ‘console=ttyS0‘ at the end of the kernel lines in the /boot/grub2/grub.cfg file(by executing the following grubby command):

# grubby --update-kernel=ALL --args="console=ttyS0"
NOTE: ssh to VM (or) use virt-manager and run the
above command. 

Now, reboot the virtual machine:
# reboot


virsh create /etc/libvirt/qemu/YOUR_VM.xml

virsh list
// output
// say is the domain.

Now, connect to the virtual machine’s console (here

# virsh console
#virsh console <ID number>


Friday, February 6, 2015

sharing folder host and guest

Sharing folders and files from Host to KVM guest(both linux);

install samba server on Host. (system-config-samba)

Do the configuration required using system-config-samba. (adding directory to share, user name , password). (in Host) use same system-config-samba.

// to set rw permission on all folders uncomment this in /etc/samba/smb.conf

setsebool -P samba_export_all_rw on

sudo service smb restart

Then, do mount from KVM guest.
mount -t cifs //   /mnt/samba  -v

Note, here workspace should be last directory name of the past you shared.
For example in path /home/to/path/workspace.

to mount permanently using fstab add this entry :
 // /home/gfuser/workspace/ cifs username=username,password=whatever_password,iocharset=utf8,sec=ntlm 0 0

then run ,
mount -a

for best practices , use this guide

dd for creating a file with specific size

dd for creating a file with specific size

trying to create file: first used random - didn't work. then tried, urandom, worked fine. for non-cryptographic uses like this :) use only urandom.

renaming a file in git

want to rename a file in git ?

git mv