Skip to main content

Posts

Showing posts from 2012

Debian Squeeze and Mac OSX Lion - Dual boot

With Mac OSX Snow Leopard, things were much simpler to install and run a Linux operating system just by using rEFIt boot manager utility, on my Mac Mini(4,1 Mid-2010 model). With the introduction of Lion, Apple has introduced a hidden, OS recovery partition. In total, there will be 3 partitions for Mac OSX alone, for Lion. They are ESP (EFI System Partition), Mac OSX installation partition and, the OS recovery partition. Also, as per the GUID Partition Table(GPT) which Mac uses, there can be maximum of 4 primary partitions, with no scope for Extended partitions like in typical MSDOS Partition Table setup. It is also recommended to follow GPT when using Mac.

With all these constraints, I'm actually left with one partition where I can install and run GNU/Linux (in this case, Debian Squeeze). I didn't try resizing an existing Mac OSX installation partition and creating an Ext4 partition for Linux. Rather, I choose to go for fresh installation. You can try with the resizing method…

Making persistant liveUSB from liveCD image

“Universal Serial Bus” is today one of the most common interface available in the computer to communicate with it in various aspects. Having a mobile storage device that seamlessly (well, at least in possible situations) boots on a standard i386 based hardware and allows one to perform his/her work will definitely make the life a lot comfortable. LiveUSB distro is meant to serve this purpose.

Creating a LiveUSB distro using Ubuntu LiveCD iso on a typical Desktop PC / Laptop is explained with the following steps. These steps are meant to be for users already comfortable using command line utilities. For rest of the folks, there are readily available tools. Some of them are, UNetbootin and Liveusb.

Pre-requisites:

1. Install ‘gparted’, ‘syslinux’, ‘mtools’ and ‘squashfs-tools’ using Synaptic package manager or apt-get using a terminal.

2. Download the latest Ubuntu LiveCD distribution for Desktops, from www.ubuntulinux.org.

3. You need to have superuser access (sudo) or should …

Creating Linux filesystem images

I’m sharing the following script which creates a filesystem image of desired size (in kBs) for use in building an installUSB/LiveUSB Pen-drive image or for similar uses. I have written this in my effort to create a installUSB image for Debian-Lenny. Hope it is of some help to somebody:-). You may copy the italicized/quoted text below into a new text file and save it as a shell script (.sh extension). Don’t forget to set its executable bit;-) and also, please don’t forget to leave your comments/feedbacks.

Note: It currently creates images for fat16, fat32, ext2 and ext3 and you should run it as root/superuser (sudo). You can extend this script to generate fs images for other filesystem types as well.

Usage: script-name fs-type output-file required-size-kB
Ex.,; ./mk-hdd-img.sh ext3 myimage.img 600000
This will create a filesytem image called myimage.img of type ext3 and of size ~600MB.

#!/bin/bash if [ $UID -ne 0 ]; then echo “You need superuser/root privileges to run th…

How to extract an initrd image

Well, I had this often repeated problem of searching for how to extract an initrd image only to find that it is basically as cpio+gzip archive but, over a period of time forgetting it so that I come back searching for this again:-) Finally, I made up my mind to put in what all it takes to extract an initrd image in Linux and re-packing it after customization (not covered here, as customization depends on the need), here.

Unpacking the initrd image:

1. Create an empty directory /tmp/initrd (this is an example; you are free to use any other directory name) and cd into it, using the following command
mkdir -p /tmp/initrd; cd /tmp/initrd;
(Replace /tmp/initrd with your directory name, if using a different directory name)

2. Extract the initrd image using the following command
gunzip absolute-path-to-initrd-image | cpio -i —make-directories

Now, the contents of the initrd image will be there in /tmp/initrd (or whatever directory you have used). Go ahead and do the necessary changes an…

Using git over proxy

I was trying to clone Android repository at office when this problem of “Connection refused” started coming when running the ‘repo’ tool. On subsequent googling, I got this really useful link (thanks to Emil Sit) which explained how git can be used over http proxy for those git servers which don’t allow http method as an alternate/bypass to git protocol (As it looks is the case with Android git repository).

Ok, in short, here is what I have done;
Typed in the below lines (quoted) into a shell script called gitproxy and put it in $(HOME)/bin directory. Of course, its executable bits has to be set with chmod a+x $(HOME)/bin/gitproxy. My $(HOME)/bin directory is already part of PATH so that I can access my custom scripts easily.
#!/bin/sh # Use socat to proxy git through an HTTP CONNECT firewall. # Useful if you are trying to clone git:// from inside a company. # Requires that the proxy allows CONNECT to port 9418. # # Save this file as gitproxy somewhere in your path # (e.g., ~/…

Custom d-i banner for your Debian blend

The GUI version of the Debian Installer (d-i for short) comes with a pinkish banner with Offical debian logo and GNU/Linux text embossed. If you are going to use live-installer tool to create a Debian Blend you may as well like to have your own d-i banner for your blend. Here are the quick steps:

Open GIMP image editor tool and create a new image of size 800x75 pixels. 800 corresponds to vga=788, which is the default command line option for vga, passed in boot menu.Create the banner that suites your tastes and save the image as banner.pngSelect menu->image->Flatten Image to flatten the image (i.e., remove Alpha) and save it again.Now, your banner is ready to use. You can use a custom binary-hook script in live-helper such as the following, to get your banner replacing the original d-i banner. The below hook is derived from live-helper configuration for Webconverger.

#!/bin/sh # This is an binary hook for live-helper(7) to overwrite the banner # in the graphical Debian Ins…

Creating GRUB/Syslinux splash images

GRUB splash image creation:
Open GIMP application.Create an image of size 640x480 pixels. You may open an existing image and resize it too.Reduce the number of colors to 14 by selecting menu item “Image->Mode->Indexed”. Don’t use any color dithering.Save the resulting image as splash.xpm and close GIMP.Compress the image file by running; gzip splash.xpmCopy the resulting splash.xpm.gz file to /boot/grub.Run update-grub to upgrade the grub configuration to include this splash image.
Syslinux splash image creation:
Open GIMP application.Create an image of size 640x480 pixels. You may open an existing image and resize it too.Reduce the number of colors to 14 by selecting menu item “Image->Mode->Indexed”. Don’t use any color dithering.Save the resulting image as splash.ppm and close GIMP.Install the package syslinux-common by running; apt-get install syslinux-common as sudo/root. Convert the saved image to syslinux format by running; ppmtolss16 ‘#ffffff=7’ <splash.ppm >spl…

In-field labeling with jQuery

In-field labels are one of the recent design adaptations for HTML forms. Instead of placing a label and corresponding element next to each other, placing the label inside the input element itself makes it looks elegant and conveys the expected input value more easily. jQuery can be very helpful in creating such in-field labels. There are already few jQuery libraries available which can be used for this purpose. But, here I’m trying to show a rather simple, image based in-field labeling technique using pure css and jquery functions only. This may not be very elegant technique but, it does serves the purpose :-P

Here are the steps involved in trying out this technique.
Create a html file (let’s call it test.html) with the contents below.
<html> <head> <title>Welcome to Testbed</title> <script type=’text/javascript’ src=”jquery.js”></script> <style> .inline-bg-image { background-image: url(‘passwd.png’); background-repeat: no-repeat; backgr…

A script to mirror directories locally via rsync

Nothing really fancy here! I just wrote a simple rsync script which can be used to do a mirror of a set of directories from one place to the other. I use this to do incremental mirror of local Debian repositories from my machine, to my external USB hard-disk, so that I can give it to somebody who needs the entire Debian repo.

Of course, it’s application is not limited to copying just a single directory but, you can have an entire system backup by giving space separated list of directories to mirror. This script creates a directory corresponding to the basename of each of the source directories. For example, if the source directory is /opt/mystuff/projects and the destination root directory(named as RTARGET in the script) is /media/disk/backup, the script will create a directory called ‘projects’ under /media/disk/backup and mirrors the contents from /opt/mystuff/projects to /media/disk/backup/projects.

Note: This script comes with absolutely no warranty of any kind. You may …

Using USB CDMA modem to setup a home/private WiFi network

The idea here is to give a ‘how-to’ on setting up a a home WiFi network using mobile, CDMA based USB modem, hoping that bandwidth that you obtain from this service is satisfactory :-)

Hardware Requirements:
Linux PC/Notebook/Netbook
Wifi Access point connected to ethernet port of the Linux box
CDMA-1x USB Modem (Device used: Reliance M880)

Software/OS Requirements:
Linux Operating System with “usbserial” and “cdc_acm” device driver modules
“pppd”, “wvdial”, “iptables”, and “dnsmasq” 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 bootupConfiguring “wvdial” application for dialup / ppp connectionInitializing / starting the CDMA modem connectionSetting up “iptables” for NAT forwardingSetting up “dnsmasq” for resolving DNS and as DHCP server
Configuring kernel modules for auto-loading at bootup
Open a terminal and type the co…

Debian Squeeze, Redmine, Backlogs and Gitolite

Installing Redmine on a Debian Squeeze machine turned out to be bit challenging, especially for a person like me not closely associated with Ruby based development. The below blog post just explains what I did to get the nice setup of Redmine project management system along with Redmine-Backlogs plugin for managing agile, scrum tasks and sprint cycles. You may find it helpful to bring up a similar setup for your own consumption.

Redmine, nginx and passenger packages are custom built and are not installed from the official Debian repository. Please remember that you need to be a root/superuser in order to go further. Please assume that all the tasks have been performed as 'root' user unless explicitly mentioned. The dependency packages as mentioned below, are installed form the Debian repositories using the usual apt-get command. I choose /opt as the directory to install customized software. '$>' just indicates the command prompt in the terminal. Make sure your pro…