Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
which service mounts all the partitions?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Sat Mar 02, 2024 6:41 pm    Post subject: which service mounts all the partitions? Reply with quote

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
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54248
Location: 56N 3W

PostPosted: Sat Mar 02, 2024 6:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Sat Mar 02, 2024 8:20 pm    Post subject: Reply with quote

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 :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3137

PostPosted: Sat Mar 02, 2024 10:35 pm    Post subject: Reply with quote

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
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6098
Location: Dallas area

PostPosted: Sat Mar 02, 2024 11:02 pm    Post subject: Reply with quote

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.
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5909

PostPosted: Sun Mar 03, 2024 7:51 am    Post subject: Reply with quote

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
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1532
Location: South America

PostPosted: Sun Mar 03, 2024 2:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3137

PostPosted: Sun Mar 03, 2024 3:17 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum