View previous topic :: View next topic |
Author |
Message |
DaggyStyle Watchman
Joined: 22 Mar 2006 Posts: 5929
|
Posted: Sat Mar 02, 2024 6:41 pm Post subject: which service mounts all the partitions? |
|
|
Greetings.
what service mounts all the entries in /etc/fstab? I want to add a service that will be called right after all the mounts are done and before all the rest of the calls _________________ Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54578 Location: 56N 3W
|
Posted: Sat Mar 02, 2024 6:58 pm Post subject: |
|
|
DaggyStyle,
On openrc, its localmount. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3703 Location: Rasi, Finland
|
Posted: Sat Mar 02, 2024 8:20 pm Post subject: |
|
|
I think there is a way to have localmount pull another service after it has started.
I just couldn't find any openrc man page describing it.
Anyways, if there's a such way then one needs to edit /etc/conf.d/localmount and add something like rc_need_post=<another service> there.
I bet it's described somewhere in rc.conf man page... _________________ ..: Zucca :..
My gentoo installs: | init=/sbin/openrc-init
-systemd -logind -elogind seatd |
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3432
|
Posted: Sat Mar 02, 2024 10:35 pm Post subject: |
|
|
Openrc has keywords "use" and "need" for services that _should_ be started before itself, and "before" and "after" for reordering services that are already scheduled to be started.
I don't know the details, of before and after; didn't find them particularly useful, but they might be a good choice for you.
You service almost certainly must "need" localmount, and probably "before" the other services. I don't know if you must enumerate them all or can you use * wildcard. Test it out and let us know how it went
Quote: | if there's a such way then one needs to edit /etc/conf.d/localmount and add something like rc_need_post=<another service> there. | Yeah, I don't think it's possible; it would be both dumb on principle AND difficult to implement.
Perhaps one could take advantage of "iprovide". Too bad, localmount doesn't have alternative names, so going this way is way too hackish for comfort, but one could try replacing localmount with a custom service providing localmount which would in turn depend on the original localmount renamed to something else. Really ugly, and looks high-maintenance, but sometimes you gotta do what you gotta do.
Hopefully before/after will be enough to order things in a sensible way. If you can make it work this way, it is likely going to be much easier on you in the future. _________________ Make Computing Fun Again |
|
Back to top |
|
|
Anon-E-moose Watchman
Joined: 23 May 2008 Posts: 6148 Location: Dallas area
|
Posted: Sat Mar 02, 2024 11:02 pm Post subject: |
|
|
Code: | $ head -12 /etc/init.d/bootmisc
...
{
need localmount
before logger
after clock root sysctl
keyword -prefix -timeout
} |
Not sure what keyword does, but the rest should be more or less evident. _________________ UM780, 6.1 zen kernel, gcc 13, profile 17.0 (custom bare multilib), openrc, wayland |
|
Back to top |
|
|
DaggyStyle Watchman
Joined: 22 Mar 2006 Posts: 5929
|
Posted: Sun Mar 03, 2024 7:51 am Post subject: |
|
|
thanks, found it.
followup question, is there a way to define in the openrc service file that the flow will be localmount => new service => rest of the boot without changing the rest of the service files manually? _________________ Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein |
|
Back to top |
|
|
GDH-gentoo Veteran
Joined: 20 Jul 2019 Posts: 1699 Location: South America
|
Posted: Sun Mar 03, 2024 2:15 pm Post subject: |
|
|
DaggyStyle wrote: | followup question, is there a way to define in the openrc service file that the flow will be localmount => new service => rest of the boot without changing the rest of the service files manually? |
What szatox said:
szatox wrote: | You service almost certainly must "need" localmount, and probably "before" the other services. I don't know if you must enumerate them all or can you use * wildcard. |
You'll have to enumerate them. That would be only services from the boot runlevel that are known to start after localmount, since your service would be in that runlevel, and those from other runlevels will already start after the ones in boot without any special configuration.
I'm not convinced that starting before every other service is really needed. This sounds like an XY problem. _________________
NeddySeagoon wrote: | I'm not a witch, I'm a retired electronics engineer |
Ionen wrote: | As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though |
|
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3432
|
Posted: Sun Mar 03, 2024 3:17 pm Post subject: |
|
|
There is one more thing that came to my mind, and I think it's actually the solution DaggyStyle wanted:
I found some hooks in openrc. One of them is start_post.
Just define function like
Code: | start_post() {
<function body>
} |
in /etc/conf.d/localmount and let it handle whatever you need right after mounting filesystems. Do this instead of adding your own service, so you won't have to deal with the mess of having your dependencies backwards.
This comes with the obvious downside that you can't control your custom service afterwards, but given your initial requirements I'd probably still take it over the alternatives. _________________ Make Computing Fun Again |
|
Back to top |
|
|
|