Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#17759 closed defect (not_a_bug)

rc.local can not run when boot

Reported by: anonymous Owned by: developers
Priority: normal Milestone: Chaos Calmer 15.05
Component: base system Version: Trunk
Keywords: rc.local Cc:

Description

there is a link S95done directing to /etc/init.d/done in /etc/rc.d/. but it can not start when boot. and i tried modified "[ -d /tmp/root ]" to "[ -e /dev/root ]" ,but nothing help! my USB wifi adapter rtl8187 can work after installed the driver kmod-rtl8187 on HG556a (ver A), i put it as a receiver out of the window,all goes well but when the wifi bitrates ranged to 54mbps(max 54mbps),the outgoing was blocked,when ping 8.8.8.8,few packages return. so i have to set it to a low rate via "iw dev wlan1 set legacy-2.4 11". and i put this cli to /etc/rc.local to want it running after restarting, but it did nothing. i hate to run the rc.local shell evey boot. who can help me? many thanks!


#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org

START=95
boot() {

[ -d /tmp/root ] && mount_root done

# process user commands
[ -f /etc/rc.local ] && {
sh /etc/rc.local
}

# set leds to normal state
. /etc/diag.sh
set_state done there is a link S95done in /etc/rc.d/:


Attachments (0)

Change History (6)

comment:1 Changed 3 years ago by bittorf@…

smells like a race. please insert this command in /etc/init.d/done

touch /tmp/test

after booting, look if this file exists. (is working here)

comment:2 Changed 3 years ago by anonymous

thank you for your quikly reply. you are right i can see the test file. maybe the problem is the rc.local executed too early while the wifi wlan1 prepared. can you give more advices?

comment:3 Changed 3 years ago by bittorf@…

the clean approach would be to support

option 'legacy_rate' '11'

in wifi-options = /lib/netifd/wireless/mac80211.sh
the "bad" approach is to use a hotplug-script in e.g.
/etc/hotplug.d/iface/60-wifibitrate

[ "$ACTION" = 'ifup' -a "$DEVICE" = 'wlan1-1' ] && {
  logger "setting bitrate for $DEVICE"
  iw dev $DEVICE set bitrates legacy-2.4 '11'
}

}}}

comment:4 Changed 3 years ago by anonymous

the 'legacy_rate' can not be supported, do nothing! bitrates raise to MAX 54Mbps.

option 'legacy_rate' '11'

root@HG556a:~# uci show wireless.radio1
wireless.radio1=wifi-device
wireless.radio1.type=mac80211
wireless.radio1.hwmode=11g
wireless.radio1.path=platform/ehci-platform/usb1/1-2/1-2.2/1-2.2:1.0
wireless.radio1.htmode=HT20
wireless.radio1.disabled=0
wireless.radio1.txpower=20
wireless.radio1.country=CN
wireless.radio1.legacy_rate=11
wireless.radio1.channel=12
root@HG556a:~# uci show wireless.@wifi-iface[1]
wireless.cfg063579=wifi-iface
wireless.cfg063579.network=wwan
wireless.cfg063579.ssid=MERCURY_837C
wireless.cfg063579.encryption=psk2
wireless.cfg063579.device=radio1
wireless.cfg063579.legacy_rate=11
wireless.cfg063579.mode=sta


root@HG556a:~# iwinfo wlan1 info
wlan1 ESSID: "MERCURY_xxxx"

Access Point: D0:C7:C0:D9:83:7C
Mode: Client Channel: 12 (2.467 GHz)
Tx-Power: 20 dBm Link Quality: 52/70
Signal: -58 dBm Noise: unknown
Bit Rate: 54.0 MBit/s
Encryption: WPA2 PSK (CCMP)
Type: nl80211 HW Mode(s): 802.11bg
Hardware: unknown [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: no PHY name: phy1


then i try the method hotplug

root@HG556a:~# cat /etc/hotplug.d/iface/30-rtl8187 
#!/bin/sh

[ "$ACTION" = 'ifup' -a "$DEVICE" = 'wlan1' ] && {
  logger "setting bitrate for $DEVICE"
  iw dev $DEVICE set bitrates legacy-2.4 '11'
}

your codes made a little mistake in "$DEVICE" = 'wlan1-1', it should be "$DEVICE" = 'wlan1'.
then i reboot the route :
it works..... Thank for your good guide and reply.


wlan1 ESSID: "MERCURY_837C"

Access Point: D0:C7:C0:D9:83:7C
Mode: Client Channel: 12 (2.467 GHz)
Tx-Power: 20 dBm Link Quality: 60/70
Signal: -50 dBm Noise: unknown
Bit Rate: 11.0 MBit/s
Encryption: WPA2 PSK (CCMP)
Type: nl80211 HW Mode(s): 802.11bg
Hardware: unknown [Generic MAC80211]
TX power offset: unknown
Frequency offset: unknown
Supports VAPs: no PHY name: phy1


thanks again! bittorf@

comment:5 Changed 3 years ago by nbd

  • Resolution set to not_a_bug
  • Status changed from new to closed

the rc.local thing is not a bug, wireless devices are simply brought up asynchronously after the init scripts have run.

comment:6 Changed 3 years ago by anonymous

If you want an ugly fix, put "sleep 60" 1 line before your command.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.