Bug 231522 - [12-CURRENT] rc.d should not be in sbin/init
Summary: [12-CURRENT] rc.d should not be in sbin/init
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks: 228911 228920
  Show dependency treegraph
 
Reported: 2018-09-20 17:28 UTC by Conrad Meyer
Modified: 2018-10-17 16:51 UTC (History)
5 users (show)

See Also:


Attachments
shell script to move everything in place and patch and svn actions (4.70 KB, text/plain)
2018-10-15 11:35 UTC, Bjoern A. Zeeb
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Conrad Meyer freebsd_committer 2018-09-20 17:28:41 UTC
Moving it back to etc/rc.d would be fine.  Moving it to a new libexec/rc/rc.d along with the etc/rc program and subroutines would be fine.  Leaving it in sbin/init/rc.d is totally wrong.
Comment 1 Conrad Meyer freebsd_committer 2018-09-20 17:42:16 UTC
-> brd (pkgbase blanket)
Comment 2 Bjoern A. Zeeb freebsd_committer 2018-09-21 00:10:09 UTC
brd and I had a chat about this;  I had it moved out of init to libexec/rc and then ran into issues testing make package on my systems (broken framework in Makefiles) and I have ignored it after that.

My point was that I don't want init to be touched (and it's own package) unless there's an actual need for it.

I had also exchanged an email with kmoore with libexec/rc would work for him so they could have libexec/openrc as a replacement for example and he sounded fine with it.
Comment 3 Conrad Meyer freebsd_committer 2018-09-21 16:09:48 UTC
brd@, I "assigned" it to you initially, as you introduced the regression.  If you are unwilling to fix regressions introduced, that is somewhat concerning.

Regardless of who takes it, it needs fixing.  Reverting r336859,336857,336845 would be an acceptable way of accomplishing this.  Changes from r337382, 338234, and 338238 may need to be reapplied carefully, but for now the impact of the bad move are still limited.
Comment 4 Brad Davis freebsd_committer 2018-09-21 19:11:40 UTC
(In reply to Conrad Meyer from comment #3)
I don't consider this report to be useful, because you disagree with the location but, provide no supporting evidence for your claim, so to quote:

http://www.quickmeme.com/img/b5/b5df2823e61e5d8118226426d109fcfdca9d8102165baccc4c96c1a594385677.jpg

I am happy to support it going somewhere else, but I don't have time to bikeshed it.  Other people have suggested locations and I told them this as well.
Comment 5 Conrad Meyer freebsd_committer 2018-09-21 21:28:48 UTC
Sorry, I didn't realize abundance of evidence was in question.

rc.d scripts have nothing to do with init.

init starts gettys, spawns the *separate* /etc/rc program when told to go to multi-user, stays alive as pid 1, and kills zombies.  That's it.  For evidence of this you can see the init.c source code (it's quite short) or the init(8) manual page (it's also quite short).

For evidence of rc being a separate entity from init(8) you can see the rc(8) manual page or like, look at the /etc/rc source code.

It's fine that you are just unfamiliar with how init and rc works — most people are.  But you should have at least somewhat familiarized yourself with the components before rototilling the directory around.  And you should listen when people who are familiar let you know you've made a mistake, and you should fix it.
Comment 6 Bjoern A. Zeeb freebsd_committer 2018-10-15 11:35:21 UTC
Created attachment 198169 [details]
shell script to move everything in place and patch and svn actions

This is a shell script to be places into a (clean) svn checkout, which will move rc* out of sbin/init and to libexec/rc and do all necessary svnlite operations as well as patching Makefiles.

I cannot fully test make packages (as that by itself is not working due to other issues), and I have not tested that the installed version boots, but the stagework from make packages looked ok.
Comment 7 Bjoern A. Zeeb freebsd_committer 2018-10-15 11:40:02 UTC
(In reply to Bjoern A. Zeeb from comment #6)

If someone can test this the two days and either deal with re@ and commit it yourself or let me know that it all looks good and I'll do the approve/commit dance.

Things to consider:
(a) only touch the init package (follow up commit to make init its own package) when really needed as it is pid 1 and we don't want to update it all with every rc shell script change,
(b) having rc in its own place and package will allow a more easy substitution of the rc framework, such as openrc.

Discussed with: brd, kmoore (bz did)
Submitted by:  bz
Comment 8 commit-hook freebsd_committer 2018-10-17 16:49:50 UTC
A commit references this bug:

Author: bz
Date: Wed Oct 17 16:49:12 UTC 2018
New revision: 339413
URL: https://svnweb.freebsd.org/changeset/base/339413

Log:
  Move the rc framework out of sbin/init into libexec/rc.

  The reasons for this are forward looking to pkgbase:
   * /sbin/init is a special binary; try not to replace it with
     every package update because an rc script was touched.
     (a follow-up commit will make init its own package)
   * having rc in its own place will allow more easy replacement
     of the rc framework with alternatives, such as openrc.

  Discussed with:		brd (during BSDCam), kmoore
  Requested by:		cem, bz
  PR:			231522
  Approved by:		re (gjb)

Changes:
  head/libexec/Makefile
  head/libexec/rc/
  head/libexec/rc/Makefile
  head/libexec/rc/netstart
  head/libexec/rc/network.subr
  head/libexec/rc/pccard_ether
  head/libexec/rc/rc
  head/libexec/rc/rc.conf
  head/libexec/rc/rc.d/
  head/libexec/rc/rc.d/Makefile
  head/libexec/rc/rc.initdiskless
  head/libexec/rc/rc.resume
  head/libexec/rc/rc.shutdown
  head/libexec/rc/rc.subr
  head/libexec/rc/rc.suspend
  head/sbin/init/Makefile
  head/sbin/init/netstart
  head/sbin/init/network.subr
  head/sbin/init/pccard_ether
  head/sbin/init/rc
  head/sbin/init/rc.conf
  head/sbin/init/rc.d/
  head/sbin/init/rc.initdiskless
  head/sbin/init/rc.resume
  head/sbin/init/rc.shutdown
  head/sbin/init/rc.subr
  head/sbin/init/rc.suspend