user-avatar
Today is Thursday
December 5, 2024

Category: linux

April 14, 2010

FOSS for budding developers workshop

by viggy — Categories: linux, tech — Tags: , , , , , 1 Comment

Last weekend, CMRIT GLUG along with IBM and FSMK conducted a 2 day workshop, “FOSS for Budding Developers”. This workshop was completely technical in nature and among the many FOSS workshops that I have attended, one of the most useful one for me. The professionalism of IBMers could be seen during the workshop which was also the main reason for the huge success of this workshop.

The workshop covered the following topics,
Day 1

  • Linux Kernel Developement
  • Eclipse IDE and how to develop plugins in it
  • Day 2

  • Linux Test Project
  • Apache web server and developing applications in it.
  • OpenPegasus
  • I was interested in Linux Kernel Developement and the Linux Test Project sessions. I had taken my laptop to make the best use of the workshop.

    I have been using GNU/Linux since last 2 years, but never did I get the courage to compile and build the Linux kernel. Only around 6 months back, I had for the first time with help of Naresh, installed the new linux kernel on my system using apt-get. The main reason for not trying out building my own linux kernel was that I was afraid that I would loose all the data I had in my system. However for the workshop I had decided that I will try it out. So when the Linux Kernel session started, I was very excited.
    In the pre-lunch session, we were introduced to various tools that any Hacker would require while trying to read the source code or build from source code. We were introduced to gcc, gdb, make, makefiles, strace,ltrace and cscope tools. Though I knew little about gcc and gdb, I realized the importance of the other tools. I particularly was marveled by “cscope” and “strace”. Optimized use of cscope will surely decrease the time taken to go through the source code for any developer. I remember it had taken me around 2 months just to go through the Evolution source code. If I had used cscope then, it would hardly take me 2-3 days for the same. We were given a very brief introduction to cscope during the session, but I will learn more about it myself and write about it in the near future.
    The pre-lunch session thus prepared the ground for us to venture in to building the linux kernel.

    Post-lunch we started with Building the Linux Kernel 2.6.33.2 version. I was amazed by the simplicity involved in building the kernel. It is just a 7 step procedure, if you are building the kernel for your own desktop or laptop.

    It took around half an hour to execute. After this I just need to update my grub if it has not been done by the above steps already. Just confirm it by having a look at /boot/grub/grub.cfg. If the new kernel lines are added then you are ready to Reboot and use the new kernel which was just built.
    Thats all.

    After booting into the new kernel, we started writing simple codes for new kernel modules and drivers. Again the simplicity of writing a new module or driver and loading it amazed me. However a lot more has to be explored and I will definitely try them in future.

    On day 2, I attended the Linux Testing Project workshop. It was again wonderfully planned by the IBM team. We were first given a brief introduction to the history and importance of the Linux Testing Project with the team making it very clear that the testing cycle is as important as the development cycle. After this we had a hands on session.

    In the hands on session, we started with building the Linux Testing Project in our systems. Than the IBM team had come with some tasks for us. We were asked to run a test case which was written such that it fails intentionally. This was done so that we could study the test case and come up with a solution as to why that particular test case was failing. I had teamed up with Saket and together we were very close to finding the solution. It was quite fun and really a good Hacker workshop.

    There were many interesting points that we noted while trying the Linux Testing Project. One among them was, I was using Linux Kernel 2.6.31.x where as Saket was using Linux Kernel 2.6.33.2. So when we executed the Containers Testcases on our systems we found that some test passed successfully in my system but failed in Saket’s system. This clearly showed us that Linux Kernel 2.6.33.2 had some bugs. We did not dig into the matter due to lack of time. However I need to check it soon.
    I have skipped lot of technical details here as I will give the technical details later when I try it again myself.

    April 13, 2010

    Use ALT-TAB for VNC machine on Linux

    by viggy — Categories: linux, tech — Tags: , , , Leave a comment

    This is for those who work usually on systems through VNC, I am one among them. It was very cumbersome for me to select tabs in the VNC system using mouse and not able to use ALT-TAB functionality. Hence when I searched in Google for any solution, I found a very simple soultion.

    Just change the ALT-TAB key binding in your linux machine to something comfortable for you. After you have done this, whenever you select ALT-TAB, the system passes that key-binding to the VNC window.

    The solution is just that simple. :). Enjoy.

    March 23, 2010

    Fatal: Module fuse not found

    by viggy — Categories: linux, tech — Tags: , , Leave a comment

    This was the error that I was getting when I tried to mount my NTFS partition in CentOS5.3 final. I tried to search for a solution for one full day but I couldnt find a solution. Finally I got a forum where it was suggested that this is basically a mismatch of kernel-headers and kernel modules. So I tried to find the kernel-modules which matched my kernel-headers version. However even after I tried to install the correct version of kernel-modules, I still faced the same issue. Hence I finally gave up and decided to upgrade my kernel to the latest stable version.

    So when I updated my kernel to 2.6.18-164.15.1.el5, and I rebooted, I could easily mount the NTFS partion.

    January 13, 2010

    split and join huge files

    by viggy — Categories: linux, Misc, tech — Tags: , , , , , , Leave a comment

    I recently has asked my friend to download edubuntu9.10 iso . It was a 3.4 gb iso. After he finished downloading when i had to transfer it to my system, we faced a small problem. His LAN card was not working and we had only 1gb pen drive. So the only option we had was to split the iso into files of size 1gb and then transfer them using pen drive.

    command to split a huge file into smaller file.

    split -b 1G

    is the prefix of the smaller files that will be created.

    After I split the files, i transfered each file in to my system and then joined the files using a very simple “cat” command.

    Join the files splitted by the above commad.

    $cat aa bb cc dd>huge-filename

    The above command will join all the files and create the file huge-filename.

    I need to test whether the order of the smaller files matters in the cat command. Logic says that it should matter. lemme check it out.

    Confirmed it. The order of the smaller files is very importent to get back the original file.

    January 3, 2010

    real player sound problem solved

    by viggy — Categories: linux, tech, ubuntu — Tags: , , , , Leave a comment

    Thanks to this post, I was able to solve the real player sound problem in my machine.

    1. Enable Alsa soft-mixing as described in post http://ubuntuforums.org/showthread.p…multiple+sound
    (also setup esd and multimedia system settings as described in that post)

    2. Install realplayer as described in http://ubuntuguide.org/#realplayer

    3. Install alsa-oss

    4. Open the launcher script realplay located in Realplayer’s install directory (/opt/RealPlayer if you followed previous instructions)

    5. Find lines
    Code:

    if [ -n “$LD_PRELOAD” ]; then
    echo “Warning: LD_PRELOAD=”$LD_PRELOAD””
    fi

    6. …and after add this code:
    Code:

    LD_PRELOAD=”$LDPRELOAD:/usr/lib/libaoss.so”
    export LD_PRELOAD

    7. Now you get RealPlayer working with Alsa mixing (and so combinations of Realplay, Xine, Mplayer, Frozen Bubble,…sounds work at the same time )
    mriya3 is offline Reply With Quote

    December 11, 2009

    rm -rf *

    by viggy — Categories: debian, linux, tech — Tags: , , Leave a comment

    I just got an idea of trying out the command rm -rf * in a virtual system. I had thought of creating a new domU in xen server in the office and then testing in it. However I just tried to switch on my Desktop which had been shut since last week due to some problem with my HDD. Strangely when I started the desktop, the BIOS detected my HDD and it booted into ubuntu. Now this made my expiriment lot more easier because now all I had to do was take a backup of the VM image and then boot using the image in qemu.

    After booting up I started a screen and tried the command
    rm -rf /
    I got an error saying that “/” could not be deleted.

    Then I tried the command
    cd /; rm -rf *

    and then it started deleting all the files in my filesystem. I went to another screen and tried the command “ls”. It told me that “ls” command not found. Then I tried various commands, but none of them worked, except echo and cd. I dont know why these didnt get deleted.

    At last I was left with following file structure:
    notice:/# cd
    dev/ home/ lib/ proc/ .rnd sys/ var/

    When I just press Tab twice, I get the following output:

    notice:/#
    : } case continue elif export getopts kill popd select then ulimit
    ! alias cd declare else false hash l printf set time umask
    ./ bg cdcgi dirs enable fc help let pushd shift times unalias
    [ bind cdtmpl disown esac fg history ll pwd shopt trap unset
    [[ break command do eval fi if local read source true until
    ]] builtin compgen done exec for in logout readonly suspend type wait
    { caller complete echo exit function jobs ls return test typeset while

    Though this would be a very stupid thing to do in any circumstances, I didnt loose anything as I was just testing it on a VM. However the importent question still remains that is there any way to recover fmo here?

    December 9, 2009

    pushd and popd commands

    by viggy — Categories: linux, tech — Tags: , , , Leave a comment

    Suppose you are presently working some directory and for some reason you need to cd into some other directory for some trivial but urgent work. So how do you remember which directory you were in. This is where pushd and popd commands are used.
    Pushd command adds a directory to the top of the directory stack, or rotates the stack, making the new top of the stack the current working directory. With no arguments, exchanges the top two directories and returns 0, unless the directory stack is empty.
    sumit@sumit-Desktop:/var/www/cgi-bin$ pushd /usr/share/apps
    /usr/share/apps /var/www/cgi-bin
    sumit@sumit-Desktop:/usr/share/apps$

    and popd command removes entries from the directory stack. With no arguments, removes the top directory from the stack, and performs a cd to the new top directory.
    sumit@sumit-Desktop:/usr/share/apps$ popd
    /var/www/cgi-bin
    sumit@sumit-Desktop:/var/www/cgi-bin$

    I hope it is useful. Definitely very useful for me.

    November 13, 2009

    How To Check Which Software Package Is Using More Space

    by viggy — Categories: linux, tech, ubuntu — Tags: , , , , Leave a comment

    Courtsey: http://www.unnionline.com/blog/?cat=9

    If you’re running out of disk space and you want to quickly see what packages are using the most space on your hard drive, use the following command

    dpkg-query –show –showformat=’${Package;-50}t${Installed-Size}n’ | sort -k 2 -n | grep -v deinstall | awk ‘{printf “%.3f MB t %sn”, $2/(1024), $1}’

    That will sort the packages by size, putting the largest ones on the bottom. If you only want to see the top few, you can type

    tail -n 10

    at the end, because in all likeliness you have a *lot* of packages installed

    November 11, 2009

    What does ‘+’ in BLOCKS column in partition table output of fdisk command mean?

    by viggy — Categories: linux, tech, ubuntu — Tags: , , , Leave a comment

    On the printout of a partition table, in the BLOCKS column, several
    partition block count have a ‘+’ at the end – some do not. What does
    this mean?

    It means that the partition does not end on the 1k block boundary.
    In other words the partition has an odd number of 512 bytes sectors
    allocated. Use “x” command and then “p” to see.

    October 26, 2009

    Significance of Lost+found directory in Linux filesystem

    by viggy — Categories: linux, tech, ubuntu — Tags: , , , Leave a comment

    Courtsey: http://tldp.org/LDP/Linux-Filesystem-Hierarchy/html/lostfound.html
    As was explained earlier during the overview of the FSSTND, Linux should always go through a proper shutdown. Sometimes your system might crash or a power failure might take the machine down. Either way, at the next boot, a lengthy filesystem check (the speed of this check is dependent on the type of filesystem that you actually use. ie. ext3 is faster than ext2 because it is a journalled filesystem) using fsck will be done. Fsck will go through the system and try to recover any corrupt files that it finds. The result of this recovery operation will be placed in this directory. The files recovered are not likely to be complete or make much sense but there always is a chance that something worthwhile is recovered. Each partition has its own lost+found directory. If you find files in there, try to move them back to their original location. If you find something like a broken symbolic link to ‘file’, you have to reinstall the file/s from the corresponding RPM, since your file system got damaged so badly that the files were mutilated beyond recognition. Below is an example of a /lost+found directory. As you can see, the vast majority of files contained here are in actual fact sockets. As for the rest of the other files they were found to be damaged system files and personal files. These files were not able to be recovered.

    total 368
    -rw-r–r– 1 root root 110891 Oct 5 14:14 #388200
    -rw-r–r– 1 root root 215 Oct 5 14:14 #388201
    -rw-r–r– 1 root root 110303 Oct 6 23:09 #388813
    -rw-r–r– 1 root root 141 Oct 6 23:09 #388814
    -rw-r–r– 1 root root 110604 Oct 6 23:09 #388815a
    -rw-r–r– 1 root root 194 Oct 6 23:09 #388816
    srwxr-xr-x 1 root root 0 Oct 6 13:00 #51430
    srwxr-xr-x 1 root root 0 Oct 6 00:23 #51433
    -rw——- 1 root root 63 Oct 6 00:23 #51434
    srwxr-xr-x 1 root root 0 Oct 6 13:00 #51436
    srwxrwxrwx 1 root root 0 Oct 6 00:23 #51437
    srwx—— 1 root root 0 Oct 6 00:23 #51438
    -rw——- 1 root root 63 Oct 6 13:00 #51439
    srwxrwxrwx 1 root root 0 Oct 6 13:00 #51440
    srwx—— 1 root root 0 Oct 6 13:00 #51442
    -rw——- 1 root root 63 Oct 6 23:09 #51443
    srwx—— 1 root root 0 Oct 6 10:40 #51445
    srwxrwxrwx 1 root root 0 Oct 6 23:09 #51446
    srwx—— 1 root root 0 Oct 6 23:09 #51448