Running an ostree deployment in a container



Dear OSTree maintainers,

I'm attempting to build a basic Debian Stretch OS with OSTree. I'm using
the scripts from
https://github.com/dbnicholson/deb-ostree-builder/tree/simple-builder.

In a nutshell:
- the script 'deb-ostree-builder' create the base image with multistrap,
then create the ostree repo with 'ostree commit'.
- the script 'create-deployment' is in charge of creating a deployment
in a local directory with 'ostree pull-local' and 'ostree admin deploy'.

So far so good, I end up with my "deployment" directory, and now I would
like to test it in a container or a VM.

I noticed that the man page of 'systemd-nspawn' gives an example for
running an OSTree deployment [1]. Plus, Philip Withnall added the
'--pivot-root' option in Feb. 2017 for that purpose [2]. So I thought
I'd give it a try.

However I can't get it to work with a directory.

# os=debian
# checksum=57892b6f23ffc70e6d0cdd1dea5ab94da3d890b06f24bb2aa30e0d5f860858c5
# systemd-nspawn --boot \
    --directory $(pwd)/deployment/ \
    --pivot-root=/ostree/deploy/$os/deploy/$checksum.0:/sysroot \
    --bind=+/sysroot/ostree/deploy/$os/var:/var
Directory /usr/src/deployment doesn't look like an OS root directory
(os-release file is missing). Refusing.

However, if I feed it an image rather than a directory, it works:

# virt-make-fs --format=raw deployment deployment.raw
# systemd-nspawn --boot \
    --image $(pwd)/deployment.raw \
    --pivot-root=/ostree/deploy/$os/deploy/$checksum.0:/sysroot \
    --bind=+/sysroot/ostree/deploy/$os/var:/varSpawning container
deployment on
Spawning container deployment on ...
Works great!

Is it the expected behavior, or should I file a bug to systemd-nspawn?

And, to be a bit more general, what's the guidelines to test a
deployment locally? Looking at containers, systemd-nspawn seems to be
the way to go, it's a one-liner (almost). Looking at virtual machines
however, I struggled a lot with QEmu, but didn't come up with a
straightforward solution to create a bootable image out of my deployment
directory. Not yet. But maybe I just need to learn my qemu-fu better ;)

Thanks,

  Arnaud

----

[1]:
https://www.freedesktop.org/software/systemd/man/systemd-nspawn.html#id-1.7.9
[2]: https://mail.gnome.org/archives/ostree-list/2017-February/msg00009.html


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]