Page MenuHomeFreeBSD

Add support to rc scripts to do a fastboot / delayed service startup
Needs ReviewPublic

Authored by kmoore on Mar 20 2015, 4:11 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 26, 8:59 PM
Unknown Object (File)
Fri, Apr 26, 8:59 PM
Unknown Object (File)
Fri, Apr 26, 8:59 PM
Unknown Object (File)
Fri, Apr 26, 8:59 PM
Unknown Object (File)
Fri, Apr 26, 8:59 PM
Unknown Object (File)
Fri, Apr 26, 5:09 PM
Unknown Object (File)
Wed, Apr 24, 2:16 PM
Unknown Object (File)
Mon, Apr 22, 9:57 AM
Subscribers
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

This patch adds support for the following knobs to rc.conf

fastboot_enable="" - Default NO
fastboot_delay="" - Default 10
fastboot_rc_delay="" - Default "/etc/rc.d/sshd /etc/rc.d/jail /etc/rc.d/iscsictl /etc/rc.d/ftpd /etc/rc.d/bluetooth" <- this may change with community feedback
fastboot_rc_early="" Default <Empty>

When enabled, these changes do the following:

  1. Skips services listed in $fastboot_rc_delay and ${LOCALBASE}/etc/rc.d at bootup
  2. Runs the services as a background task after reaching the login prompt, delayed by the $fastboot_delay seconds

During a fastboot, the network is NOT fully enabled unless explicitly needed by a service, such as rc.d/mountcritremote. This can have significant time-savings, especially in the case of a laptop or other wireless-enabled device. The network is fully started as the first item in the delayed startup script. When using jails, the time-savings can increase quite a bit. Services which are started in "delayed" mode have their output logged to /var/log/rc_delay.log

https://github.com/pcbsd/freebsd/tree/fastboot

Test Plan

We are testing this on PC-BSD right now, should be in the next 11.0 images we roll in April. However to manually try it out, apply the patch and add some entry like the following to your /etc/rc.conf

fastboot_enable="YES"
fastboot_rc_early="/usr/local/etc/rc.d/pcdm /usr/local/etc/rc.d/hald /usr/local/etc/rc.d/dbus"

(pcdm is our graphical login manager, replace with gdm or whatever you use)

Questions, comments, suggestions, all appreciated so we can refine this!

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kmoore updated this revision to Diff 4301.
kmoore retitled this revision from to Add support to rc scripts to do a fastboot / delayed service startup.
kmoore updated this object.
kmoore edited the test plan for this revision. (Show Details)
kmoore edited the test plan for this revision. (Show Details)

Update the diff to include /etc/rc.delay script

bdrewery added inline comments.
etc/defaults/rc.conf
98

Can you add a comment on delay/early on what they are please. Also update rc.conf.5 manpage.

etc/rc
129

I think you can just put the " $fastboot_rc_delay " here. I don't see the need for the extra variable. The lack of spaces on the case threw me off for a sec.

134

The trailing space adds 2 spaces between each element. Not a huge deal but I don't see the need for it.

137

I think you need leading/trailing space in there.

152

I'm not sure on the style elsewhere in this file but the 1-line statement is not required. You could make this 4 lines.

etc/rc.delay
4

What year is it?

55

This is not standard. There is rc_debug and debug() for logging. Throwing a failed network startup off in an obscure log doesn't seem good to me. I think just keep it on the console (removing the >> ${_log} lines)

97

I think you are missing leading/trailing spaces.

I think someone needs to adopt these 2 projects and get something into the tree to achieve parallel RC. It may not meet this exact requirement but it is along the same goal as improving boot time.

https://github.com/buganini/rcexecr
https://github.com/kil/rcorder

Thanks for the feedback bdrewery, cleaned up patch is updated.

Involving rc@ or arch@ or hrs@ is probably a good idea.

Update the patch with rc.conf.5 manpage additions

I am reviewing the patch. I can understand what is desired but I am concerned about that rc.delay in the original patch duplicates code fragments in /etc/rc. Can I have a couple of days to consider a simpler solution?

In D2102#14, @hrs wrote:

I am reviewing the patch. I can understand what is desired but I am concerned about that rc.delay in the original patch duplicates code fragments in /etc/rc. Can I have a couple of days to consider a simpler solution?

Yep, that's fine! Looking forward to what you can come up with, I want to do this right, not sure what the "right" way is.

Any update on this? I would love to get some functionality like this in, but if it isn't possible to do cleanly, then I can close it.

Regarding parallel rc, there's also https://reviews.freebsd.org/D3715. Last time I've tried it worked just fine, apart from script output messages being all messed up due to parallel execution.