Solved iocage: template not found (but it's there!)

Greetings.

I'm trying to create an iocage jail using a template, but...

Code:
# iocage create -t servicetemplate ip4_addr=192.168.128.5/24 defaultrouter=192.168.128.1 interfaces=vnet0:jpriv vnet=on -n motherhen
Template: servicetemplate not found!
Created Templates:
  servicetemplate
The servicetemplate template is indeed listed in iocage list -t, and nothing looks obviously amiss when I inspect it in the filesystem:

Code:
# less /tank/iocage/templates/servicetemplate/config.json
{
    "cloned_release": "13.1-RELEASE",
    "defaultrouter": "192.168.128.1",
    "host_hostname": "servicetemplate",
    "host_hostuuid": "servicetemplate",
    "interfaces": "vnet0:jpriv",
    "ip4_addr": "192.168.128.100/24",
    "jail_zfs_dataset": "iocage/jails/servicetemplate/data",
    "last_started": "2024-01-09 12:05:44",
    "notes": "This is the 'servicetemplate' jail template.\nIt's intended to be the iocage template for subsequent service jails.\nSee /root/README-servicetemplate.txt for further notes.",
    "release": "13.2-RELEASE-p9",
    "template": 1,
    "type": "template",
    "vnet": 1,
    "vnet0_mac": "f4ee08092b0d f4ee08092b0e"
}

(as far as I can tell, this is valid JSON), and

Code:
# ls -l /tank/iocage/templates/servicetemplate
total 14
-rw-r--r--   1 root  wheel  660 Jan  9 12:23 config.json
-rw-r--r--   1 root  wheel    0 Aug  9  2022 fstab
drwxr-xr-x  18 root  wheel   22 Aug  5  2022 root/

so it's readable.

This message appears to come from iocage_cli/create.py, but the way the error message is formatted, it discards the actual text of the error it's catching, so it's not clear just what it's objecting to. It's presumably a JailMissingConfiguration exception, but the only place that's raised is in iocage_lib/ioc_json.py, when the config.json file is missing, which is pretty clearly not the case here (I note that the exception doesn't include a confirmation of what file it's trying to read). I haven't been ‘clever’ here, and as far as I can tell, everything is in its default location.

I converted the template back to a jail, and was able to start and upgrade it, and reconvert it to a template, but iocage create is still unhappy with it.

The message might need some work, to make it less opaque. But one way or the other, I'm a bit stuck -- are there any suggestions?

Best wishes,

Norman
 
Solved. I found my problem: I had previously had an iocage jail with the given jail name, which meant there was already a snapshot on the template, with that name (even though I'd renamed it out of the way, prior to working on a new one), so creating that snapshot failed.

Discovering this required a bit of light hacking of the source, to disclose highly-relevant exceptions which were being discarded by the code. The intention of discarding those details was clearly helpful, but turned out not to be, in practice, in this case. I've created a bugreport mentioning this https://github.com/iocage/iocage/issues/1301

Norman
 
Back
Top