A chinese lion statue

Linmaya is a personal webpage created to share my learnings about GNU/Linux in various aspects. Here, you will find posts related to 'System Adminstration', 'Programming' and so on apart from 'General' topics. It is nothing to do with any other webpage with similar/same name. This name is a confluence of two words; 'Lin' as in Linux and 'Maya', which in Sanskrit means, filled with.

Ravishankar Haranath

Mirroring Debian repositories using debmirror

admin September 28th, 2008

No Gravatar

This is a quick guide for those who want to keep a local repository of Debian packages in their machines/servers either for internal consumption or for setting up a public mirror for Debian (very much encouraged to do so). Copy the following bash/shell script lines to a file say, ‘mirror-debian.sh’ and set its executable bit suitably using chmod command (chmod +x mirror-debian.sh). Ofcourse, you need to install debmirror package as root/sudo using the command, apt-get install debmirror. You may install it using Synaptic package manager also.

###########################################################################################

#!/bin/bash

DEST_ROOT=”/mnt/repos/mirror”
DEBMIRROR_OPTS=”–ignore-release-gpg –ignore-missing-release –ignore-small-errors –progress –postcleanup –nosource”

debmirror $DEBMIRROR_OPTS \
-h ftp.de.debian.org \
-r debian-security \
-d testing/updates \
-s main,contrib,non-free \
-e http \
-a i386 \
$DEST_ROOT/debian-security && echo “Mirrored ‘Debian-security’ successfully.”

debmirror $DEBMIRROR_OPTS \
-h ftp.de.debian.org \
-r debian \
-d testing \
-s main,contrib,non-free \
-e http \
-a i386 \
$DEST_ROOT/debian && echo “Mirrored ‘Debian’ successfully.”

########################################################################################

Note:

1. The script mirrors ‘testing’ tree of Debian distro with sections main, contrib and non-free and the corresponding Debian-security repository.

2. The mirror is done for i386 architecture (Normal PCs and Notebooks). If you need to include other architectures add them to -a i386 lines as comma separated values. Ex., to mirror arm binaries additionally, the line will look like ‘-a i386,arm’.

3. Source code is not mirrored. If you want source code to be mirrored too, remove the argument –nosource from DEBMIRROR_OPTS.

4. The DEST_ROOT should be suitably set to the root of the directory where you intend to keep your mirror. In my case, I have set it to /mnt/repos/mirror/ directory.

5. Once, the mirroring is done, you can modify the /etc/apt/sources.list to use the newly created mirror for getting packages.

6. This script in general, can be adjusted to mirror Ubuntu repositories as well.

  • General |
  • Comments (0)

CDMA modem as network connectivity medium

admin September 1st, 2008

No Gravatar

The idea here is to give a ‘how-to’ on setting up a mobile, CDMA based USB modem as an alternate internet connectivity medium in places where LAN, WiFi and / or WiMax are not readily available.

Hardware Requirements:

  1. Linux PC/Notebook/Netbook
  2. CDMA-1x USB Modem (Device being used: Reliance M880)

Software/OS Requirements:

  1. Linux Operating System with “usbserial” and “cdc_acm” device driver modules
  2. “pppd”, “wvdial” applications and their dependencies installed on the System

Setup: The steps followed in setting up this CDMA based connectivity can be split into 3 steps, as follows.

  • Configuring kernel modules for auto-loading at bootup
  • Configuring “wvdial” application for dialup / ppp connection
  • Initializing / starting the connection

Configuring kernel modules for auto-loading at bootup

  • Open a terminal and type the command, ‘sudo bash’. This will prompt you for current, logged-in user password. Enter the password to become super-user
  • Type ‘gedit /etc/modules’ to open the file /etc/modules
  • Add the following entries just after the comments;

    usbserial vendor=0×19d2 product=0xfffd
    cdc_acm


    Vendor and product values may change if you use different CDMA modem. The values given are for Reliance M880 modem. Please use appropriate values in that case. You may get those values from ‘lsusb -v’ command, when the device is connected.
  • Save and close the file
  • Reboot the machine for automatic driver loading to happen

Configuring “wvdial” application for dialup / ppp connection

  • Open a terminaL and type the command, ‘sudo bash’. This will prompt you for current, logged-in user password. Enter the password to become super-user
  • Type ‘gedit /etc/wvdial.conf’ to open the file /etc/wvdial.conf
  • Replace the contents of the file /etc/wvdial.conf with the following;

    [Dialer Defaults]
    Init1 = ATZ
    Init2 = AT+CRM=1
    Modem Type = Analog Modem
    SetVolume = 0
    Baud = 115200
    New PPPD = yes
    Modem = /dev/ttyUSB0
    Carrier Check = no
    Stupid Mode = 1
    ISDN = 0
    Phone = dialing-number
    Username = username
    Password = password

    Please use the appropriate value for Dialing-number, Username and Password. Username and Password will generally be the same for Reliance connection (will be the phone number)
  • Save and close the file

Initializing / starting the connection

  • Open a terminal and type the command, ‘sudo bash’. This will prompt you for current, logged-in user password. Enter the password to become super-user
  • Create a backup copy of the file /etc/resolv.conf as /etc/resolv.conf.bak. Remove all the contents of the file /etc/resolv.conf
  • Run, ‘wvdial’ to start the connection

Note: Once the above steps are properly followed, subsequent operation/usage only requires running the command ‘wvdial’ as sudo/root, with the USB-CDMA modem connected to the Computer.

  • SysAdmin |
  • Comments (0)

Setting up good old Debian using LiveCD

admin August 3rd, 2008

No Gravatar

Well, I’m a Distro crazy… my mind always keeps thinking of trying new distros especially those which has some distinguishing feature. This craziness or the interest to put it in a formal way, resulted in me trying various Linux distributions, major being Debian, Ubuntu, Fedora, SuSe, Mandrake (now Mandriva), Crux, ForeSight Linux, PCLinux OS, and my own customized version of Crux (which I experimented for sometime and called it unofficially as Prodix :-)). I can’t remember few other distros which I must have tried since, my inception in to the Linux world from 2001. Of course, I even tried FreeBSD, and its variants for short period.

The major difference I found among these distributions is the package management system provided with them. Personally I was not very happy with YUM until rpm based distros started using apt. SuSE’s YasT is good so is Mandrake’s urpmi. The Conary package management system from rPath which is being used in ForeSight Linux is definitely worth giving a try because of its radical package management approach and using PackageKit as the default front-end to add/remove packages. But, personally APT still stood out for me, reason being several.

1. Debian and its derived Distros are my longest used ones so far and APT always was a boon.

2. It made me not care for dependency tracking while installing a package.

3. The number of packages it provides in its repositories is really large to cater to various needs.

I was using Ubuntu since, Breezy release. There is no complain about it at least from my side since, it worked just fine for me including its LiveCDs. But, this weekend I had a strong feeling to try the good old Debian again and I never waited. I downloaded the Lenny net-install CDs and booted the system. Though I could boot the system, it could not detect my ATAPI DVD/RW from LiteOn!!! I even tried downloading and trying with various builds of net-install CDs but unfortunately, none of them could able to detect my DVD/RW drive:-(

I was bit disappointed at this time.. but suddenly an idea flashed in my mind… hurry I can try the longer route. The route is none other than downloading a Debian LiveCD image, booting the system with it and then bootstrapping the system with debootstrap. Cool isn’t it!! well… may not be really cool for a newbie.

Following are the steps I followed to get a Debian system out of a minimal (non-GUI version) Debian LiveCD. Of course, you should have a working internet connection.

1. Download Debian LiveCD image from http://live.debian.net/cdimage/lenny-builds/current/i386/debian-live-lenny-i386-standard.iso

2. Burn the image on to a CD. You may even use a Business card sized CD since, the image is just ~123MB!

3. Boot the system with this CD. My system booted properly and put me into a shell, with auto-login. User name being ‘user’. This user will have sudo permissions. You know what I said right:-)

4. Now I did ‘sudo bash‘ to get in as root.

5. I used cfdisk command to partition my hard-drive and mounted the root filesystem into /mnt. You may have to mount additional partitions as sub-directories inside /mnt. For example, if you have a separate /home you should mount that partitioned drive into /mnt/home after creating /mnt/home directory.

6. Then, I used ‘debootstrap lenny /mnt‘ to bootstrap the minimal Debian Lenny flavour into my root filesystem.

7. It took sometime to download and strip the minimal package set into my root filesystem.

8. Then, I mounted dev, proc, sys filesystems and did chmod into /mnt

mount -t proc proc /mnt/proc;

mount –bind /sys /mnt/sys;

mount –bind /dev /mnt/dev;

chroot /mnt

9. Then, you need to install grub, the linux kernel and upgrade the entire system using apt-get commands.

apt-get update;

apt-get install grub linux-image-i686;

apt-get -f dist-upgrade;

dpkg –configure -a

10. Finally, edit the files /boot/grub/menu.lst, /etc/fstab, /etc/resolv.conf and put proper entries as needed.

11. Remember to run grub-install to install grub boot-loader in MBR (Master Boot Record). You may have to manually enter root filesystem mount details in /etc/mtab in order for grub-install to work correctly. For example, make sure you have something like ‘/dev/sda2 / ext3 defaults 0 0′ as an entry in /etc/mtab.

12. That’s about it.. now you exit from chroot environment unmount proc, sys, dev filesystems under /mnt and reboot the system. Take the LiveCD out of the drive and the system should boot to your new Debian installation:-)

Then, you can start tweaking other things like /etc/apt/sources.list as needed and install Desktop environment of choice and so on. Anyway, I’m happy that my good old Debian is back with testing branch, with full action!!

  • SysAdmin |
  • Comments (0)

OpenMoko - Let us impact the material world

admin June 29th, 2008

No Gravatar

There is this nice writing by Sean Moss-Pultz from OpenMoko team in one of the mailing lists. This is just an excerpt from his writing. Please for the link for his original post.

People use heroes as touchstones to help them surmount their challenges. John Maeda has been a hero of mine ever since I first discovered my love for combining art and computers. I encourage you all to learn more about this incredibly creative person. His “Laws of Simplicity” would be a good place to start. For projects like ours, these are indeed guiding lights.

Let me share one of his “laws” with you today; it’s the tenth one:
“Simplicity is about subtracting the obvious, and adding the meaningful.”

Hardly a day goes by for me without thinking about this elegant idea. The smart phone has become too complex. Our challenge is to make it simple and wise.

Yes I am well aware of the distance between us and this goal. The complexity of our system pains me as much as I’m sure it pains you. But starting today, I hope we can become more conscious and more focused on simplicity and wisdom.

We have been hard at work subtracting the obvious from our current architectures. Our new framework initiative (http://wiki.openmoko.org/wiki/OpenmokoFramework), is all about simplicity achieved through a complexity of thought and design. But Maeda insists that we must add meaning. Removing the obvious is not enough. So then, what meaningful for a smart phone? What exactly can we add that hasn’t been added before?

Today let me share two concepts. The first stems from a genre of design called “reactive graphics”. Pressed to come up with an explanation of how this differs from interactive graphics, I would say the following:
Reactive design engages the viewer at an almost instinctual level, rather than just the communication level found in interactive designs. This has a profound effect on how an individual views technology. “Reactivity” is, in my opinion, the key ingredient for making computers feel more human. All living organisms react. When our Neos begin to react to the environment around them, they will feel more alive to normal people. This is comforting. This is a simple way for us to impact the material world.

Meeting interesting people with creative ideas is perhaps the most rewarding part of my job. Last night, while fighting off the less-than-helpful side of jet-lag, I had an great conversation with my new Columbian friend, Offray, about how Openmoko can better impact our daily lives. The Neo, to him, is a social cognition node — an artifact — where we can balance the power of the individual with that of the group within the mobile world.

Here comes the second concept: Artifacts, he explained, have values embedded within, but sometimes they are not explicit. Our challenge, he said, is how to make this explicit.

Start with things people are familiar with and find new ways to make them more qualitative, says Offray. Take SMS, he continues, instead of just plain text, why not send special compressed messages, readable only by Neos. We can use these as enablers to change mobile ecosystems. Hack their network to embed more freedoms for normal people. Add more meaning. Transform our Neo into an artifact.

These are only two concepts. Many more exist. Together, we must start a conscious exploration of simple ways to impact the material world around us. Exactly where this will lead us is unclear. But we must begin.

  • General |
  • Comments (0)

Languages, frameworks and Linux

admin June 29th, 2008

No Gravatar

Since the time I adopted Linux as my primary OS, some of the things which bothered me as a developer as well as an end user are the programming languages, libraries and application frameworks used in Linux. I was kind of irritated by the fact that Linux has tools and libraries implementated in many different languages. Also there are multiple libraries and tools to do the same thing. Going a step further, even to manage packages there are many different packaging styles and package managers. All this appeared a real mess.

After looking at various languages like C, C++, Objective-C, C#, Haskell, and Python, it made sense to me that a single language might not be suitable for all the developers. Languages primarily serve as means to an end. Though for embedded programming C tends to become the de-facto language of choice, it is definitely not the case with present Desktop and Server systems. While the open-source .NET implementation in Linux available as Mono framework gives the ability to develop applications using Common Language Infrastructure (CLI), one can definitely write fairly complex tools using Python, a purely interpreted language. For all the machine critical, low-level access requirements there is C which is more close to the system in terms of execution of code. Hence, except in constrained environments, the languages show themselves as the means rather than obligations for development.

Even though a single programming language may not be the choice for every developer, with respect to Operation System perspective, maintaining a single, complete and robust application framework makes a lot of sense. This uniqueness is also required in software package management. A distribution should stand out not just because of giving a particular set of applications but, by following and supporting a particular application framework for its entire application set including system modules. This makes the distribution matured and adaptable. Cocoa, a robust, elegant and complete application framework has made OS-X a great Operating System; .NET, a complete application framework has made application development a lot easier for MS-Windows Operating System, even increasing its adaptability. Such a standard application framework is what is to be concentrated in a typical Linux distribution in order to field it as a competitive Open Source alternative to commercial OSes. By having a single, complete framework doesn’t mean that it should provide APIs for a single language. Rather, it should provide bindings for most-commonly used interpreted languages such as Python, for example. This enhances framework adaptability and also makes desktop applications to adher to a single framework, even though they are written using multiple languages, as supported by the framework. This brings about standardization in the Linux world without adversely affecting freedom of development and encourages commercial hardware and software vendors to adapt Linux as their primary OS choice. Hence, such a framework indirectly helps in bringing about quicker and better support for latest hardware, among others.

  • General |
  • Comments (1)

Next »