Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Launch on Boot (Asus Merlin) #327

Open
davidjirovec opened this issue Mar 11, 2025 · 13 comments
Open

Launch on Boot (Asus Merlin) #327

davidjirovec opened this issue Mar 11, 2025 · 13 comments
Labels
bug Something isn't working

Comments

@davidjirovec
Copy link
Contributor

cake-autorate works fine when run manually by calling cake-autorate.sh

When I want to make it launch on boot on Asus Merlin 3006.102.3 on RT-BE88U, it never starts and nothing appears in log.

Following the instructions here https://github.com/lynxthecat/cake-autorate/blob/master/INSTALLATION.md#launch-on-boot-asus-merlin results in

admin@RT-BE88U-2728:/jffs/scripts# ll
drwxrwxrwx    2 admin    root           664 Feb 27 09:03 cake-autorate/
-rwxr-xr-x    1 admin    root           104 Mar 11 15:38 post-mount*
-rwxr-xr-x    1 admin    root            61 Mar 11 15:38 qos-start*
-rwxr-xr-x    1 admin    root            59 Feb 27 08:52 services-stop*

admin@RT-BE88U-2728:/jffs/scripts# cat qos-start
#!/bin/sh
/jffs/scripts/cake-autorate/launcher.sh

I tried also adding to post-mount, did not help.

Following the instruction https://github.com/RMerl/asuswrt-merlin.ng/wiki/User-scripts#troubleshooting-scripts I tried wrapping the luncher call with touch temp files.

admin@RT-BE88U-2728:/jffs/scripts# cat qos-start
#!/bin/sh
touch /tmp/000wanstarted
/jffs/scripts/cake-autorate/launcher.sh
touch /tmp/001wanstarted

Both tmp files are created, but cake-autorate is not running. What is wrong?

@lynxthecat
Copy link
Owner

lynxthecat commented Mar 12, 2025

Does cake-autorate run when the launcher script is manually run?

@davidjirovec
Copy link
Contributor Author

Yes it does

@lynxthecat
Copy link
Owner

lynxthecat commented Mar 12, 2025

Should be easy to fix but this is Asus Merlin specific. Perhaps it is a path or permissions issue. @dave14305?

@dave14305
Copy link

Entware isn’t in the path yet when the system boots, so custom scripts executed by init (pid 1) prefer the built-in paths first. Try adding source /etc/profile to the beginning of the qos-start script to see if that helps.

@davidjirovec
Copy link
Contributor Author

admin@RT-BE88U-2728:/jffs/scripts# cat qos-start
#!/bin/sh
source /etc/profile
/jffs/scripts/cake-autorate/launcher.sh

But autorate is still not running after reboot.

@lynxthecat
Copy link
Owner

lynxthecat commented Mar 14, 2025

@RMerl or @LiveWire1968 any chance you could advise here?

https://github.com/RMerl/asuswrt-merlin/blob/263449f32bf292fb6bc5a08cd645e61a7fb10485/release/src/router/rc/qos.c#L847

Namely, according to @davidjirovec, manually launching:

/jffs/scripts/cake-autorate/launcher.sh

works, but the following qos-start script:

admin@RT-BE88U-2728:/jffs/scripts# cat qos-start
#!/bin/sh
source /etc/profile
/jffs/scripts/cake-autorate/launcher.sh

does not operate on boot (even though the qos-start script is itself executed as confirmed by touching files as suggested in the documentation).

@lynxthecat lynxthecat added the bug Something isn't working label Mar 14, 2025
@dave14305
Copy link

But autorate is still not running after reboot.

Does it run after running service restart_qos

Maybe the USB with Bash isn’t mounted yet when QoS starts on boot?

@lynxthecat
Copy link
Owner

lynxthecat commented Mar 14, 2025

Ah good point @dave14305.

I see that in his fork before we explicitly added support for Asus Merlin, @LiveWire1968 instead used:

echo /jffs/scripts/launcher.sh >> /jffs/scripts/post-mount

https://github.com/LiveWire1968/Asus-cake-autorate

@davidjirovec
Copy link
Contributor Author

davidjirovec commented Mar 15, 2025

service restart_qos helps. Putting launcher into post-mount helps if combined with source /etc/profile, otherwise no start on boot.

admin@RT-BE88U-2728:/jffs/scripts# cat post-mount
#!/bin/sh
. /jffs/addons/amtm/mount-entware.mod # Added by amtm

source /etc/profile
/jffs/scripts/cake-autorate/launcher.sh

And now it starts on boot!

@LiveWire1968
Copy link

@lynxthecat For some reason my response didnt go through apparently the other day. It was a issue with
entware not being mounted yet, so I put it in post-mount.

@lynxthecat
Copy link
Owner

Glad we got to the bottom of this. The README will need to be updated. Nice work all.

@davidjirovec how does it run for you on Asus Merlin?

@davidjirovec
Copy link
Contributor Author

Seems to be running fine, but I have a few questions.

Typical result of buffer bloat test https://www.waveform.com/tools/bufferbloat?test-id=c2666ba8-bfac-46ca-ae01-ed827551ed88

My config

min_dl_shaper_rate_kbps=32000  # minimum bandwidth for download (Kbit/s)
base_dl_shaper_rate_kbps=128000 # steady state bandwidth for download (Kbit/s)
max_dl_shaper_rate_kbps=512000  # maximum bandwidth for download (Kbit/s)

min_ul_shaper_rate_kbps=32000  # minimum bandwidth for upload (Kbit/s)
base_ul_shaper_rate_kbps=100000 # steady state bandwidth for upload (KBit/s)
max_ul_shaper_rate_kbps=512000  # maximum bandwidth for upload (Kbit/s)

connection_active_thr_kbps=12800  # threshold in Kbit/s below which dl/ul is considered idle

Upload active always causes higher latency than download active, is this normal? Can I do something for download and upload link load to have similar impact on latency?

Also can I do something to get even better grade than B? When I've set cake manually to low bandwidth, something like 100/100 I got something like A+ grade.

When I change the autorate configuration, is there a nice way to reload it? Since it is started by the post-mount script, only idea I have would be something like to kill the autorate processes and start the launcher again manually. Too complicated so I reboot the router instead.

@Safwankhan2024
Copy link

Safwankhan2024 commented Mar 31, 2025

admin@RT-BE88U-2728:/jffs/scripts# cat post-mount
#!/bin/sh
. /jffs/addons/amtm/mount-entware.mod # Added by amtm

source /etc/profile
/jffs/scripts/cake-autorate/launcher.sh

i added these lines by editing the post-mount with nano:

source /etc/profile
/jffs/scripts/cake-autorate/launcher.sh

and it works great at boot. thanks for this. if for any reason the script stops on its own, then how to check that it has exited and then how to automate its start?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants