Summary: | sys-apps/systemd - systemctl (telinit) enters infinite exec recursion in chroot env | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Xiao Lin <xiaoliniess> |
Component: | Current packages | Assignee: | Gentoo systemd Team <systemd> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | AMD64 | ||
OS: | Linux | ||
See Also: |
https://bugs.gentoo.org/show_bug.cgi?id=642784 https://github.com/systemd/systemd/pull/7770 |
||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Xiao Lin
2017-12-30 13:08:26 UTC
After some debugging I found that the problem is systemd related. The /sbin/telinit command is a symbol link to systemctl when systemd installed. When systemctl is run as telinit, if it doesn't find a running systemd, in this case a chroot environment, it just assume there is another init system is running and call telinit for that init system with execv. But this execv actually calls itself again and trigger a dead loop. Here is the related source code from systemctl.c : } else if (strstr(program_invocation_short_name, "init")) { if (sd_booted() > 0) { arg_action = _ACTION_INVALID; return telinit_parse_argv(argc, argv); } else { /* Hmm, so some other init system is * running, we need to forward this * request to it. For now we simply * guess that it is Upstart. */ execv(TELINIT, argv); log_error("Couldn't find an alternative telinit implementation to spawn."); return -EIO; } So the call to telinit should be avoided if in a chroot environment. I don't seem to be able to reproduce this. What version of systemd is installed in the chroot? Can you show me what ls -l /sbin/*init looks like? I can reproduce this with systemd-236. I cannot reproduce with systemd-233. I think the meson build system defines the TELINIT macro differently from how autotools did it. My systemd version is 236-r2. # ls -l /sbin/*init lrwxrwxrwx 1 root root 22 Dec 30 22:55 /sbin/init -> ../lib/systemd/systemd lrwxrwxrwx 1 root root 16 Dec 30 22:55 /sbin/telinit -> ../bin/systemctl The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0a0bc30e66759255f4d84527f09c2ccc00fbe0ca commit 0a0bc30e66759255f4d84527f09c2ccc00fbe0ca Author: Mike Gilbert <floppym@gentoo.org> AuthorDate: 2017-12-31 01:22:17 +0000 Commit: Mike Gilbert <floppym@gentoo.org> CommitDate: 2017-12-31 01:25:36 +0000 sys-apps/systemd: avoid infinite exec recursion in telinit Closes: https://bugs.gentoo.org/642724 Package-Manager: Portage-2.3.19_p3, Repoman-2.3.6_p37 sys-apps/systemd/{systemd-236-r2.ebuild => systemd-236-r3.ebuild} | 2 ++ sys-apps/systemd/systemd-9999.ebuild | 2 ++ 2 files changed, 4 insertions(+) |