Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Make other services wait until dm-crypt finishes?
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
qsmodo
n00b
n00b


Joined: 20 Jun 2021
Posts: 49

PostPosted: Thu Jan 13, 2022 9:52 pm    Post subject: [Solved] Make other services wait until dm-crypt finishes? Reply with quote

My home partition is encrypted. Dm-crypt asks for the key during boot. If I don't provide it in 60 s (which usually happens when I leave the computer after turning it on), other services (e.g. mtab, localmount) kick in regardless. Then when I'm back I supply the passphrase and have to manually run

Code:
mount /dev/mapper/encryptedhome /home


then exit the shell and log back in so that it can correctly source bashrc etc.

How can I tell all those other services that depend on dmcrypt to wait until it's finished before kicking in? I'm on OpenRC.

Just note I have already read /etc/init.d/dm-crypt and the timeouts therein only apply to dm-crypt itself, not to services that depend on it.

Thanks for any help.


Last edited by qsmodo on Fri Jan 14, 2022 5:55 pm; edited 1 time in total
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 2172

PostPosted: Thu Jan 13, 2022 10:18 pm    Post subject: Reply with quote

From /etc/rc.conf
Code:

# It's possible to define extra dependencies for services like so
#rc_config="/etc/foo"
#rc_need="openvpn"
#rc_use="net.eth0"
#rc_after="clock"
#rc_before="local"
#rc_provide="!net"

# You can also enable the above commands here for each service. Below is an
# example for service foo.
#rc_foo_config="/etc/foo"
#rc_foo_need="openvpn"
#rc_foo_after="clock"

# Below is an example for service foo-bar. Note that the '-' is illegal
# in a shell variable name, so we convert it to an underscore.
# example for service foo-bar.
#rc_foo_bar_config="/etc/foo-bar"
#rc_foo_bar_need="openvpn"
#rc_foo_bar_after="clock"

But your concept feels a bit off to me or flawed.
Quote:

If I don't provide it in 60 s (which usually happens when I leave the computer after turning it on),

Wouldnt the easiest course be to wait a bit until your boot is complete?
Just a thought...
_________________
:)
Back to top
View user's profile Send private message
qsmodo
n00b
n00b


Joined: 20 Jun 2021
Posts: 49

PostPosted: Fri Jan 14, 2022 4:22 pm    Post subject: Reply with quote

Thanks. I've added
Code:

rc_localmount_config="/etc/init.d/localmount"
rc_localmount_after="dm-crypt"

to /etc/rc.conf but it was none the better: localmount still doesn't wait for dm-crypt to exit and kicks in after 60 s.

Quote:
Wouldnt the easiest course be to wait a bit until your boot is complete?


I don't quite understand the question.
Back to top
View user's profile Send private message
grknight
Developer
Developer


Joined: 20 Feb 2015
Posts: 195

PostPosted: Fri Jan 14, 2022 5:15 pm    Post subject: Reply with quote

In /etc/conf.d/dmcrypt (global options):
Code:
rc_keyword="-timeout"


In /etc/conf.d/localmount:
Code:
rc_need="dmcrypt"


See 'man openrc-run' as to what keyword and need does. Adjust if needed.
Back to top
View user's profile Send private message
qsmodo
n00b
n00b


Joined: 20 Jun 2021
Posts: 49

PostPosted: Fri Jan 14, 2022 5:55 pm    Post subject: Reply with quote

Ah,
Code:
rc_keyword="-timeout"
was exactly what I was after, thank you very much for it and for pointing to the appropriate manual page.
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