Exporting jails from iocage


#1

I know I am way behind the power curve, but I have been trying to get off of my TrueOS 18.03 box for the past couple of months, because I hate the “nuke and pave” approach.

That said, I am down to the last few items before I rebuild the machine. The one that is being a thorn in my side at the moment is iocage. My 18.03 install has py36-iocage-0.9.10. So I did an iocage export, and it zipped the VM up nicely. Transferred it to my freebsd 12 laptop, and tried to iocage import it, and got

# iocage import worf
Importing dataset: worf
Importing dataset: worf/root
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/iocage_lib/ioc_json.py", line 364, in json_write
    with iocage_lib.ioc_common.open_atomic(write_location, 'w') as out:
  File "/usr/local/lib/python3.6/contextlib.py", line 81, in __enter__
    return next(self.gen)
  File "/usr/local/lib/python3.6/site-packages/iocage_lib/ioc_common.py", line 538, in open_atomic
    with tempfile(dir=os.path.dirname(os.path.abspath(filepath))) as tmppath:
  File "/usr/local/lib/python3.6/contextlib.py", line 81, in __enter__
    return next(self.gen)
  File "/usr/local/lib/python3.6/site-packages/iocage_lib/ioc_common.py", line 501, in tempfile
    tf = tmp.NamedTemporaryFile(delete=False, suffix=suffix, dir=dir)
  File "/usr/local/lib/python3.6/tempfile.py", line 551, in NamedTemporaryFile
    (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
  File "/usr/local/lib/python3.6/tempfile.py", line 262, in _mkstemp_inner
    fd = _os.open(file, flags, 0o600)
OSError: [Errno 30] Read-only file system: '/NX72003/iocage/jails/worf/tmpk2b7v31d'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/iocage", line 10, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/iocage_cli/import.py", line 36, in cli
    ioc.IOCage(jail=jail).import_()
  File "/usr/local/lib/python3.6/site-packages/iocage_lib/iocage.py", line 1254, in import_
    ioc_image.IOCImage().import_jail(self.jail)
  File "/usr/local/lib/python3.6/site-packages/iocage_lib/ioc_image.py", line 263, in import_jail
    "template=no", _import=True)
  File "/usr/local/lib/python3.6/site-packages/iocage_lib/ioc_json.py", line 1380, in json_set_value
    self.json_write(conf)
  File "/usr/local/lib/python3.6/site-packages/iocage_lib/ioc_json.py", line 368, in json_write
    raise FileNotFoundError(write_location)
FileNotFoundError: /NX72003/iocage/jails/worf/config.json

So it apparently marks the /iocage/jails/ as readonly.

Is there any way to work around this?

–vr