OsImages related activities

Updating an osimage

Updating and maintaining software is a good practice. Software provided by the controller nodes (over NFS and the modules environment) is centralized on the controller node; this only needs to be updated once.

Linux distribution software will need to be updated in the osimage. This article will provide the steps.

Backup

It's a good rule of thumb to have a backup of the osimage before changing it. The most common way is to clone the original and either work on the clone or the original.

Step-by-step guide

Check which osimages you have. Multiple groups may share the same osimage.

1. List the image(s):

# luna osimage list
+------------+----------------------------+-------------------------------+
| Name       | Path                       | Kernel version                |
+------------+----------------------------+-------------------------------+
| compute    | /trinity/images/compute    | 3.10.0-957.27.2.el7.x86_64    |
+------------+----------------------------+-------------------------------+

2. Manual changes:

a. Using lchroot you can enter a chroot environment where the modifications to the image can be made. We assume 'compute' as the image used.

# lchroot compute
IMAGE PATH: /trinity/images/compute
chroot [root@compute /]$

b. After updating the software in the image, using yum or any other method, typing exit will get you back to your shell.

Complete!
chroot [root@compute /]$ exit
exit

if the kernel was updated, make sure to set the desired kernel in luna prior to packing.

# luna osimage change --kernelversion <version> compute

Note: in most cases the kernels installed can be obtained from 'ls /lib/modules' inside the image.

c. After the modifications, the image will need to be (re)packed.

# luna osimage pack compute
osimage pack for compute queued
2024-06-14 12:27:26 :: queued pack osimage compute with id 1077
2024-06-14 12:27:26 :: assembling kernel and ramdisk for osimage compute
2024-06-14 12:28:09 :: finished assembling kernel and ramdisk for osimage compute
2024-06-14 12:28:09 :: building osimage compute
2024-06-14 12:29:09 :: finished building osimage compute
2024-06-14 12:29:09 :: creating provisioning for osimage compute
2024-06-14 12:29:13 :: created torrent provisioning for osimage compute
2024-06-14 12:29:14 :: created http provisioning for osimage compute
[========] Image compute Packed.

d. After this, reboot the nodes to have them updated.

-- OR --

3. Use the ansible-playbook to add a new roles or software: This will overwrite changes which are managed by ansible.

# ansible-playbook compute-redhat.yml

The playbook above rebuilds what TrinityX manages, which is the right tool for returning an image to its defaults. To keep your own additions reproducible rather than re-applying them by hand after every rebuild, they can be expressed as playbooks of your own which run against the image directly. See modifying and updating an image for the three ways of doing this.