Description

When the ./provision_vm.sh script is executed while installing Contrail Services Organization (CSO) 4.1.1, the installation may fail with the "IndexError: list index out of range" error.

This article gives the reason for the error to be output and what must be done to resolve the error.

Symptoms

The following error logs are seen in the /root/Contrail_Service_Orchestration_4.1.1/logs/provision_vm_error.log :

Traceback (most recent call last):
  File "/root/Contrail_Service_Orchestration_4.1.1/provision_vm/csp_provision_vm.py", line 243, in <module>
    provision_vm.setup_vm_environment()
  File "/root/Contrail_Service_Orchestration_4.1.1/provision_vm/provision_vm.py", line 264, in setup_vm_environment
    load_images(host,server, space, vrr)
  File "/root/Contrail_Service_Orchestration_4.1.1/provision_vm/provision_vm.py", line 171, in load_images
    vmlinuzz = kernel[1].split('/')[2]
IndexError: list index out of range

When you check the code provision_vm.py file, the following line is shown to have failed:

---- Code Snip----
    out, err, ret = host.exec_cmd_with_ret_status('cd /root/disks/ && virt-builder --get-kernel ~/disks/{0.EN_US}'.format(cloudimage))
    kernel = out.split()
    vmlinuzz = kernel[1].split('/')[2]

When we try to execute the above cd /root/disks/ and virt-builder --get-kernel <image.img> commands manually, messages similar to the following may be observed:

root@CFTSBNGCSO:~/disks# virt-builder --get-kernel ubuntu-14.04.5_163.img                           
virt-builder: libguestfs error: /usr/bin/supermin-helper exited with error status 1.

Note: To see the complete error message, you may need to enable debugging. If debugging is not enabled, no output will be seen when the above command ( virt-builder --get-kernel <image.img> ) is executed.

Solution

From the above error details, we can confirm that it is an issue with the package libguestfs-tools .

To resolve this issue, you need to install the package afresh or uninstall the existing one and re-install it.

But before implementing the resolution, you need to rename the corrupted sources.list in the Juniper repository and replace it with the latest sources.list obtained from the Internet. Remember to rename the new list from sources.list.bk to sources.list in the Juniper repository.

cp /etc/apt/sources.list  sources.list_old
cp /etc/apt/sources.list.bk  sources.list

After completing the above step, use the following commands to uninstall and install the libguestfs-tools package.

sudo apt-get remove libguestfs-tools
sudo apt-get install libguestfs-tools
sudo apt-get update
 
root@CFTSBNGCSO:~# dpkg -l | grep libguest*
ii  libguestfs-perl            1:1.24.5-1ubuntu0.1    amd64    guest disk image management system - Perl bindings
ii  libguestfs-tools           1:1.24.5-1ubuntu0.1    amd64    guest disk image management system - tools
ii  libguestfs0:amd64

The installation should proceed successfully now.