Quote: Sleep is for the weak and sickly.
(Courtesy of fortune cookies)

Welcome to the Cool Spot of the Sun

Migrating from any Linux Distros to *Debian*

Why Debian???

Simple to maintain. Tell me about all the wasted time I had installing and upgrading non-debian based Linux machines.

Very versatile programs, Debootstrap, Alien, Apt & Dpkg!



Debian has a really nice tool called Debootstrap. It can strap(convert) theoretically(IMHO), any 'chroot' obeying OS to Debian. So armed with this knowledge, Its possible to first install a 'chroot' obeying OS on a machine and then convert to Debian.



So a rough method would be

  1. Install a working Linux Distro

  2. Debootstrap Debian on it



For example I used a blade server IBM JS20 for the experiment. Known OS as of (Aug-1-05) these are some major Linux distros supporting JS20, namely SUSE SLES 9.0, Redhat RHEL 9.0, Fedora Core 4 , Yellow Dog Linux and many more.See here for a detailed list.



Steps

  • So we will start out with SUS SLES 9.0. Be sure to download the PowerPC edition, else you might have to rip out your blades and install some x86 based PresHots there. Anyways once that is done burn them on the CD's. I think only the first 4 CD's required. For a x86 machine download the appropriate CD-ISO and burn it.

  • You will see lot of firmware(bios) thingy(on a powerpc) printed and then the CD boot command loaded. Make sure that the CD can boot and load the required kernel. Once all the thingys are done you will be YAST or YAST2(dunno which, but either of them).

  • Once in Yast choose everything as the default other than the 'Partitioning'.Architecture specific things

For PowerPC based JS-20 blades

Note: If you have a single Harddisk make

/dev/hda1 Primary PPC PReP Boot 0.5MB

/dev/hda2 Primary Linux Swap (depending upon server memory some GB's)

/dev/hda3 Primary Linux Ext3 (/debian some size, make atleast 5GB, Harddisk space is cheap Dude)

/dev/hda5 Primary Linux Ext3 (/home partition)

/dev/hda6 Primary Linux Ext3 (/ for Suse)

And if you have an additional hard disk, Do whatever you want with it.

For Intel x86 machine: Just make sure you have an extra partition somewhere of the size about 5GB+ and mount as /debian

  • Do a minimal Install and reboot. When you reboot, due to the installation the blade will try to boot from the Hard disk and fail on the blade server!!!. This would not happen in case of a x86 machine, in which grub/lilo would load normally.

  • The Reason?

JS-20 Specific stuff Yaboot is slightly stupid, It will(IMHO) try to load the first Linux Primary partition and fail as it is /debian in our case). To get around this, change the boot sequence through the management module and boot from the CD and when the boot prompt of the CD shows use the following command to use the CD's Kernel to mount and boot /dev/hda6 AKA / of SUSE. Note: This problem won't occur on x86 based machines.

Both JS-20 and Intel x86
  • When you are on the command prompt, again fire up YAST2. And through YAST2 options install the following program( You might have to search for the software in YAST2 first). The Software needed are wget and perl. I suppose a minimal version does install perl but not not wget. Once wget is installed we can install 'debootstrap' program.

  • Now debootstrap is available only as a .deb package. And SUSE default packages are in .rpm format. We need to convert .deb to .rpm. So we will use 'alien'. You can get 'alien' here alien. Either Download it using wget or burn it to a cd. Dont burn it right now, But wait till I tell.

  • Once alien is acquired(not through roswell), Get debootstrap debootstrap and either burn it or use wget through your blade, if you have a network connection through the blades. Once this is done use the cd, and copy both the programs to your blade. Alien in the gzip format so Unzip it and as you should do for any software, read the README and follow instructions.

  • Once the above stage is finished, use Alien to convert .deb to .rpm via 'alien -r debootstrap_XXX_XXX.deb' XXX=version might be different for everyone.

  • You will then get a rpm package for debootstrap which you can install via 'rpm -ivh debootstrap_XXX.rpm' In case you get some error like some .so not found, search on the net which library is that .so(b) a part and install it via YAST2 as we did earlier for perl and wget.

  • On installation debootstrap will be installed(in /usr/sbin/debootstrap). Now you are ready to bootstrap debian. As you remembered we allocated a partition /dev/hda3 and mounted it as /debian. At this point we have 2 options, first debootstrap via the net or via a special file called basedebs.tar(basedebs.tar for x86 and basedebs.tar for JS-20)

Using local basedebs.tar

debootstrap --arch powerpc --unpack-tarball /path-to-downloaded/basedebs.tar woody /debian

--arch = powerpc in our case

/debian = place where we want to install our stuff



Using Internet

debootstrap --arch powerpc woody /debian

woody, or sarge or sid etc the name depends on the scripts found here for debootstrap /usr/lib/debootstrap/scripts/, So in your case you might want to substitute the required script.

  • After some time and an occasional coffee, the /debian would have wonderfully converted to a full fledged Linux directory structure and ready to be customized. At this point chroot will come into play. In a nutshell, chroot will 'pseudo mount' the given directory as / and run whatever sh you want on that /. e.g. say you are in /blah/blah2 and use 'chroot . /bin/bash' in it. It will pseudo mount /blah/blah2 as / and run bash.

  • We will do the same for /debian and run 'chroot . /bin/bash' . Now we are in debian mode!!!!wowey !!!. Now we will run our favourite debian command (for me it is favourite) base-config and start all configuration. Choose whatever we install and let debian install all the packages(X & others). As you can see we needn't need a network connection at all. But you surely should have network connection at this point, as other than the freaking hvc0 terminal we don't have anyway to connect to the blade(remember no video cards)

  • Hmmm.. i always forget to mention this, somethings would fail if you do an immediate base-config after chroot'ing'. You might want to mount proc. Proc allows some really system specific stuff stored in memory(like the name of our powerpc architecture) so that base-config doesn't get confused.

mount -t proc proc /proc

  • Now you can modify /etc/fstab to show the current harddisk status. You can copy your old fstab from SUSE installation to your new Debian installation. Make sure that you do it out of your chroot environment. ;-)

  • You might at this point want to install some very essential tools like nano, module-init-utils, ssh and mc. Use apt-get to do that.

apt-get install nano mc module-init-utils ssh

  • using nano or mcedit open the /etc/network/interfaces file. Create it if not present

and make sure it has this lines

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

  • This makes sure than lo and eth0 are loaded at runtime so that we can remotely connect to our blades. You might want to add eth1 if you have more network ports. You might also want to set static ip in some circumstances, In that case refer to the syntax of interfaces file.

  • We wont install a custom kernel-image as to this date i am not able to get a debian kernel-image working on JS20. So we will make SUSE kernel boot our OS. For that exit the chroot environment using plain 'exit'

  • now copy the whole /boot to /debian/boot (all files and subdirectories).
    For JS-20: Copy /etc/yaboot.conf to /debian/etc/yaboot.conf


    For x86:

  • For JS-20:Initially we know that yaboot did not boot on because of the non-presence of the yaboot.conf and kernel on the first Linux partition. Now as we had bootstrapped the whole system to the first Linux partition, and copied the kernel (boot files) to the /debian we can now boot the system using the SUSE kernel+Debian system. But before that we will have to modify the /debian/yaboot.conf and make sure that yaboot.conf has the /dev/hda6 line changed to /dev/hda3 line that is the kernel and / are on /dev/hda3 and not on /dev/hda6. eg.yaboot.conf file.


    For x86:To write something about lilo and grub

  • For JS-20:Also copy the /lib/modules/2.6.5-7.97-pseries64 to the /debian/lib/modules/ 2.6.5-7.97-pseries64. Add the bcm5700 line in the /etc/modules line.


  • For x86:Also copy the /lib/modules/2.6.XXX to the /debian/lib/modules/ 2.6.XXX. Add the bcm5700(netwrok card module name) line in the /etc/modules line.


  • For JS-20:Before rebooting dont forget to add this line for our favourite console hvc0 in /etc/inittab

hvc0:1235:respawn:/sbin/getty -L 9600 hvc0 vt100

  • Now you set for rebooting. Happy Debian'ing'

This concludes the whole tutorial on how-to migrate JS-20 from SUSE 9.0 to Debian. Report to me at abhishek(at)ieee.org (substitute (at) with @) if you find any errors.

Get Firefox!  Use OpenOffice.org lastRSS.php - RSS parser for PHP Valid HTML 4.01! Valid CSS! IP Address Lookup


The visitor number 13195
Disclaimer