The present invention relates generally to computer operating systems. More specifically, it relates to methods for patch installation at boot time for dynamically installable, piecemeal revertible patches.
In standard practice, when an operating system is patched, a patch alters the persistent representation of the operating system itself. For example, when patching Windows XP security holes, certain system DLLs are replaced by newer versions. The modified version of the operating system is then saved on a persistent storage device, such as a hard disk, and loaded on the next boot. When patching Red Hat Linux, a new RPM is installed directly on the hard disk, replacing, removing, or creating files, leaving no reliable path to get back to the previous image. In the case of rpms, in principle one can “rpm -U --oldpackage” to downgrade to a prior version of the rpm, but this mechanism is fragile due to details like post-install scripts. Other operating systems checkpoint all or part of the disk at certain intervals and allow rolling back the entire disk or individual files to a prior checkpoint. Undoing a patch requires the user to recall when the patch was installed and which files it affected. In the event that a patch unexpectedly disrupts operation, it can be difficult to revert quickly and easily to a prior version of the operating system.
In one aspect, the present invention provides a method to patch an operating system so that individual patches may be easily and reliably undone. The patches are stored as individual units in persistent storage, separate from the operating system. Then, at boot time, the running operating system image is updated with the patch, but its persistent representation is left unchanged. This way, the patch may be undone simply by marking it inactive and rebooting.
The key advantage compared to prior art is the ability to reliably restore the system to the precise state it was in prior to applying a patch by simply deactivating the patch. Another advantage is that if a set of patches has been applied, any subset of them may be undone by selectively deactivating each patch, e.g., using a patch configuration file.
To provide support for patching without rebooting, the act of activating a patch may be augmented to install the patch contents on top of the running system.
One may gain additional benefit by providing support for dynamically activating and deactivating patches. Activation includes arranging for the patch to be applied on next system boot, and also applying the patch on the running system by updating files included in the patch and running activation scripts (if any) included in the patch. Activation scripts restart any processes affected by the patch's file updates.
Dynamic deactivation includes arranging for the patch to not be applied on next system boot, and also undoing the effects of the patch within the running system, by recovering files named in the patch from the original boot image, updating them with any other active patches that affect them, and running a deactivation script associate with the patch. The deactivation scripts restart any processes affected by the patch's file updates.
In one aspect, a method for booting a computer operating system is provided. A boot loader is loaded from a first flash memory to a random access memory and executed. In one embodiment, the boot loader loads from a second flash memory to a random access memory an operating system file system image archive, installs the operating system file system image archive as a root file system, loads from the second flash memory multiple operating system patches stored separately from the base operating system file system image archive, and installs the multiple operating system patches over the root file system. In another embodiment, the boot loader loads and executes an initialization script that performs the operations instead of the boot loader. The method may be performed on a computing apparatus that includes a digital microprocessor, random access memory, input/output interfaces, a first flash memory, and second flash memory. The first flash memory contains the boot loader, while the second flash memory contains the base operating system file system image archive and multiple operating system patches stored separately from the base operating system file system image archive.
By way of illustration, an example of a particular boot process will now be outlined.
To undo the patch, one merely comments out the “rpm -U” command and reboots. On this subsequent boot, the patch will not be applied to the RAM file system, so the system has been effectively reverted to its pre-patched state. In a preferred implementation, instead of following the above procedure to control whether the patch is installed or not during the boot process, a patch configuration file describes which patches should be installed on next boot and which should not.
In some cases, there may be dependencies among patches, e.g., a dependent patch B may require another patch A. In the event of such patch dependencies, the deactivation of a patch preferably automatically deactivates all its dependent patches as well. Alternatively, patch dependencies may be avoided by structuring patch B as a set of alternative rpms B-with-A and B-without-A and having a patch installer choose the correct alternative based on which other patches are installed.
One may use this invention with any package management tool in place of “rpm”, such as “dpkg”, “tar”, “cpio”, or “zip”. One may use this invention with any file system representation (copy-on-write read-only file system, copy-on-write read-only loopback-mounted file-system-in-a-file, tar, etc.).
Patch activation may be accomplished as follows:
(1) transfer patch to
/mnt/flash/patches/7.11.0/PhyAeluros.i386.rpm
(2) run the commands:
mount -o remount,rw /
rpm -v -U --force /mnt/flash/patches/7.11.0/PhyAeluros.i386.rpm
mount -o remount,ro /
In this preferred embodiment, the patch activation process both arranges for the patch to apply on next boot, and also updates the live image to include the effects of the patch.
The rpm file may include activation scripts that run as part of activating the patch (“% post rules”). For example, activation scripts that may be required to restart any processes affected by the patch. The “rpm -v -U” command above runs these scripts if present.
Patch deactivation may be accomplished as follows:
(1) remove patch from
/mnt/flash/patches/7.11.0/PhyAeluros.i386.rpm
(2) for each file named in the patch, restore the file's content from the original boot image.
(3) run deactivation scripts (if any) stored in the patch (for example, to restart any processes that were downgraded as part of deactivating the patch).
By way of illustration, below is a specific example of an actual patch to Arastra EOS (Aros-2007.1):
This application claims priority from U.S. Provisional Patent Application 61/001,958 filed Nov. 5, 2007, which is incorporated herein by reference. This application also claims priority from U.S. Provisional Patent Application 61/001,959 filed Nov. 5, 2007, which is incorporated herein by reference.
Number | Date | Country | |
---|---|---|---|
61001958 | Nov 2007 | US | |
61001959 | Nov 2007 | US |