I have two operating systems installed on a machine (industrial application legacy software modern hardware, I'd tell you the details but you don't have three weeks and probably don't care). The main one is Devaun Jessie and the chroot is running Siemens Industrial Linux 8 (don't be surprised if you never heard of it, neither has the local Siemens distributor). I have made init link files to get the right programs started in the right runlevels in both. The only issue is there is an administrative program in the chroot that needs to change runlevels. what is the best way to notify the main init that a runlevel change request is needed from the chroot?

  • Possible (unsecure) workaround: your chrooted linux could write the desired runlevel in a file (something like /runlevel) and then your host system could read that file and change runlevel accordingly (cron or monitoring file changes). – CijcoSistems Jun 13 '17 at 23:04

Changing the runlevel with SysVinit is done by sending the order through a named pipe, which was /dev/initctl in older versions and is /run/initctl under jessie.

You can use a bind mount to make the directory containing this named pipe visible in the chroot. To avoid exposing everything else in that directory, make a hard link to the pipe in a directory specially created for this purpose on the same filesystem.

  • I'm think you can actually make a single file bind mount (not that i would need it in this case as /dev is already exposed by a bind mount), but the real question is with the widely divergent versions of init is the named pipe a stable api or do i need to replace the version in the chroot with a statically linked one as there is massive library incompatibility (64 bit modern elf vs 32 bit a.out)? – hildred Jun 15 '17 at 13:12
  • @hildred As long as you're using SysVinit, you're using SysVinit. Other implementations of init don't really have a notion of runlevel, so if you wanted to switch to systemd you'd need to figure out what you mean by “change the runlevel”. – Gilles Jun 15 '17 at 14:28
  • No systemd is involved, I just didn't know if the 'wire protocol' on the socket has changed over time. This would normally not be an issue as in most cases there is just one init binary acting as caller and called, obviously not the case here. – hildred Jun 15 '17 at 14:41
  • smoke tested, no smoke. – hildred Jun 15 '17 at 16:47
  • @hildred What happens when you run telinit 2 from the chroot? Any errors? What does strace telinit 2 suggest? – Gilles Jun 15 '17 at 20:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.