Remote Upgrade for Fedora/Redhat

by David K. Levine
This involves two machines, a master machine from which you will conduct the operation, and a slave machine to be upgraded. The slave machine does not need to have a monitor, keyboard, mouse, cd-rom drive, usb port, etc. It does need a harddrive and a network connection and a working redhat installation running sshd, but it may be located anywhere on the internet. The slave machine should be on a local network with dhcp running.

step 0: ssh from the master machine to the slave machine. On the slave machine execute steps 1 - 5

-------on the slave machine

step 1: get the iso's from http://fedora.redhat.com/ and put them somewhere on a harddrive, for example in /iso. Important: make sure you do not put them on the / partition - this partition can easily be busy during shutdown, rendering the isos unmountable during the initial part of the Fedora installation and causing the entire procedure to fail.

step 2: mount the first iso, for example
$mkdir /mnt/iso
$mount -t iso9660 /iso/yarrow-i386-disc1.iso /mnt/iso -o loop

step 3: from the /isolinux directory of the iso (in the example /mnt/iso/isolinux) copy the files vmlinuz and initrd.img to the /boot directory, changing the names to something sensible, for example /boot/vmlinuz-yarrow and /boot/initrd-yarrow.img

step 4: find out the hardware addresses of /iso and /boot; the df command will show your disk mappings

step 4: put a copy of the kickstart file ks.cfg in the /boot directory modifying two lines. Replace --partition=sda6 with the partition your /iso directory is located on (and change the name of the directory from /iso if you called it something else). Replace /dev/sda1 in the mount command with your /boot partition

#System  language
lang en_US
#Language modules to install
langsupport --default=en_US
#System keyboard
keyboard us
#System mouse
mouse generic3ps/2
#network
network --bootproto=dhcp --device=eth0
#Use interactive kickstart installation method
interactive
#Use hard drive installation media USE YOUR OWN HARDDRIVE
harddrive --dir=/iso --partition=sda6
#Reboot after installation
reboot
#Upgrade existing installation
upgrade
%pre
                                                                                                                                                         
#!/bin/sh
                                                                                                                                                         
mkdir /tmp/boot
#USE YOUR OWN HARDDRIVE
mount -t ext3 /dev/sda1 /tmp/boot
cp /tmp/boot/grub/grub.conf /tmp/boot/grub/grub.sve
cp /tmp/boot/grub/grub.bak /tmp/boot/grub/grub.conf


What this kickstart file does is

1. copies the grub.conf file with the grub.bak file; this means that if the system reboots part of the way through the installation, it will reboot into the original configuration rather than trying the install again, giving you a fighting chance of fixing things. For example, if something goes wrong, you can use vnc or a power recycle to reboot the machine, and it will reboot to the original configuration provided the installation program hasn't left things in an inconsistent state.

2. provides the minimal information needed to get the Redhat installer anaconda running in upgrade mode. Once anaconda is running, with grub configured correctly, it will launch vnc, and you can monitor further installation progress from the master machine.



step 5: modify the grub.conf file and make backups

In the /boot/grub directory (as root) edit the grub.conf file and add to the end the following entry replacing sda1 with your boot device and replacing lev0201.dklevine.com with the address of your master machine.

title Yarrow
        root (hd0,0)
        kernel /vmlinuz-yarrow  ks=hd:sda1:/ks.cfg vnc vncconnect=lev0201.dklevine.com ramdisk_size=8192
        initrd /initrd-yarrow.img


Copy this file to /boot/grub/grub.bak, then edit it again. There will be a line


default=n

This refers to the entry that will boot automatically. The first entry is numbered 0. Determine which entry is your new entry, say m, and change the line to read

default=m

Remark 1: You can delete the ks and vnc vncconnect options and not bother with resetting default if you are going to do the install using keyboard and screen, and simply want to boot the installation program from grub.

Remark 2:  The documentation claims that you can start vnc from within the ks.cfg file, but this does not work, start it as a kernel option.


Remark 3: the ramdisk_size=8192 is critical. If you leave it out, the installation program will not have workspace needed to mount drives and everything will fail.


--------now back to the master machine

step 6: run

$vncviewer -listen

on the master machine

-------and finally on the slave machine

step 7: reboot the slave machine, for example

$shutdown -r now

step 8: monitor the installation procedure from the master machine vncviewer. You should have only one option, what to do about grub. Choose the default, which is to upgrade grub. This will make sure after the installation the system will reboot to the upgraded operating system. Use F8 from vncviewer if something goes wrong and you need to reboot the slave.

NOTES: