Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add finit.config=/etc/custom.conf cmdline (kernel) for different finit.conf file #235

Closed
hongkongkiwi opened this issue Apr 12, 2022 · 14 comments
Milestone

Comments

@hongkongkiwi
Copy link
Contributor

I would like (for testing) to specify a different /etc/finit.conf file. Is it possible to pass a kernel param to specify what config file init uses?

@troglobit
Copy link
Owner

Nope, only at configure time using --with-config=/path/to/file. It's sort of like /etc/inittab in SysV init.

@troglobit
Copy link
Owner

Similar to #224, neat request if finit.config=/path/to/file existed then overrides for tests and similar would be possible.

@troglobit troglobit reopened this Apr 17, 2022
@troglobit troglobit changed the title kernel cmdline different finit.conf file? Add finit.config=kernel cmdline for different finit.conf file Apr 17, 2022
@hongkongkiwi
Copy link
Contributor Author

This would be useful to me, if implemented, perhaps we could hardcode allowed filenames at compile time? That way user cannot arbitrarily specify a filename and then when something is passed finit just checks against kv to see if it was allowed at compile time.

Might help to mitigate any possible security issues? Just a thought today about this.

@troglobit
Copy link
Owner

Good idea, I was a bit concerned about the security aspects as well! Thanks :)

@troglobit troglobit added this to the FUTURE milestone Apr 25, 2022
@hongkongkiwi
Copy link
Contributor Author

hongkongkiwi commented Apr 26, 2022

What about this?

  • RCSD dir is configurable in finit.conf (value in finit.conf overrides any hardcoded setting, if compiled in RCSD dir is blank and no setting set in conf then disable completely).
  • finit.config=/etc/finit.conf is configurable to point to a different .conf file via kernel cmdline arg

This works since finit.conf is read first (right?)

@troglobit
Copy link
Owner

Yes, that would work. (I'm assuming you meant finit.config=/etc/finit.conf, not fstab :)

@hongkongkiwi
Copy link
Contributor Author

Yep! :)

@hongkongkiwi hongkongkiwi changed the title Add finit.config=kernel cmdline for different finit.conf file Add finit.config=/etc/custom.conf cmdline (kernel) for different finit.conf file Apr 26, 2022
@hongkongkiwi

This comment was marked as off-topic.

@troglobit

This comment was marked as off-topic.

@troglobit

This comment was marked as off-topic.

@troglobit

This comment was marked as outdated.

@hongkongkiwi
Copy link
Contributor Author

hongkongkiwi commented May 6, 2022

I wanted to clarify this feature request a bit and narrow it down.

  1. Change rcsd dir to be read from finit.conf something like rcsd_dir=/etc/mydir (otherwise fallback to whatever is configured at compile time, or just fail if nothing configured, similar to how fstab works)
  2. Finit conf can be specified from kernel comdline
    finit.conf=/etc/finit.conf with fallback to compile time value or, finit should drop to rescue shell if no finit.conf passed and no compile time fallback specified.

I think these two changes are very powerful and allow the user to specify completely different sets of scenarios. For example, you might want a factory test mode which you can simply specify that with kernel cmdline finit.conf=/etc/factory_test.conf and a completely specific and special set of behaviour would start.

A similar functionality can be used with runlevels, but your limited to a few scenarios with no way to specifically name each one. Also, there are some hardcoded functionality which cannot be changed with runlevels (e.g. in my above example the rcsd_dir), so being able to specify a different finit.conf (which in turn specifies it's own rcsd_dir) would be extremely powerful.

The above changes (I think) should be backwards compatible, so existing users won't see a difference.

@troglobit
Copy link
Owner

100% agree from me. Thank you for taking the time to pin this down <3

@troglobit troglobit modified the milestones: FUTURE, 4.4 May 8, 2022
@troglobit
Copy link
Owner

There, finally completed! :-)

We now have the following kernel command line option:

-- finit.config=/etc/factory.conf

... and top-level configuration directive (from /etc/factory.conf):

rcsd /etc/factory.d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants