Documentation for `/etc/systemd/system-generators/lxc`: migration from LXC and keeping up to date

Hi, I recently started playing with Incus, having used pure LXC before.

I noticed an issue when migrating containers from LXC: systemd-networkd would not work. Digging through this forum, I finally found after a multi-day search that /etc/systemd/system-generators/lxc must be installed from https://github.com/lxc/distrobuilder/blob/main/distrobuilder/lxc.generator into the container. For the current images made with distrobuilder, this is included automatically.

I was not aware of that file. Did I miss this in the docs? If not, shouldn’t it be added to the migration chapters? The generator was not added automatically with either lxc-to-incus or incus-migrate for me. Without that generator, I had (for example) completely undiagnosable network issues that just go away when installing it.

Also, how does one keep this generator up-to-date? I assume that it would be changed in the future if for example new systemd issues pop up?

Pure LXC images consume the same images and so also have the generator script in place. I guess your containers were either not created using the lxc-download template or were very very old to predate the generator being a thing.

Currently updates of the generator are done manually as it’s not something that’s really packaged and could be easily updated through normal container updates.

We could in theory use some tricks to expose the latest version of it as a bind-mounted file from Incus, but it’s always hard to do that safely as we don’t know what a given container filesystem may look like.

OK, my images were indeed either old (but kept up-to-date) or potentially created in some ad-hoc way that I don’t remember. Makes sense that bind mounting the file into the container is dangerous and would also be surprising to the admin. Absent distro packages, I guess we need to keep this up-to-date manually.

Nevertheless, the incus-migrate documentation at “https://linuxcontainers.org/incus/docs/main/howto/import_machines_to_instances/” at least strongly implies that one can import any existing disk/image/root fs to a container. Even those that were not created with the templates.

Do you think it therefore makes sense to add a note to that page? Or another? If yes, I could probably propose a documentation pull request at some point in the near future.

Yeah, would definitely make sense to add a note to the page.