# Troubleshooting image OS

_It seems that some Image IDs do no show up anymore when called from OCI CLI_ &#x20;

[The documentation](https://docs.oracle.com/en-us/iaas/images/ubuntu-2004/) still mentions about their existence, though.

If you do get an empty output for image OS when running the script **test\_env\_variables.sh.** ...

```
variable "instance_image" {
   default = ""
}
```

... then, that specific Image OS that is called by the script is not available anymore (at least when called from OCI CLI)



Initially, when generating the Image OS ID, I was looking for a specific Ubuntu OS: [**Canonical-Ubuntu-20.04-2021.01.25-0**](https://docs.oracle.com/en-us/iaas/images/image/cb6a4ca4-47e9-40fa-bdb1-8ee41636c8a7/)&#x20;

### **Practice time**

**From the Cloud-Shell:**

**a) generate Tenancy as environment variable:**

```
 TENANCY=$(oci iam compartment list --access-level ACCESSIBLE |\
 grep -i tenancy | \
 awk 'NR==1{print $2}' | \
 sed -e 's/,//g' -e 's/"//g')

```

_check if any output:_

```
echo $TENANCY
ocid1.tenancy.oc1..aaaaaaaahereisyourtenancyID
```

b) **generate the image OCID as environment variable** (this time, for image OS **Canonical-Ubuntu-20.04-2021.01.25-0**)

```
var_image_os=$(oci compute image list --all \
--output table --compartment-id $TENANCY | \
grep "Canonical-Ubuntu-20.04-2021.01.25-0"  | \
awk {'print $16'})
```

_check if any output (output from Dubai region):_

```
zack@cloudshell:~ (me-dubai-1)$ echo $var_image_os

zack@cloudshell:~ (me-dubai-1)$ 
```

No output...&#x20;

Good!&#x20;

**Now let's list what are all the available images for "Canonical-Ubuntu-20.04-2021" of that specific tenancy:**

```
zack@cloudshell:~ (me-dubai-1)$ oci compute image list --all --output table --compartment-id $TENANCY | grep "Canonical-Ubuntu-20.04-2021"  | awk {'print $12, $16'}
Canonical-Ubuntu-20.04-2021.04.15-0 ocid1.image.oc1.me-dubai-1.aaaaaaaa3wp4iu2q6btlxz4xvjqbdoe6odaecj6en7ygg3ltimps67aaeqfq
Canonical-Ubuntu-20.04-2021.03.25-0 ocid1.image.oc1.me-dubai-1.aaaaaaaakymk4j6nkwer37kw2gsrzsbhoosqnckz6hmsmdpzr42ie5hlitga
Canonical-Ubuntu-20.04-2021.02.15-0 ocid1.image.oc1.me-dubai-1.aaaaaaaajhivl4i4xsvw2uzyis65j3272uxnr5asvssfu2pz6eosurlj2gga
zack@cloudshell:~ (me-dubai-1)$ 
```

So, we have three images & their IDs:&#x20;

```
Canonical-Ubuntu-20.04-2021.04.15-0
Canonical-Ubuntu-20.04-2021.03.25-0
Canonical-Ubuntu-20.04-2021.02.15-0
```

&#x20;_No sign of Canonical-Ubuntu-20.04-2021.01.25-0, which was initially used._

### Test for new Image OS

_Tested in Frankfurt region_

a) Tenancy

```
 TENANCY=$(oci iam compartment list --access-level ACCESSIBLE |\
 grep -i tenancy | \
 awk 'NR==1{print $2}' | \
 sed -e 's/,//g' -e 's/"//g')
```

b) This time, using the **Canonical-Ubuntu-20.04-2021.03.25.0** to extract the Image ID

```
var_image_os=$(oci compute image list --all \
--output table --compartment-id $TENANCY | \
grep "Canonical-Ubuntu-20.04-2021.03.25-0"  | \
awk {'print $16'})
```

c) Check if environment variable provides output:

```
zack:~ (eu-frankfurt-1)$ echo $var_image_os 
ocid1.image.oc1.eu-frankfurt-1.aaaaaaaa43mhnlbh4kyx6wxr3e2bvahuplycudwkrruopismoiy2goqiiszq
```



The repository scripts are already adapted to **Canonical-Ubuntu-20.04-2021.03.25-0.**

However, if you do meet the empty field in the future for _instance\_image_, now you know how to troubleshoot it, and how to replace your Canonical Ubuntu Image OS with an available one.



_Fini!_
