Fastest way to patch Xenserver using a script

Updating a new or existing Xenserver with multiple updates, is a time consuming task, as the GUI only allows to install one by one patch, and reboots between every patch. Some of the patches is also included with newer patches, so you may save some time by walking through each one from the newest to find out which one is included.

I found a Xenserver script to download and install on the fly by Sean Flattery:

I’ve modified this script to first download, and then apply them in as separate script. This is because if a patch is already there, the script will fail to install the patch. You need to download all patches and unzip them to a webfolder before running the script. Enter the URL to the webfolder in the script. I’m using a public dropbox folder for this, but then the Xenservers needs to have internet access. You can use this powershell script to download and unzip all kinds of Citrix hotfixes, directly from Citrix support website:

for PATCH in XS61E015 XS61E020 XS61E018 XS61E022 XS61E017 XS61E012 XS61E010
wget http://mywebserver/$PATCH.xsupdate 
UUID=`xe patch-upload file-name=$PATCH.xsupdate | awk '{print $2}'`
echo "$UUID"

You only need to download patches once for each pool. The patch list above is all you need for Xenserver 6.1, to download all 6.02 patches, replace the first line with this:

for PATCH in XS602E006 XS602E010 XS602E019 XS602E024 XS602E026 XS602E027

When download is complete, these patches will now be ready for installation in the Xenserver pool. You may now apply all patches to a specific host and then reboot later. Remember if this is a pool, you need to do this on the master first, and remember to migrate off all workloads from this host manually first. Please replace hostuuid in the script with the UUID of the host you want to patch. User xe host-list to get host UUID

PATCHLIST=`xe patch-list | grep "uuid ( RO) " | awk '{print $5}'`
echo "Installing patch $UUID"
xe patch-apply host-uuid=(hostuuid) uuid=$UUID

When this script is complete, reboot the host and continue on the next host.


Before applying updates, remember to eject XS-TOOLS CD from all running VM’s.

When using this script I’ve seen that you are unable to boot xenserver after patch is complete whenever you have mulitpath enabled. Here is a blogpost that describes how to solve this:

Also from same blog, how to determine what driver disks you need to update:

4 thoughts on “Fastest way to patch Xenserver using a script

  1. Pingback: Fastest way to patch Xenserver using a script | Conde Malagueta

  2. Thought I’d share this too-

    Pulls the updates directly from Citrix’s site, and auto-obtains a list of required updates from Citrix’s XML API. Therefore, no need for user intervention or manual definition of the patch names/locations.

  3. Make sure you have enough free space in HD.
    # df -k
    make sure at least 20% free space (or 80% used)
    If not enough, delete unused gz in /var/log
    I recently can’t apply latest XS6.2 patches because not enought space.
    The patch is >300mb
    Apply patches in master first.
    Evacuate host from HA first

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>