How To Remotely Install Debian Over A RH Based Distro - Page 3
6) Prepare the boot partition
Now that we're back in the RH system, let's copy the Debian kernel and initrd images to the boot partition:
cp $ASD/boot/vmlinuz-* /boot
Now edit the grub config file to boot into the new Debian system. Make sure to add this before any of the other RH stanzas, since Grub will load the first operating system listed if you have not configured it to do otherwise:
title Debian! root (hd0,1) kernel /boot/vmlinuz-2.6.18-6-686 root=/dev/hda2 ro initrd /boot/initrd.img-2.6.18-6-686
Change (hd0,1) to whatever drive,partition you're using. Also check to make sure that you match the correct versions of the kernel and initrd files. Look at $ASD/boot to double check the kernel and initrd versions that will be used.
Copy our modified grub config to the Debian system:
cp /etc/grub.conf $ASD/etc/
We'll skip the fsck performed on the reboot:
Lastly, we unmount the proc and chroot environment:
If the umount command is giving you an error about the filesystem being busy, use the -l switch:
umount -l $ASD
7) Reboot into Debian for the first time
Here comes the cliff-hanging moment. We reboot into our new Debian system for the first time.
8) Mount boot partition in Debian system
Now if everything went well, you should be booted into the new Debian system. If it did not go well, give it a few minutes and try to login again. If it still doesn't work you'll need to figure out a way to get console access to fix the problem or change to the old RH kernel.
Let's mount our old /boot partition since our skeleton fstab did not account for it. We'll erase what's in there, but don't worry - we have a copy in our own /boot directory right now anyway so we'll just copy it back in:
mke2fs -j /dev/hda1
We create a temporary place to mount the partition:
Then we mount it:
mount /dev/hda1 /boot2
Now we copy our boot files into the new partition:
cp /boot/* /boot2/
Since that is done, let's unmount it and remove the mount point:
Now remove the old directory, since it will now be mounting a partition there:
rm -rf /boot/*
Add the new boot partition into fstab:
# filesystem mount fs-type options dump fsck-order /dev/hda1 /boot ext3 defaults 1 2 /dev/hda2 / auto defaults 0 1 proc /proc proc defaults 0 0
This next command mounts all the mount points located in the fstab:
Now we need to modify the grub config file, since our paths are now different:
title Debian! root (hd0,0) kernel /vmlinuz-2.6.18-6-686 root=/dev/hda2 ro initrd /initrd.img-2.6.18-6-686
Note that we're changing hd0,1 to hd0,0 since we're now booting from the first partition. We need to remove the /boot path from the vmlinuz and initrd images since they'll be in the root of the first partition.