troglobit / finit

Fast init for Linux. Cookies included
https://troglobit.com/projects/finit/
MIT License
634 stars 64 forks source link

Run rc.local and runparts in separate thread #356

Closed troglobit closed 1 year ago

troglobit commented 1 year ago

When Finit calls /etc/rc.local or scripts in ruparts DIR it is still in runlevel S. This currently means the big state machine has not yet been launched and any API calls from these scripts via initctl may block the boot indefinitely.

As a workaround, 5db2fb2 adds support for initctl -f to bypass native service check.

A better approach would be to fork off a child, finalize bootstrap, where these scripts are called. Finit main could then sit in its event loop, processing API calls and waiting for the scripts to finalize (or time out as they do today) before transitioning to runlevel 2.

JackNewman12 commented 1 year ago

Nice! I think this might fix an issue I have seen recently. One of the devices running finit performed all of its networking setup in runparts on boot. However this device has 15 network interfaces and by the time finit regains control the net/ conditions get into an incorrect state having missing interface up/down conditions.

No idea why the socket for monitoring the interface changes doesn't report an error, but over 100 changes are pending and all the extra just go missing.

We resolved it by running the networking setup as a task after the system boots up.

troglobit commented 1 year ago

Yeah this was probably the root cause. I'm working in fixing the same problem also for run statements.