Brand Claim Brand Claim
by Mushtaq, Obaid

SLES Offline Upgrade

Background

The Open Telekom Cloud (OTC) does not directly support the SLES distribution upgrade process, e.g. using "zypper dist-upgrade". As we have described in an earlier blog post, we could achieve dist-upgrade by changing the repos and performing the online upgrade. However, as outlined by SUSE here, this online process is not supported for all the upgrade paths and in some cases the only way to go is to perform an offline upgrade.

There had been a customer request to have the possibility to upgrade from SLES_12_SP5 to SLES15_SP5 using the offline process as this seem to be the only option supported by SUSE. Therefore, we are providing this guide.

Warning

Below, we describe how the SLES ISO file could be used for the offline upgrade process to start. Please note that this is an unsupported procedure and is not the recommended way to go. Ideally, a new instance with the needed SLES version should be created, and the application+data should be migrated to that new instance.

Please test this procedure on some test machines a couple of times before trying on production. Also, make sure that you back up your VM and are able to restore it.

Backup

Before proceeding, please ensure that you have backed up your instance following your favourite backup/restore method. Also make sure that you are able to use that backup to restore to the previous state of your instance.

Steps

Follow the following steps to perform the offline upgrade.

  1. On your SLES12_SP5 machine, download the ISO file SLE-15-SP5-Full-x86_64-GM-Media1.iso from the SUSE website.

  2. Create and attach an empty 50 GB volume to your SLES12_SP5 machine

  3. Make sure that the disk appears on your VM using fdisk -l for example.`

  4. Write the ISO file to the disk. Make sure you select the right disk. Selecting a wrong disk can erase your existing installation and data.

dd bs=4M if=./SLE-15-SP5-Full-x86_64-GM-Media1.iso of=/dev/vdb status=progress oflag=sync
  1. Now mount the disk briefly and check if the following files are there. In our case the disk was path /dev/vdb2.
mount /dev/vdb2 /mnt
ls /mnt/boot/x86_64/loader/linux
ls /mnt/boot/x86_64/loader/initrd
umount /mnt
  1. Reboot your instance, quickly open the console of your instance using the OTC Web UI. You can then press "c" to enter the GRUB command line.

  2. Identify your disk which has the ISO written to. You can check using ls command on the GRUB CLI. You should see the contents of the ISO file there.

ls
ls (hd1,msdos2)/
ls (hd1,msdos2)/boot/x86_64/loader/linux
ls (hd1,msdos2)/boot/x86_64/loader/initrd
  1. Run the following commands in the GRUB CLI to prepare to boot from the ISO contents. Please make sure that you are using the right device for root.
set root=(hd1,msdos2)
linux /boot/x86_64/loader/linux Upgrade=1
initrd /boot/x86_64/loader/initrd
  1. Now type "boot" in the GRUB CLI will boot your instance from the ISO.
boot

The upgrade process will start. Connect to the remote console in the OTC UI if not already connected. Follow the guided procedure from SUSE. At one point, the upgrade process will ask for the removal of the older SLES12_SP5 repos - please let the installer remove them. Select the modules and extensions to be installed as per your requirements. Make sure that you have tested the upgrade process with all the modules and extensions you need on your final system. Also chose not to modify the MBR of the disk.

  1. Once the upgrade process has finished, the machine will reboot, and then you are able to SSH into it using its IP address. Check the basic things on the machine.
cat /etc/os-release
uname -a
  1. The GRUB entry needs to be modified to use OTC_SLES15_SP5 or something better. Please change GRUB_DISTRIBUTOR in /etc/default/grub and the run the following command to recreate the config.
grub2-mkconfig -o /boot/grub2/grub.cfg
  1. After that, we would need to add the SLES 15 SP5 repos manually to the machine. The best option would be to scp the contents of /etc/zypp/repos.d/*.repo from a fresh SLES15_SP5 instance. Perform the following on your SLES12_SP5 instance.
sudo mkdir /etc/zypp/repos.d/backup
sudo mv /etc/zypp/repos.d/* /etc/zypp/repos.d/backup
mkdir /tmp/sles15sp5/
scp linux@<IP_OF_A_NEW_SLES15SP5_MACHINE>:/etc/zypp/repos.d/* /tmp/sles15sp5/
sudo mv /tmp/sles15sp5/* /etc/zypp/repos.d
ls -l /etc/zypp/repos.d
rm -rf /tmp/sles15sp5

Once the repos are there, we can run the following commands to check and perform the upgrade of the system.

sudo zypper refresh
sudo zypper update
  1. Once the zypper update is done, please reboot your machine to be sure even if the zypper is not asking you to do so.

Side Effects

One side effect we noted was that the boot time of the machine increased a bit. This is possibly caused by the net-tools package which is depricated in the newer SLES versions like our target SLES15_SP5. As a workaround, you can edit the following file /usr/lib/cloud-init/wait-mds to use the "ip" command instead of the "route" command. You would need to replace "/sbin/route" with "ip route". Also note that the image name of your ECS in the OCT UI will still be the old one, e.g. Enterprise_SLES12_SP5_latest.

Credits

Many thanks to Josef Wuebbels for giving the hint on using the ISO, written to an EVS disk, to boot an ECS instance and Richárd Takács for the testing.