Bug 727770

Summary: sysvinit: kexec says "Failed to talk to init daemon."
Product: [openSUSE] openSUSE 12.1 Reporter: Jiri Slaby <jslaby>
Component: BasesystemAssignee: Frederic Crozat <fcrozat>
Status: RESOLVED WONTFIX QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: coolo, fcrozat, forgotten_sxozS5NPY1, ptesarik, ro, tonyj, werner
Version: Factory   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Jiri Slaby 2011-11-02 12:52:21 UTC
I booted with sysvinit to check if there is a bug in systemd (there is). But I cannot boot back to systemd boot with kexec:

# kexec /boot/vmlinuz --initrd=/boot/initrd --command-line='root=UUID=dceb6665-da77-45bd-9744-06dfaa3811ea 3 console=tty0 console=ttyS0,115200'
Failed to talk to init daemon.
Comment 1 Jiri Slaby 2011-11-02 12:53:14 UTC
What is worse:
# reboot 
Failed to talk to init daemon.
# shutdown -r now
Failed to talk to init daemon.
Comment 2 Dr. Werner Fink 2011-11-02 13:07:07 UTC
IMHO the pipe /dev/initctl is missed or telinit does not belong to sysvinit... as SysV init does create the pipe at start someone has removed or there is
a shadow mount:

  /suse/werner> sudo fuser /dev/initctl
  /dev/initctl:            1
  /suse/werner> sudo ls -l /proc/1/fd/
  total 0
  lrwx------ 1 root root 64 Nov  2 14:02 10 -> /dev/initctl

or telinit is not telinit from SysV init:

  /suse/werner> bash -c 'type -p telinit'
  /sbin/telinit
  /suse/werner> rpm -qf /sbin/telinit
  systemd-sysvinit-37-6.1.x86_64
Comment 3 Jiri Slaby 2011-11-02 13:14:38 UTC
# reboot 
Failed to talk to init daemon.
# ll /sbin/telinit /dev/initctl  /proc/1/fd/
prw------- 1 root root  0 Nov  2 14:12 /dev/initctl
lrwxrwxrwx 1 root root 14 Oct 31 23:50 /sbin/telinit -> /bin/systemctl

/proc/1/fd/:
total 0
lrwx------ 1 root root 64 Nov  2 14:13 10 -> /dev/initctl
# rpm -qf /sbin/telinit
systemd-sysvinit-37-6.1.x86_64
# type -p telinit
/sbin/telinit
# fuser /dev/initctl
/dev/initctl:            1
Comment 4 Jiri Slaby 2011-11-02 13:17:33 UTC
Note that reboot works unless I run kexec previously.

"init 6" works always.
Comment 5 Dr. Werner Fink 2011-11-02 13:36:53 UTC
No idea if /sbin/telinit linked to  /bin/systemctl works even if SysV init
is running.
Comment 6 Frederic Crozat 2011-11-02 13:49:04 UTC
no, it won't work.
Comment 7 Andreas Jaeger 2011-11-02 14:46:47 UTC
Werner, Frederic: I'm lost with this bug report. Who shall look into it?
Comment 8 Frederic Crozat 2011-11-02 14:56:59 UTC
I'd say trying to use systemd-sysvinit symlinks when running under sysvinit isn't supported).

the reverse if possible, fortunately..
Comment 9 Andreas Jaeger 2011-11-02 18:59:12 UTC
So, let's close as WONTFIX.
Comment 10 Jiri Slaby 2011-11-02 19:01:44 UTC
(In reply to comment #9)
> So, let's close as WONTFIX.

Why? I use standard tools. I don't do anything unsupported. The unsupported thing is done by kexec proper.
Comment 11 Andreas Jaeger 2011-11-02 19:05:11 UTC
See comment #8 - and remove systemd-sysvinit.
Comment 12 Dr. Werner Fink 2011-11-03 08:19:21 UTC
Suggestion: Add for both systemd and SysVinit a generator which corrects
the telinit syslink.  For systemd this could be done in a small scriplet
below /lib/systemd/system/system-generators/ and for SysVinit with a further
boot script which depend on boot.localfs
Comment 13 Jiri Slaby 2011-11-03 09:24:09 UTC
Reopen to consider comment #12.
Comment 14 Frederic Crozat 2011-11-04 09:22:10 UTC
please, do not abuse generators to do this kind of ugly hacks.

systemctl tools are not designed to run under sysvinit.

running sysvinit when default tools are systemd's is just a way to debug things. If people want to stick to sysvinit, they should install sysinit-sysvinit.

Or we remove symlinks for the various tools except /sbin/init for now, in the -sysvinit/-sysinit packages.
Comment 15 Dr. Werner Fink 2011-11-04 09:40:12 UTC
Hmmm ... then things like init=/sbin/sysvinit becomes useless as it is not possible to switch between systemd and SysVinit without install/deinstalling
packages.  Do we really want this?

On the other way we may use initrd after mounting the rootfs to reset the
symbolic links depending on the value of the kernel paramter ``init=''
Comment 16 Stephan Kulow 2011-11-07 14:02:48 UTC
systemd will use /lib/sysvinit/telinit if it's not running under systemd. I will try to reproduce.

If this is kexec specific I would go for WONTFIX.
Comment 17 Stephan Kulow 2011-11-07 14:06:16 UTC
I can reboot fine after booting with init=/sbin/sysvinit

So this seems to be specific to kexec
Comment 18 Tony Jones 2011-11-16 08:25:24 UTC
This looks like a systemd issue to me,  specifically the processing that is going on for the kexec case inside systemctl.c after it calls util.c::kexec_loaded

Also, the problem only occurs with kexec (no arguments) which invokes /sbin/shutdown (link to /bin/systemctl).  As a temp workaround kexec -l/-e works fine.

Comparing strace output of /sbin/reboot after kexec has failed (shutdown case) with successful /sbin/reboot shows an open of "/sys/kernel/kexec_loaded" and then identical until the successful trace shows "access("/var/run/utmpx", F_OK)" and the unsuccessful "writev(2, [{"Failed to talk to init daemon.", 30}, {"\n", 1}], 2) = 31" (from systemctl.c line 5095).

Anyways, perhaps the following will be more helpful:

# cat /proc/cmdline 
root=/dev/disk/by-id/ata-GB0500EAFYL_WCASYE758986-part3 resume=/dev/disk/by-id/ata-GB0500EAFYL_WCASYE758986-part1 splash=silent console=ttyS0,115200 quiet showopts init=/sbin/sysvinit
# cat /sys/kernel/kexec_loaded 
0
# crash -s
crash> print kexec_image
$6 = (struct kimage *) 0x0
crash> wr kexec_image 0xffffffff
crash> q
# cat /sys/kernel/kexec_loaded 
1
# /sbin/reboot 
Failed to talk to init daemon.
# cat /sys/kernel/kexec_loaded 
1
# crash -s
crash> print kexec_image
$6 = (struct kimage *) 0xffffffff
crash> wr kexec_image 0
crash> q
# cat /sys/kernel/kexec_loaded 
0
# /sbin/reboot 

Broadcast message from tonyj@svr2 on pts/0 (Wed, 16 Nov 2011 00:22:55 -0800):

The system is going down for reboot NOW!
Comment 19 Tony Jones 2011-11-16 09:34:45 UTC
Needinfo to systemd maintainer.
Comment 20 Frederic Crozat 2011-11-17 15:08:05 UTC
again, as I said, running with systemd-sysvinit installed but under sysvinit is not a supported setup. Not sure what I can add to this bug report. If people absolutely want to be able to switch between both environments, they should install sysvinit-init and use init=/bin/systemd when they plan to use systemd.
Comment 21 Tony Jones 2011-11-17 16:24:52 UTC
Reassigned back to systemd maintainer. It's not a kexec tools issue.  If the systemd maintainer wants to close it, that's cool.
Comment 22 Frederic Crozat 2013-03-11 15:18:02 UTC
closing, as explained in comment 20