Discussion:
Proper way to execute zfs jail at jail startup
(too old to reply)
joris dedieu
2017-05-03 14:05:38 UTC
Permalink
Raw Message
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
James Gritton
2017-05-04 13:04:20 UTC
Permalink
Raw Message
Post by 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 ?
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

Loading...