[lxc-devel] lxc systemd unit file

Dwight Engen dwight.engen at oracle.com
Thu Jan 9 16:28:48 UTC 2014


On Thu, 02 Jan 2014 14:11:34 -0500
"Michael H. Warfield" <mhw at WittsEnd.com> wrote:

> Dwight,
> 
> On Tue, 2013-12-31 at 16:31 -0500, Dwight Engen wrote: 
> > Hi Mike,
> 
> > When looking through the sytemd unit file you made with commit
> > 87ff951e as I was doing the sysv init script, I was a bit confused
> > since there is no lxc-startup in libexec nor in the sources, at
> > least not that I could find :) Maybe that was a shell script that
> > didn't get added? Or the following patch might work as well:
> 
> That was actually "with malice aforethought" and included some
> discussion with Serge.  He was concerned that it might conflict with
> what Stéphane was doing with the autoboot stuff.  At the time, I told
> him I was deliberately leaving out that particular shim (even though I
> had one for myself, which I posted) in order to avoid conflicting with
> Stéphane.  Then, when his work was ready, we could glue it together,
> either by changing the unit file or by providing an appropriate shim
> script.  They were good with that.

Ahh, got it. Thanks for deconfusing me, looks like it was a matter of
timing after re-reading the previous threads. I was just a bit
surprised when on my Fedora test box systemd was failing the service
after systemctl enable lxc.

FWIW doing just the below didn't work out so great for containers
that rely on libvirtd to create virbr0 before they try to start and
adding After=libvirtd.service didn't seem to solve that either
(probably because libvirtd returns to systemd before its created the
interface). Pointing ExecStart/ExecStop at the lxc.sysvinit script did
work since it has logic to wait for virbr0 before calling lxc-autostart.

> > diff --git a/src/lxc/lxc.service b/src/lxc/lxc.service
> > index aa20b91..722364d 100644
> > --- a/src/lxc/lxc.service
> > +++ b/src/lxc/lxc.service
> > @@ -6,8 +6,8 @@ After=syslog.target
> >  Type=oneshot
> >  RemainAfterExit=yes
> >  ExecStartPre=/usr/libexec/lxc/lxc-devsetup
> > -ExecStart=/usr/libexec/lxc/lxc-startup start
> > -ExecStop=/usr/libexec/lxc/lxc-startup stop
> > +ExecStart=/usr/bin/lxc-autostart
> > +ExecStop=/usr/bin/lxc-autostart -s
> >  # Environment=BOOTUP=serial
> >  # Environment=CONSOLETYPE=serial
> >  StandardOutput=syslog
> 
> Regards,
> Mike



More information about the lxc-devel mailing list