Proper way to execute zfs jail at jail startup

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Proper way to execute zfs jail at jail startup

Joris Dedieu
Hi guys,
Is there a clean way to execute _zfs jail $jid $dataset_ at jail
startup ? I have tried with an exec.poststart script but it's too late
in start order. I also tried to use a prefixed jid and exec.prestart,
but zfs complains that jail does not exists.

Any idea ? Something I missed ?

Thanks
Joris
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: Proper way to execute zfs jail at jail startup

James Gritton
On 2017-05-03 08:05, joris dedieu wrote:
> Hi guys,
> Is there a clean way to execute _zfs jail $jid $dataset_ at jail
> startup ? I have tried with an exec.poststart script but it's too late
> in start order. I also tried to use a prefixed jid and exec.prestart,
> but zfs complains that jail does not exists.
>
> Any idea ? Something I missed ?

It sounds like what you need is a hook for running host-level commands
after the jail is created but before anything is run from exec.start.  
Unfortunately there is no such parameter - there probably should be.  
There probably also should be a simpler zfs option to jail(8).  But
those are future concerns.

A workaround is to have nothing in exec.start.  exec.poststart would
first run the "zfs jail" command, and then do the exec.start work.  
Something like:

   exec.poststart += "zfs jail $jid $dataset";
   exec.poststart += "jexec $jid sh /etc/rc";

It's not a particularly clean solution, but it should work.

- Jamie
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"