How to keep luci-app-sqm started and enabled when rebooting the router?

Guys, can I configure luci-app-sqm to start and enable whenever I reboot or reconnect the router? It is being a nuisance this, every time I turn off or restart the router I need to manually start and enable sqm for it to work. Thanks if you guys can explain how to configure luci-app-sqm to start automatically every time.

This is odd, it actually should do this automatically.

Could you please post the output of:

  1. cat /etc/config/sqm

  2. tc -s qdisc (with sqm known active)

  3. tc -s qdisc (just after a reboot with it being potentially not active)

  4. the output of:
    SQM_DEBUG=1 SQM_VERBOSITY_MAX=10 /etc/init.d/sqm stop ; SQM_DEBUG=1 SQM_VERBOSITY_MAX=10 /etc/init.d/sqm start

which can be found under /var/run/sqm/${IFACE}.debug.log with ${IFACE} depending on what you selected as interface.

That file might be a tad large..

Best Regards

Have hot tried recreation of the startup symlink?
/etc/init.d/sqm disable
/etc/init.d/sqm enable

1 Like

Here are the results, except the /var/run/sqm/${IFACE}.debug.log, because I did not find this:

cat /etc/config/sqm

Summary

config queue 'eth1'
option qdisc_advanced '0'
option enabled '1'
option interface 'wlan0'
option download '1024'
option upload '4096'
option debug_logging '0'
option verbosity '5'
option qdisc 'cake'
option script 'layer_cake.qos'
option linklayer 'ethernet'
option overhead '8'

tc -s qdisc (sqm active)

Summary

qdisc noqueue 0: dev lo root refcnt 2
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
qdisc fq_codel 0: dev eth0 root refcnt 2 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms ecn
Sent 489143 bytes 1406 pkt (dropped 0, overlimits 0 requeues 2)
backlog 0b 0p requeues 2
maxpacket 420 drop_overlimit 0 new_flow_count 1 ecn_mark 0
new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth1 root refcnt 2 limit 10240p flows 1024 quantum 1506 target 5.0ms interval 100.0ms ecn
Sent 1846920 bytes 14184 pkt (dropped 0, overlimits 0 requeues 6)
backlog 0b 0p requeues 6
maxpacket 1506 drop_overlimit 0 new_flow_count 8 ecn_mark 0
new_flows_len 0 old_flows_len 0
qdisc noqueue 0: dev br-lan root refcnt 2
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
qdisc cake 8007: dev wlan0 root refcnt 5 bandwidth 4096Kbit diffserv3 triple-isolate rtt 100.0ms raw
Sent 3454312 bytes 2425 pkt (dropped 120, overlimits 4548 requeues 0)
backlog 0b 0p requeues 0
memory used: 62Kb of 4Mb
capacity estimate: 4096Kbit
Bulk Best Effort Voice
thresh 256Kbit 4096Kbit 1024Kbit
target 71.0ms 5.0ms 17.7ms
interval 166.0ms 100.0ms 35.5ms
pk_delay 0us 24.2ms 3.6ms
av_delay 0us 12.0ms 72us
sp_delay 0us 8us 7us
pkts 0 2511 34
bytes 0 3633026 2006
way_inds 0 0 0
way_miss 0 28 1
way_cols 0 0 0
drops 0 120 0
marks 0 0 0
sp_flows 0 1 0
bk_flows 0 0 0
un_flows 0 0 0
max_len 0 1506 68

qdisc ingress ffff: dev wlan0 parent ffff:fff1 ----------------
Sent 207561 bytes 2267 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
qdisc fq_codel 0: dev pppoe-wan root refcnt 2 limit 10240p flows 1024 quantum 1506 target 5.0ms interval 100.0ms ecn
Sent 1530614 bytes 13910 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
new_flows_len 0 old_flows_len 0
qdisc cake 8008: dev ifb4wlan0 root refcnt 2 bandwidth 1024Kbit besteffort triple-isolate wash rtt 100.0ms raw
Sent 255929 bytes 2266 pkt (dropped 1, overlimits 724 requeues 0)
backlog 0b 0p requeues 0
memory used: 54208b of 4Mb
capacity estimate: 1024Kbit
Tin 0
thresh 1024Kbit
target 17.7ms
interval 112.7ms
pk_delay 45.9ms
av_delay 2.2ms
sp_delay 18us
pkts 2267
bytes 257435
way_inds 0
way_miss 33
way_cols 0
drops 1
marks 0
sp_flows 0
bk_flows 1
un_flows 0
max_len 1506

tc -s qdisc (after a reboot/sqm off)

Summary

qdisc noqueue 0: dev lo root refcnt 2
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
qdisc fq_codel 0: dev eth0 root refcnt 2 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms ecn
Sent 530016 bytes 1586 pkt (dropped 0, overlimits 0 requeues 2)
backlog 0b 0p requeues 2
maxpacket 420 drop_overlimit 0 new_flow_count 1 ecn_mark 0
new_flows_len 0 old_flows_len 0
qdisc fq_codel 0: dev eth1 root refcnt 2 limit 10240p flows 1024 quantum 1506 target 5.0ms interval 100.0ms ecn
Sent 302875 bytes 1564 pkt (dropped 0, overlimits 0 requeues 1)
backlog 0b 0p requeues 1
maxpacket 1506 drop_overlimit 0 new_flow_count 1 ecn_mark 0
new_flows_len 0 old_flows_len 0
qdisc noqueue 0: dev br-lan root refcnt 2
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
qdisc noqueue 0: dev wlan0 root refcnt 2
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
qdisc fq_codel 0: dev pppoe-wan root refcnt 2 limit 10240p flows 1024 quantum 1506 target 5.0ms interval 100.0ms ecn
Sent 263720 bytes 1207 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
maxpacket 0 drop_overlimit 0 new_flow_count 0 ecn_mark 0
new_flows_len 0 old_flows_len 0

SQM_DEBUG=1 SQM_VERBOSITY_MAX=10 /etc/init.d/sqm stop ; SQM_DEBUG=1 SQM_VERBOSITY_MAX=10 /etc/init.d/sqm start

Summary

SQM: /sbin/ip link add name TMP_IFB_4_SQM type ifb
SQM: /usr/sbin/tc qdisc replace dev TMP_IFB_4_SQM root fq_codel
SQM: QDISC fq_codel is useable.
SQM: /sbin/ip link set dev TMP_IFB_4_SQM down
SQM: /sbin/ip link delete TMP_IFB_4_SQM type ifb
SQM: /sbin/ip link add name TMP_IFB_4_SQM type ifb
SQM: /usr/sbin/tc qdisc replace dev TMP_IFB_4_SQM root codel
SQM: /sbin/ip link set dev TMP_IFB_4_SQM down
SQM: /sbin/ip link delete TMP_IFB_4_SQM type ifb
SQM: /sbin/ip link add name TMP_IFB_4_SQM type ifb
SQM: /usr/sbin/tc qdisc replace dev TMP_IFB_4_SQM root pie
SQM: /sbin/ip link set dev TMP_IFB_4_SQM down
SQM: /sbin/ip link delete TMP_IFB_4_SQM type ifb
SQM: /sbin/ip link add name TMP_IFB_4_SQM type ifb
SQM: /usr/sbin/tc qdisc replace dev TMP_IFB_4_SQM root sfq
SQM: /sbin/ip link set dev TMP_IFB_4_SQM down
SQM: /sbin/ip link delete TMP_IFB_4_SQM type ifb
SQM: /sbin/ip link add name TMP_IFB_4_SQM type ifb
SQM: /usr/sbin/tc qdisc replace dev TMP_IFB_4_SQM root cake
SQM: QDISC cake is useable.
SQM: /sbin/ip link set dev TMP_IFB_4_SQM down
SQM: /sbin/ip link delete TMP_IFB_4_SQM type ifb
SQM:
SQM: Fri Oct 27 20:11:47 UTC 2017: Starting.
SQM: Starting SQM script: layer_cake.qos on wlan0, in: 1024 Kbps, out: 4096 Kbps
SQM: /sbin/ip link add name TMP_IFB_4_SQM type ifb
SQM: /usr/sbin/tc qdisc replace dev TMP_IFB_4_SQM root cake
SQM: QDISC cake is useable.
SQM: /sbin/ip link set dev TMP_IFB_4_SQM down
SQM: /sbin/ip link delete TMP_IFB_4_SQM type ifb
SQM: Starting layer_cake.qos
SQM: /usr/sbin/tc -p filter show parent ffff: dev wlan0
SQM: ifb associated with interface wlan0:
SQM: /usr/sbin/tc -p filter show parent ffff: dev wlan0
SQM: Currently no ifb is associated with wlan0, this is normal during starting of the sqm system.
SQM: /sbin/ip link add name ifb4wlan0 type ifb
SQM: STAB: stab mtu 2047 tsize 512 mpu 0 overhead 8 linklayer ethernet
SQM: /usr/sbin/tc qdisc add dev wlan0 root stab mtu 2047 tsize 512 mpu 0 overhead 8 linklayer ethernet cake bandwidth 4096kbit diffserv3
SQM: egress shaping activated
SQM: /sbin/ip link add name TMP_IFB_4_SQM type ifb
SQM: /usr/sbin/tc qdisc replace dev TMP_IFB_4_SQM ingress
SQM: QDISC ingress is useable.
SQM: /sbin/ip link set dev TMP_IFB_4_SQM down
SQM: /sbin/ip link delete TMP_IFB_4_SQM type ifb
SQM: /usr/sbin/tc qdisc add dev wlan0 handle ffff: ingress
SQM: STAB: stab mtu 2047 tsize 512 mpu 0 overhead 8 linklayer ethernet
SQM: /usr/sbin/tc qdisc add dev ifb4wlan0 root stab mtu 2047 tsize 512 mpu 0 overhead 8 linklayer ethernet cake bandwidth 1024kbit diffserv3 besteffort wash
SQM: /sbin/ip link set dev ifb4wlan0 up
SQM: /usr/sbin/tc filter add dev wlan0 parent ffff: protocol all prio 10 u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ifb4wlan0
SQM: ingress shaping activated
SQM: layer_cake.qos was started on wlan0 successfully

Looking at your /etc/config/sqm the file to look for would have been /var/run/sqm/wlan0.debug.log but only after first running "SQM_DEBUG=1 SQM_VERBOSITY_MAX=10 /etc/init.d/sqm stop ; SQM_DEBUG=1 SQM_VERBOSITY_MAX=10 /etc/init.d/sqm start". But this is most likely not going to help...

My theory is that you want to shape a wifi "guest" network, but wlan0 probably is also a member of br-lan, and if I recall correctly we do not get hot-plug events for bridge members, but sqm start requires hot plug events. I fear I have no good solution for you...

Best Regards

@moeller0, I have news about my situation with sqm. I found a palliative solution to get it started when rebooting the router. I had to add the /etc/init.d/sqm enable and /etc/init.d/sqm start commands to /etc/rc.local. By doing this, sqm starts automatically with no problem. What do you think of this solution? And taking advantage of, how do I choose the best values ​​for the various options in sqm, type per packet overhead, queue discipline and etc?

Well, if that works, it sounds like a decent solution; it does not seem to be suitable for all cases though, as dynamic interfaces like say pppoe-wan (or dsl interfaces like nas or ptm) might take quite a while to be created, and sqm will fail to start an instance on a non-exiting interface. Also if you manually disable and enable the wlan interface you will also need to re-start sqm... But certainly better than not having it start at all :wink:

This pretty much depends on what you want to get out of sqm. Have a look at https://lede-project.org/docs/user-guide/sqm for more information about what is possible; you might be interested in the final section titled "Making cake sing and dance, on a tight rope without a safety net"...

Best Regards

I've noticed this behaviour in 19.07.3.