Each nspawn container that's managed via machinectl is run as an instance of "systemd-nspawn@.service". Add a [Service] ExecStartPre= to the instance you need, using `systemctl edit` or similar.
On Mon, Oct 2, 2023 at 1:37 AM Rob Ert <ertr3...@gmail.com> wrote: > Hello all, > > As I have not been able to find an answer to my question after consulting > man pages and google, I am turning to this mailing list. > > I have a systemd-nspawn os container that I have set to automatically > start with machinectl enable. > I would like to automatically have a bcachefs snapshot created before the > machine is started. As provisions for a hook to script something like this > do not seem to be supported in systemd.nspawn, > I would like to know what and where the best way and place to achieve this > is? > > Please cc me. > > Many thanks, > and all the best, > Rob > -- Mantas Mikulėnas