Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 540076 - app-emulation/lxc-1.1.0 - systemd script continuously restarts guest system - systemd[1]: lxc@vser1.service holdoff time over, scheduling restart.
Summary: app-emulation/lxc-1.1.0 - systemd script continuously restarts guest system -...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Diego Elio Pettenò (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-14 16:43 UTC by Joachim Herb
Modified: 2015-02-17 15:15 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joachim Herb 2015-02-14 16:43:08 UTC
The systemd start script of lxc-1.1.0 results in continuous reboots of the guest system with this log message:

Feb 14 17:15:28 host systemd[1]: lxc@vser1.service holdoff time over, scheduling restart.

The problem seems to be the starting with lxc 1.1.0 the guest system is started in daemon mode per default: https://linuxcontainers.org/lxc/news/
lxc-start: containers now start daemonized by default 

The following start script (in /usr/lib/systemd/system/lxc@.service) seems to work:
[Unit]
Description=Linux Container %I
After=network.target

[Service]
Restart=always
Type=simple
ExecStartPre=/usr/libexec/lxc/lxc-devsetup
ExecStart=/usr/sbin/lxc-start -n %i -F
ExecReload=/usr/sbin/lxc-restart -n %i
ExecStop=/usr/sbin/lxc-stop -n %i

[Install]
WantedBy=multi-user.target

Also I had to set the kernel option (on the host system):
MAGIC_SYSRQ

This should be fixed in upstream by this bug report/fix:
https://github.com/lxc/lxc/issues/425
Comment 1 Markos Chandras (RETIRED) gentoo-dev 2015-02-15 09:31:59 UTC
Hi

I think Type=simple is not needed according to

http://www.freedesktop.org/software/systemd/man/systemd.service.html

Can you test your unit file after you remove that line? Thanks
Comment 2 Markos Chandras (RETIRED) gentoo-dev 2015-02-15 09:40:43 UTC
Upstream also uses "Delegate=yes" which I think we should do as well.
Comment 3 Joachim Herb 2015-02-15 15:22:04 UTC
You are right, Type=simple seems not necessary. But the option -F for starting in non-daemon mode.
Comment 4 Markos Chandras (RETIRED) gentoo-dev 2015-02-15 15:38:58 UTC
I committed the following fix in the 1.1.0-r1 ebuild

Thanks

--- files/lxc_at.service	2014-04-19 20:14:23.000000000 +0300
+++ files/lxc_at.service.2	2015-02-15 11:40:59.585572995 +0200
@@ -4,9 +4,11 @@
 
 [Service]
 Restart=always
-ExecStart=/usr/sbin/lxc-start -n %i
+ExecStartPre=/usr/libexec/lxc/lxc-devsetup
+ExecStart=/usr/sbin/lxc-start -n %i -F
 ExecReload=/usr/sbin/lxc-restart -n %i
 ExecStop=/usr/sbin/lxc-stop -n %i
+Delegate=yes
 
 [Install]
 WantedBy=multi-user.target


+*lxc-1.1.0-r1 (15 Feb 2015)
+
+  15 Feb 2015; Markos Chandras <hwoarang@gentoo.org> +files/lxc_at.service.2,
+  +lxc-1.1.0-r1.ebuild:
+  Since 1.1.0, guests are started in daemon mode so adapt the systemd service
+  file. Also add missing Delegate=yes to facilitate systemd containers. Bug
+  #540076 by Joachim Herb
+
Comment 5 Joachim Herb 2015-02-17 00:29:29 UTC
It looks like the new file lxc_at.service.2 is not used in the ebuild of 1.1.0-r1 so old (and wrong) file is installed to /usr/lib/systemd/system/lxc@.service:

        # lxc-devsetup script
        exeinto /usr/libexec/${PN}
        doexe config/init/systemd/${PN}-devsetup
        # Remember to compare our systemd unit file with the upstream one
        # config/init/systemd/lxc.service.in
        systemd_newunit "${FILESDIR}"/${PN}_at.service "lxc@.service"

The last line should read:
        systemd_newunit "${FILESDIR}"/${PN}_at.service.2 "lxc@.service"
Comment 6 Markos Chandras (RETIRED) gentoo-dev 2015-02-17 15:15:34 UTC
oops

+*lxc-1.1.0-r2 (17 Feb 2015)
+
+  17 Feb 2015; Markos Chandras <hwoarang@gentoo.org> +lxc-1.1.0-r2.ebuild,
+  -lxc-1.1.0-r1.ebuild, -lxc-1.1.0.ebuild:
+  Revbump to use correct systemd file. Bug #540076. Drop old
+