latenitetech
Regular Contributor
First, my congratulations on the superb implementation of Entware and integration into AsusWRT-Merlin. With just a few hooks at the firmware level, it truly is magic how well it all works together to greatly extend the functionally of an already fine router.
One thing I just can't get my head wrapped around though, why is the call to 'rc.unslung start' placed in services-start rather than in post-mount? Services-start is called long before the entware USB volume is mounted, and so it's forced to just camp out in a loop waiting for the entware filesystem to become available. I've had to extend that wait loop several times because it kept timing out as I was adding more "stuff" to my config.
It finally dawned on me that if I just put the call to 'rc.unslung start' after swapon in post-mount, then it doesn’t matter how long the boot takes, entware will always still start. One-liner change and problem solved.
A couple of other observations:
- with swapon being placed in post-mount, and rc.unslung in services-start, there is a bit of a race condition. I was seeing my entware services started before swap was activated. I'd prefer to get swap in place before I start services that might depend on the swap being there. Moving rc.unslung to after swapon in post-mount addresses that.
- I've recently started doing an automatic fsck on USB drives in pre-mount. Normally it goes by quickly if the drives are clean. But if I accidentally pulled out a USB drive while it's active (yes, I've been known to remove the wrong USB stick), then I want fsck to take the time to clean things back up before it goes back into service. In that case, the delay before the entware volume is mounted can be excessive, long past when the services-start loop times out. But by putting the 'rc.unslung' in post-mount, it doesn't matter how long the fsck takes, I can be assured that's once entware is finally mounted, the router will return to normal with all extra applications started correctly.
Anyway, I've made the change in my rig, and am very happy with it. Just offering it up as perhaps a change to be made to the official entware installation scripts. Or am I missing something?
For completeness, here is my post-mount script. And I've completely eliminated the services-start script.
One thing I just can't get my head wrapped around though, why is the call to 'rc.unslung start' placed in services-start rather than in post-mount? Services-start is called long before the entware USB volume is mounted, and so it's forced to just camp out in a loop waiting for the entware filesystem to become available. I've had to extend that wait loop several times because it kept timing out as I was adding more "stuff" to my config.
It finally dawned on me that if I just put the call to 'rc.unslung start' after swapon in post-mount, then it doesn’t matter how long the boot takes, entware will always still start. One-liner change and problem solved.
A couple of other observations:
- with swapon being placed in post-mount, and rc.unslung in services-start, there is a bit of a race condition. I was seeing my entware services started before swap was activated. I'd prefer to get swap in place before I start services that might depend on the swap being there. Moving rc.unslung to after swapon in post-mount addresses that.
- I've recently started doing an automatic fsck on USB drives in pre-mount. Normally it goes by quickly if the drives are clean. But if I accidentally pulled out a USB drive while it's active (yes, I've been known to remove the wrong USB stick), then I want fsck to take the time to clean things back up before it goes back into service. In that case, the delay before the entware volume is mounted can be excessive, long past when the services-start loop times out. But by putting the 'rc.unslung' in post-mount, it doesn't matter how long the fsck takes, I can be assured that's once entware is finally mounted, the router will return to normal with all extra applications started correctly.
Anyway, I've made the change in my rig, and am very happy with it. Just offering it up as perhaps a change to be made to the official entware installation scripts. Or am I missing something?
For completeness, here is my post-mount script. And I've completely eliminated the services-start script.
Code:
if [ "$1" = "/tmp/mnt/sys" ] ; then
# set up and run Entware
ln -nsf $1/opt /tmp/opt
logger "$0:" "Enabling swap on /opt/swap"
swapon /opt/swap
logger "$0:" "Running Entware services-start ..."
/opt/etc/init.d/rc.unslung start
fi