Upgrading MkⅡ NAMs with unreliable Internet connections
If your NAM MkⅡ has a slow or intermittant Internet connection, there is a possibility of problems ocurring during a firmware upgrade. The system can enter a fault state when an upgrade takes a significantly long time or is interrupted. To guard against this, it is possible to download a mirror copy of the firmware onto the filesystem of the NAM itself. It can then upgrade itself using this copy as the upgrade source. The process is essentially identical to using a local mirror site with the exception that it uses the device itself as its own mirror server.
The NAM should have access to the Internet during the download step but it does not need Internet access while it is actually upgrading. If the download process is interrupted, it can be easily restarted and it will continue from the point at which it failed. The operation of the NAM is not affected during the download (other than by creating a bandwidth requirement) so this process can be repeated safely and incrementally until it is complete.
Platinum systems use the rsync protocol to update their firmware to the latest revision. rsync is an extraordinarily flexible tool but can be rather complex. The upgrade script on the NAM is a front-end to rsync which is used to hide this complexity and ensure the safe use of the protocol.
Setting up a Platinum system as its own upgrade mirror involves four steps:
- Downloading the mirror content;
- Setting up the system as a local rsync server;
- Configuring the system to use itself as an upgrade server; and
- Performing the upgrade.
The procedure is slightly different for systems with different architectures so the instructions have been split into three. This set only covers NAM MkⅡs. If you are attempting to upgrade an EAM, DM24SxEAM, *TDE instrument or Affinity, please select one of the links below:
Downloading the mirror content
The mirror content occupies a significant amount of disk space, so it is important to check the available space before proceeding. To check the space available, log on to the command line of your NAM and type the command
df -h
The output consists of a table with several lines of content, such as:
DemoNAM ~ # df -h Filesystem Size Used Available Use% Mounted on devtmpfs 497.8M 64.0K 497.7M 0% /dev /dev/sda4 239.9M 135.4M 87.8M 61% / devtmpfs 497.8M 64.0K 497.7M 0% /dev /dev/sda6 108.5G 584.5M 107.9G 1% /var tmpfs 500.2M 0 500.2M 0% /tmp tmpfs 500.2M 2.9M 497.3M 1% /run tmpfs 500.2M 0 500.2M 0% /var/empty tmpfs 500.2M 0 500.2M 0% /dev/shm /dev/sda5 58.0M 6.3M 47.2M 12% /var/log DemoNAM ~
Look for the row where the value in the "Mounted on" column is "/var". In the example above, the available space is 107.9 GB.
These systems require around 95 MB of free space to store the upgrade image. Only proceed if you have enough space.
Next, enter the following command sequence to download the mirror content.
mkdir /var/Pt-firmware-mirror.local cd /var/Pt-firmware-mirror.local GSLSRC=rsync.guralp.com/platinum-stable/CMG-NAM-mk2 rsync -EgHloprtv --exclude resolv.conf rsync://$GSLSRC .
These commands download the appropriate firmware image from Güralp’s server. If a command fails for any reason, it can be repeated. It causes no harm to repeat a command even if it appears to have succeeded.
The final output from a successful download looks like this (although the numbers may be different):
⋮ CMG-CMG-NAM-mk2/var/spool/recdata/.keep CMG-CMG-NAM-mk2/var/spool/to-rdisk/ CMG-CMG-NAM-mk2/var/spool/to-rdisk/.keep CMG-CMG-NAM-mk2/var/tmp/ CMG-CMG-NAM-mk2/var/tmp/.keep sent 52,768 bytes received 91,126,040 bytes 6,753,985.78 bytes/sec total size is 90,933,054 speedup is 1.00 NAM1234 ~ #
A repeated download, after a successful download, looks like this (although the numbers may be different):
NAM1234 ~ # rsync -EgHloprtv --exclude resolv.conf rsync://$GSLSRC . receiving incremental file list sent 418 bytes received 74,456 bytes 49,916.00 bytes/sec total size is 90,933,054 speedup is 1,214.48 NAM1234 ~ #
Problems?
The most common problems experienced at this stage are:
rsync reports “Temporary failure in name resolution”
If you see error messages like
rsync: getaddrinfo: rsync.guralp.com 873: Temporary failure in name resolution rsync error: error in socket IO (code 10) at clientserver.c(122) [receiver=3.0.2]
it means that the Domain Name Service (DNS) client is misconfigured. If you are running DHCP, this may be a problem with your DHCP server not providing the address of a nameserver (or providing an incorrect one). If you are using static addressing, check and correct the namesever using the net-setup tool.
rsync reports “Network is unreachable”
If you see error messages like
rsync: failed to connect to rsync.guralp.com: Network is unreachable (101) rsync error: error in socket IO (code 10) at clientserver.c(122) [receiver=3.0.2]
it means that the network routing is misconfigured. If you are running DHCP, this may be a problem with your DHCP server not providing a default route (or providing an incorrect one). If you are using static addressing, check and correct the default route using the net-setup tool.
rsync reports “rsync error”
If you see error messages like
rsync error: received SIGINT, SIGTERM or SIGHUP (code 20) at rsync.c(541)
it means that, most probably, a firewall is blocking traffic on the rsync port. Ask your network administrator to permit the NAM to open TCP connections to host rsync.guralp.com on port 873.
Setting up an rsync server
The rsync server is configured by creating the file /etc/rsyncd.conf using the following commands:
cat >/etc/rsyncd.conf <<EOF port = 61616 [platinum-local-mirror] path = /var/Pt-firmware-mirror.local comment = Platinum firmware numeric ids = yes log file = /var/log/rsync.log timeout = 600 hosts allow = * EOF
Once the /etc/rsyncd.conf file is in place, you should start the rsync server with the command
rsync --daemon
Configuring the upgrade system to use the local server
Create the file /etc/conf.d/upgrade.local using the following commands:
cat >/etc/conf.d/upgrade.local <<EOF RSYNC_HOST="localhost" RSYNC_PORT="61616" RSYNC_MODULE="platinum-local-mirror" RSYNC_ADDITIONAL_OPTS="--no-delay-updates --delete-during" EOF
Perform the upgrade
The system can now be updated from the mirror by using the upgrade command.
Further Reading
rsync is a fascinating and elegant solution to many file transfer problems. Further information is available from the rsync documentation page.