Date: Thu, 04 May 2017 07:04:20 -0600 From: James Gritton <jamie@gritton.org> To: freebsd-jail@freebsd.org Subject: Re: Proper way to execute zfs jail at jail startup Message-ID: <cb6dc1eb8df376a53a51d86f3ab4f7d1@gritton.org> In-Reply-To: <CAPd55qCxjwSkn_wAMtY5GV51ScqFU0NjU8Vn50KOqvzEhVuPPQ@mail.gmail.com> References: <CAPd55qCxjwSkn_wAMtY5GV51ScqFU0NjU8Vn50KOqvzEhVuPPQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?cb6dc1eb8df376a53a51d86f3ab4f7d1>