Remote OS Conversion: Doing It Remotely
Ok, this post is useful for more than its original scope… the problem is simple; your machine is hundreds of miles away and all you have is remote console. Your mission if you choose to accept (if you’re even given the choice) is to install Centos on the remote machine. Now, huge disclaimer… there may be a better way to do this.
As I saw it… I could have tried to set something up to run from the current distribution. My problem is that I also had to redo the partition tables and reformat. I can’t boot to a second medium as I can’t just pop in a CD or USB drive. This also excludes rsyncing a Centos install to the destination.
My first attempt was to chainboot an ISO using grub. Unfortunately I wasn’t running grub2 and I had to use an ISO which can’t be mapped because it isn’t a HD device. Of course grub2 apparently natively supports it. Also don’t be fooled by Google. Loads of people suggest using a knoppix kernel which supports the bootfrom kernel option. The caveat is that the booting kernel must match the kernel in the ISO.
Here was my plan and I totally have done this before. The first line of business was to grab the Centos net install ISO. Fortunately its totally not bloated and is roughly 10 mbs. Next you have to mount it to disect the CD.
mount -oloop Centos_netinstall.iso /mnt/cd-rom
Most, if not all, Linux bootable CDs use isolinux. All I needed to do was find the isolinux configuration, which reminds me a lot like the Lilo configuration file.
The configuration has a kernel and an initrd. The kernel in my case was called vmlinuz and the initrd was called initrd.img. I copied those over to /boot and modified my grub like the following.
title sin
root (hd0,0)
kernel vmlinuz
initrd initrd.img
Fire it up and you have yourself a Centos net install from grub on your remote system.
Let us talk about further thinking… This principal can be used to create a bootable USB Centos net install thumb drive. Simply install grub to the thumb drive and perform the previous commands.
Say you have a Android x86 bootable ISO and you want to load in your own kernel or turn the ISO into an bootable USB drive. Do the same to grab the kernel and the ram disks. Then boot it from the USB or what have you. Once booted you can grab the configuration for the kernel from /proc/config.gz and compile your own replacement kernel remembering to slip in your new modules in the Android appropriate location.
There’s probably more helpful things you can do after you split the ISO open and remove the precious brains.
Caio!