Bugzilla – Bug 914856
LXC container no't autostart with systemd
Last modified: 2018-04-12 13:59:33 UTC
Created attachment 620947 [details] Config of container LXC container no't autostart with systemd by default. Config of container in attach. Autostart star work after editing systemd unit file (/usr/lib/systemd/system/lxc.service): [Unit] Description=LXC Container Initialization and Autoboot Code After=syslog.target network.target [Service] Type=oneshot RemainAfterExit=yes ExecStartPre=/usr/lib/lxc/lxc-devsetup ####Comment this 2 strings #ExecStart=/usr/lib/lxc/lxc-autostart-helper start #ExecStop=/usr/lib/lxc/lxc-autostart-helper stop ####Add this 2 strings ExecStart=/usr/bin/lxc-autostart -g onboot ExecStop=/usr/bin/lxc-autostart -a -s -t 5 StandardOutput=syslog StandardError=syslog [Install] WantedBy=multi-user.target
It is a bug in the lxc-autostart-helper file, called by the lxc.service: line 109: action $"Starting LXC autoboot containers: " "$bindir"/lxc-autostart $OPTIONS $BOOTGROUPS action is a self-defined function ... it echos "Starting LXC autoboot container..." , but executes nothing: my fix: diff lxc-autostart-helper.old /usr/lib/lxc/lxc-autostart-helper 51c51,53 < echo "$@" --- > echo -n "$1 ..." > shift > "$@" && echo " SUCCESS" || echo " FAILED"
Workaround: edit/create /etc/sysconfig/lxc and add the following: action() { echo -n "$1 ..." shift "$@" && echo " SUCCESS" || echo " FAILED" }
Hi Jiri, would you please help to have a look at this issue? Please feel free to reassign whenever necessary, thank you!
This is a bit old. Does it still happen?
This is still a problem. Tested it with lxc-1.0.6-9.1.x86_64 Test procedure 1. systemctl stop lxc.service 2. Removed workaround from /etc/sysconfig/lxc (see comment #2) 3. systemctl start lxc.service 4. lxc-ls -f reveals no containers have started 5. systemctl stop lxc.service 6. re-added workaround 7. systemctl start lxc.service 8. lxc-ls -f reveals all autostart containers are running.
I'm no longer in charge of lxc. Perhaps Thorsten can help?
This version of openSUSE changed to end-of-life (EOL [1]) status. As such it is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of openSUSE, or consider the bug still valid, please feel free to reopen this bug against that version, or open a new ticket. Thank you for reporting this bug and we are sorry it could not be fixed during the lifetime of the release. [1] https://en.opensuse.org/Lifetime