Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: Allow user login and interaction before default runlevel finishes (Read 386 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Allow user login and interaction before default runlevel finishes

(openrc)
Personally, my default runlevel consists of only networking stuff (wpa supplicant and dhcpcd), not necessary to have right after booting up. In addition, my wifi interface takes quite a while to show up, since I am using realtek's 8852be (rtl8852be-dkms-git). To fix this, I edited the the script in /etc/init.d to wait for the interface, which added 4 seconds to my boot time. Is there a way to allow logging in and using the system before the default runlevel tasks are complete, or is there a better way to go around this problem with the interface being slow?

Re: Allow user login and interaction before default runlevel finishes

Reply #1
One way to do it is to turn those services into shell scripts and put them in /etc/local.d, and then putting the entire script in the background like this:
Code: [Select]
#!/bin/sh
{
...
} &

My wifi manager script in /etc/local.d was slowing down my boot process because it was looking for suitable wifi networks to connect to, so I put it in the background like above and then by the time I logged in, it had already connected to a wifi network.

Re: Allow user login and interaction before default runlevel finishes

Reply #2
(edit) I missed the README, the files are supposed to have a .start extension. Thanks for the advice!

Hello Lancia,
Thank you for your idea! By turning services into scripts, do you mean running wpa_supplicant and dhcpcd just as you would on the console? Although I get success messages, it appears to be as though the scripts never ran. On running dhcpcd again, it is "waiting for carrier" as it would when wpa_supplicant wasn't set up. On running the script after logging in, the script works as expected.
/etc/local.d/wifi.sh:
Code: [Select]
#!/bin/sh
{
    count=0
    wifi_if=wlan0
    # wait for wlan0
    while [[ $(ip a | grep $wifi_if | wc -l) == 0 ]] && [ $count -lt 30 ]
    do
        sleep 0.5
        count=$((count+1))
    done
    wpa_supplicant -B -i $wifi_if -c /etc/wpa_supplicant/wpa_supplicant.conf
    dhcpcd -b wlan0
} &> /log.txt &
/log.txt:
Code: [Select]
Successfully initialized wpa_supplicant
dhcpcd-9.4.1 starting
DUID 00:04:32:44:43:35:36:31:52:31:4b:4a:4a:52:36:31:44:35
forked to background, child pid 2312

Re: Allow user login and interaction before default runlevel finishes

Reply #3
>(edit) I missed the README, the files are supposed to have a .start extension. Thanks for the advice!

Yeah sorry I should've mentioned the README file