Penesive Random Experiments

Mounting iso disk on Linux

Recently i was asked to set up linux boxes for our lab systems and so i started installed CentOS in the linux machines. The installation process was easy, mostly using the default configuration.However there was one issue, the lab machines did not have cd players and access to the internet was restricted.

We needed a mechanism to set up to install packages to without using DVD drive or connecting to the internet. We thought why not copy the iso images to the linux boxes and set the package manager (YUM) to use the iso image ? We did the same and i will now explain how we set up them image.

First lets assume that the DVD image (.iso) is copied to some directory say /home/centos/Centos.iso.The first step is to mount the image to the file system.

$mkdir /mnt/centos
$mount -o loop -t iso9660 /home/centos/centos.iso /mnt/centos

Now you can view the content of the centos. check it using

$ls /mnt/centos

The next step is to configure yum to look for the file we have just now mounted

$vim /etc/yum.repos.d/CentOS-Media.repo

add the mount path to the file and then set the enabled in the file to 1

file:///mnt/centos
enabled =1

Save the changes and exit.Note:You have to be root to do all these changes

Now you have to disable the base repo else yum will be complaining unable to load the base repository file

$vim /etc/yum.repo.d/CentOS-Base.repo

Add enabled to 0 in all the repository and if enabled is set to 1 change it 0

enabled=0

Save changes and exit from the editor

Now we need to ask yum to clean all the meta data and start the update all

$yum clean all
$yum update all

You will see that the files are read from the mount point in the log that is printed.You can now install any package by using the following command $yum install pacakgename

We can make the mounting to the filesystem automatic by adding the following to /etc/fstab

$vim /etc/fstab
/home/centos/centos.iso     /mnt/centos   iso9660 loop,auto,ro  0 0 

Save the changes and exit and the next time you boot up , you need not do the above configuration once again.

Cloning linux next tree

I wanted to submit some patches to the kernel nothing big but some of the basic checkpatch.pl fixes. This would require me to clone the linux-next tree.

First,some background on the linux-next tree.linux-next tree is the place where changes from different trees (mm tree, drivers tree, etc) of the kernel are merged everyday. The merges are then built everyday with allmodconfig and tested by trying to boot up the kernel . This process helps to find the conflicts between different kernel trees early and to fix it.The status of the builds of the everyday linux-next branch can be found in this link http://kisskb.ellerman.id.au/kisskb/branch/9

So in order to create a copy of the tree to my PC i have to clone the tree using git. I needed the path of the linux-next tree in the git.

As i searched through the different sites for the linux-next branch path to clone, all the sites gave me the address

git://git.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git 

But when i tried to do a clone of the git using the command

git clone git://git.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git

I got the following error

git clone  git://git.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git 
Initialized empty Git repository in /home/pradheep/temp/linux-next/.git/
fatal: The remote end hung up unexpected

I wanted to make sure that the path is correct so i trimmed the web address to the git/kenel.org and then i found that the linux-next tree has been moved to the new path (It must have happened after the kernel.org got hacked)

So the new path of the linux-next tree is

git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

and the http address is

http://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

so at the end i ended up cloning using the following command

git clone git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git

and the entire linux-next was cloned to my PC :-)

Now off to doing some trivial patches so i can get my name in the linux kernel.