[lxc-users] Start container from systemd

Serge Hallyn serge.hallyn at ubuntu.com
Mon Mar 2 17:15:01 UTC 2015


Quoting Mark Clarkson (mark.clarkson at smorg.co.uk):
> Hi,
> Does anyone know if it possible to start a container from systemd? 
> 
> I'm using an Ubuntu Vivid host. I added a systemd unit:
> 
> |----------------------------------------
>  [Unit]
>  Description=Linux Container %I
>  After=network.target
> 
>  [Service]
>  Type=simple
>  Restart=always
>  ExecStart=/usr/bin/lxc-start -F -n ubtr1

Could you add "-l trace -o /tmp/lxc.out" to the ExecStart args here and
show us the contents of /tmp/lxc.out?

>  ExecReload=/usr/bin/lxc-restart -F -n %i

You're not going to want lxc-restart here - lxc-restart has to do with
checkpoint/restart.  Not with restarting after a configuration change.

>  ExecStop=/usr/bin/lxc-stop -n %i
> 
>  [Install]
>  WantedBy=multi-user.target
> |---------------------------------------
> 
> '/usr/bin/lxc-start -F -n ubtr1' works fine from the console.
> 
> 'systemctl start lxc at ubtr1' causes:
> 
>  lxc_start.c: main: 295 Executing '/sbin/init' with no configuration
> file may crash the host
> 
> 'lxc-start -F -n ubtr1 -l trace -o debug.out' when started from systemd:
> 
>       lxc-start 1424876366.120 INFO     lxc_start_ui -
> lxc_start.c:main:264 - using rcfile /var/lib/lxc/ ubtr1/config
>       lxc-start 1424876366.120 WARN     lxc_log - log.c:lxc_log_init:316
> - lxc_log_init called with log already initialized
>       lxc-start 1424876366.154 WARN     lxc_cgmanager -
> cgmanager.c:cgm_get:962 - do_cgm_get exited with error
>       lxc-start 1424876366.155 ERROR    lxc_start_ui -
> lxc_start.c:main:295 - Executing '/sbin/init' with no configuration file
> may crash the host
> 
> I have also tried disabling apparmor and relaxing directory permissions
> but still no joy. Someone please help me!
> 
> Thanks!
> Mark
> 
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users


More information about the lxc-users mailing list