<p dir="ltr"></p>
<p dir="ltr">Sent from my Sony Xperia™ smartphone</p>
<p dir="ltr">---- Serge Hallyn wrote ----</p>
<p dir="ltr">> Quoting Mark Clarkson (<a href="mailto:mark.clarkson@smorg.co.uk">mark.clarkson@smorg.co.uk</a>):<br>
> > Hi,<br>
> > Does anyone know if it possible to start a container from systemd? <br>
> > <br>
> > I'm using an Ubuntu Vivid host. I added a systemd unit:<br>
> > <br>
> > |----------------------------------------<br>
> > [Unit]<br>
> > Description=Linux Container %I<br>
> > After=network.target<br>
> > <br>
> > [Service]<br>
> > Type=simple<br>
> > Restart=always<br>
> > ExecStart=/usr/bin/lxc-start -F -n ubtr1<br>
> > ExecReload=/usr/bin/lxc-restart -F -n %i<br>
> > ExecStop=/usr/bin/lxc-stop -n %i<br>
> > <br>
> > [Install]<br>
> > WantedBy=multi-user.target<br>
> > |---------------------------------------<br>
> <br>
> Hi,<br>
> <br>
> Is there a reason you're not using autostart for this? Does that<br>
> fail also?</p>
<p dir="ltr">Lxc-autostart works fine, but I need systemd because I want to try Fleet and etcd with lxc. I want to have the choice to use docker and/or lxc in simple clusters. This is for a new build env where the architecture might be also used for production if it works well. </p>
<p dir="ltr">> <br>
> I'm not claiming to know whether autostart is properly hooked in right<br>
> now when you're running systemd :) But if it's not we should fix that.</p>
<p dir="ltr">After much head scratching I used lxc-autostart, for a single container, started by systemd - so systemd calls lxc-autostart. That worked! Stopping it in systemd also worked. I had a quick look to see the differences in the code but saw nothing obvious. </p>
<p dir="ltr">I was going to try the daily build to see if lxc-start is 'fixed' in the latest. Is that worth doing? </p>
<p dir="ltr">> <br>
> > '/usr/bin/lxc-start -F -n ubtr1' works fine from the console.<br>
> > <br>
> > 'systemctl start lxc@ubtr1' causes:<br>
> > <br>
> > lxc_start.c: main: 295 Executing '/sbin/init' with no configuration<br>
> > file may crash the host<br>
> > <br>
> > 'lxc-start -F -n ubtr1 -l trace -o debug.out' when started from systemd:<br>
> > <br>
> > lxc-start 1424876366.120 INFO lxc_start_ui -<br>
> > lxc_start.c:main:264 - using rcfile /var/lib/lxc/ ubtr1/config<br>
> > lxc-start 1424876366.120 WARN lxc_log - log.c:lxc_log_init:316<br>
> > - lxc_log_init called with log already initialized<br>
> > lxc-start 1424876366.154 WARN lxc_cgmanager -<br>
> > cgmanager.c:cgm_get:962 - do_cgm_get exited with error<br>
> > lxc-start 1424876366.155 ERROR lxc_start_ui -<br>
> > lxc_start.c:main:295 - Executing '/sbin/init' with no configuration file<br>
> > may crash the host<br>
> > <br>
> > I have also tried disabling apparmor and relaxing directory permissions<br>
> > but still no joy. Someone please help me!<br>
> > <br>
> > Thanks!<br>
> > Mark<br>
> > <br>
> > _______________________________________________<br>
> > lxc-users mailing list<br>
> > <a href="mailto:lxc-users@lists.linuxcontainers.org">lxc-users@lists.linuxcontainers.org</a><br>
> > <a href="http://lists.linuxcontainers.org/listinfo/lxc-users">http://lists.linuxcontainers.org/listinfo/lxc-users</a><br>
> _______________________________________________<br>
> lxc-users mailing list<br>
> <a href="mailto:lxc-users@lists.linuxcontainers.org">lxc-users@lists.linuxcontainers.org</a><br>
> <a href="http://lists.linuxcontainers.org/listinfo/lxc-users">http://lists.linuxcontainers.org/listinfo/lxc-users</a></p>