Dir-645 does not work as AP after update

Hello,

I just updated my https://openwrt.org/toh/d-link/dir-645 from some very old 17.04 version to an up-to-date 19.07. Upgrade was sucessful, the device is accessible through web interface and ssh, WLAN scan works.

However, I can't get the device working as Access Point (AP). This is the relevant part from the system logs:

Sun Sep 20 16:39:25 2020 daemon.notice hostapd: ACS: Survey is missing noise floor
Sun Sep 20 16:39:25 2020 daemon.notice hostapd: wlan0: ACS-COMPLETED freq=2412 channel=1
Sun Sep 20 16:39:25 2020 daemon.err hostapd: Using interface wlan0 with hwaddr bc:f6:85:c4:be:ea and ssid "3D-Druck"
Sun Sep 20 16:39:25 2020 kern.info kernel: [   58.633929] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
Sun Sep 20 16:39:25 2020 kern.info kernel: [   58.646978] br-lan: port 2(wlan0) entered blocking state
Sun Sep 20 16:39:25 2020 kern.info kernel: [   58.657636] br-lan: port 2(wlan0) entered forwarding state
Sun Sep 20 16:39:25 2020 daemon.err hostapd: Interface initialization failed
Sun Sep 20 16:39:25 2020 daemon.notice hostapd: wlan0: interface state ACS->DISABLED
Sun Sep 20 16:39:25 2020 daemon.notice hostapd: wlan0: AP-DISABLED
Sun Sep 20 16:39:25 2020 daemon.err hostapd: ACS: Possibly channel configuration is invalid, please report this along with your config file.
Sun Sep 20 16:39:25 2020 daemon.err hostapd: ACS: Failed to start
Sun Sep 20 16:39:25 2020 daemon.notice hostapd: wlan0: AP-DISABLED
Sun Sep 20 16:39:25 2020 daemon.err hostapd: hostapd_free_hapd_data: Interface wlan0 wasn't started
Sun Sep 20 16:39:25 2020 daemon.notice hostapd: nl80211: deinit ifname=wlan0 disabled_11b_rates=0
Sun Sep 20 16:39:25 2020 kern.info kernel: [   58.707010] device wlan0 left promiscuous mode
Sun Sep 20 16:39:25 2020 kern.info kernel: [   58.716069] br-lan: port 2(wlan0) entered disabled state
Sun Sep 20 16:39:25 2020 daemon.notice hostapd: wlan0: interface state DISABLED->DISABLED
Sun Sep 20 16:39:25 2020 daemon.notice hostapd: wlan0: interface state DISABLED->DISABLED
Sun Sep 20 16:39:25 2020 daemon.notice hostapd: wlan0: AP-DISABLED
Sun Sep 20 16:39:25 2020 daemon.notice hostapd: wlan0: CTRL-EVENT-TERMINATING
Sun Sep 20 16:39:25 2020 daemon.err hostapd: hostapd_free_hapd_data: Interface wlan0 wasn't started
Sun Sep 20 16:39:25 2020 daemon.notice hostapd: ELOOP: remaining socket: sock=21 eloop_data=0x77f52ed0 user_data=0 handler=0x4517c5
Sun Sep 20 16:39:25 2020 daemon.notice netifd: radio0 (1193): cat: can't open '/var/run/wifi-phy0.pid': No such file or directory

Network interfaces:

root@LEDE:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP qlen 1000
    link/ether bc:f6:85:c4:be:ea brd ff:ff:ff:ff:ff:ff
    inet6 fe80::bef6:85ff:fec4:beea/64 scope link 
       valid_lft forever preferred_lft forever
4: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether bc:f6:85:c4:be:ea brd ff:ff:ff:ff:ff:ff
    inet 192.168.11.11/24 brd 192.168.11.255 scope global br-lan
       valid_lft forever preferred_lft forever
    inet6 fd86:18e4:aed5::1/60 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::bef6:85ff:fec4:beea/64 scope link 
       valid_lft forever preferred_lft forever
5: eth0.1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP qlen 1000
    link/ether bc:f6:85:c4:be:ea brd ff:ff:ff:ff:ff:ff
6: br-wan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether bc:f6:85:c4:be:eb brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.10/24 brd 192.168.10.255 scope global br-wan
       valid_lft forever preferred_lft forever
    inet6 fe80::bef6:85ff:fec4:beeb/64 scope link 
       valid_lft forever preferred_lft forever
7: eth0.2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-wan state UP qlen 1000
    link/ether bc:f6:85:c4:be:eb brd ff:ff:ff:ff:ff:ff
9: br-wan6: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether ee:96:0d:24:7e:2c brd ff:ff:ff:ff:ff:ff
10: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq master br-lan state DOWN qlen 1000
    link/ether bc:f6:85:c4:be:ea brd ff:ff:ff:ff:ff:ff

To me, it looks like hostapd fails:

root@LEDE:~# /usr/sbin/hostapd -dd -t -P /var/run/wifi-phy0.pid /var/run/hostapd-phy0.conf
1600620833.668109: Configuration file: /var/run/hostapd-phy0.conf
1600620833.836714: wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
1600620833.839698: ACS: Automatic channel selection started, this may take a bit
1600620833.845109: wlan0: interface state COUNTRY_UPDATE->ACS
1600620833.845418: wlan0: ACS-STARTED 
1600620841.684525: ACS: Survey is missing noise floor
1600620841.684626: ACS: Survey is missing noise floor
1600620841.684660: ACS: Survey is missing noise floor
1600620841.684787: ACS: Survey is missing noise floor
1600620841.684882: ACS: Survey is missing noise floor
1600620841.684977: ACS: Survey is missing noise floor
1600620841.685069: ACS: Survey is missing noise floor
1600620841.685168: ACS: Survey is missing noise floor
1600620841.685210: ACS: Survey is missing noise floor
1600620841.685241: ACS: Survey is missing noise floor
1600620841.685274: ACS: Survey is missing noise floor
1600620841.685417: wlan0: ACS-COMPLETED freq=2412 channel=1
1600620841.692315: Using interface wlan0 with hwaddr bc:f6:85:c4:be:ea and ssid "3D-Druck"
1600620841.855546: Interface initialization failed
1600620841.856435: wlan0: interface state ACS->DISABLED
1600620841.857408: wlan0: AP-DISABLED 
1600620841.858243: ACS: Possibly channel configuration is invalid, please report this along with your config file.
1600620841.859136: ACS: Failed to start
1600620841.859508: wlan0: AP-DISABLED 
1600620841.859979: hostapd_free_hapd_data: Interface wlan0 wasn't started
1600620841.860908: nl80211: deinit ifname=wlan0 disabled_11b_rates=0
1600620841.869863: wlan0: interface state DISABLED->DISABLED
1600620841.870663: wlan0: interface state DISABLED->DISABLED
1600620841.871588: wlan0: AP-DISABLED 
1600620841.872444: wlan0: CTRL-EVENT-TERMINATING 
1600620841.873700: hostapd_free_hapd_data: Interface wlan0 wasn't started
1600620841.874976: ELOOP: remaining socket: sock=15 eloop_data=0x77f40ed0 user_data=0 handler=0x4517c5

The device has worked as AP with the old version of openwrt.

Any suggestions how I can nail down the problem?

Kind regards, aanno

Debugging hostapd seem to be difficult. Hence I (also) asked Debug hostapd?

Set channel to a definite number rather than auto. Make sure country code is set.

If that doesn't work, rm /etc/config/wireless and reboot to completely rebuild wireless config.

4 Likes

@aanno You did notice this line?

Sun Sep 20 16:39:25 2020 daemon.err hostapd: ACS: Possibly channel configuration is invalid, please report this along with your config file.
2 Likes

Thank you for suggestions. It now works! This is what I did:

  1. The 'Possibly channel configuration is invalid' goes away when I set the channel
  2. Does 'interface state COUNTRY_UPDATE->ACS' indicate that country code is set?
  3. I removed /etc/config/wireless and /var/run/hostapd-phy0.conf and rebooted the device
  4. Sometimes /dev/wlan0 is not there. When this occurs, I create it with iw phy phy0 interface add wlan0 type managed and reboot.

And for reference:

cat /etc/config/wireless

config wifi-device 'radio0'
        option type 'mac80211'
        option hwmode '11g'
        option path 'platform/10180000.wmac'
        option htmode 'HT20'
        option txpower '20'
        option channel '1'

config wifi-iface 'default_radio0'
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option ssid 'OpenWrt'
        option key 'xxxxxxxxxxxx'
        option encryption 'psk2'
# cat /var/run/hostapd-phy0.conf
driver=nl80211
logger_syslog=127
logger_syslog_level=2
logger_stdout=127
logger_stdout_level=2
hw_mode=g
beacon_int=100
channel=1



ieee80211n=1
ht_coex=0
ht_capab=[SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC12]

interface=wlan0
ctrl_interface=/var/run/hostapd
ap_isolate=1
bss_load_update_period=60
chan_util_avg_period=600
disassoc_low_ack=1
preamble=1
wmm_enabled=1
ignore_broadcast_ssid=0
uapsd_advertisement_enabled=1
utf8_ssid=1
multi_ap=0
wpa_passphrase=Cetus3D!
auth_algs=1
wpa=2
wpa_pairwise=CCMP
ssid=OpenWrt
bridge=br-lan
wpa_disable_eapol_key_retries=0
wpa_key_mgmt=WPA-PSK
okc=0
disable_pmksa_caching=1
bssid=bc:f6:85:c4:be:ea

And the relevant part from the system logs:

Wed Sep 23 16:22:13 2020 daemon.err hostapd: Configuration file: /var/run/hostapd-phy0.conf
Wed Sep 23 16:22:13 2020 kern.info kernel: [   49.719406] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
Wed Sep 23 16:22:13 2020 kern.info kernel: [   49.746852] br-lan: port 2(wlan0) entered blocking state
Wed Sep 23 16:22:13 2020 kern.info kernel: [   49.757532] br-lan: port 2(wlan0) entered disabled state
Wed Sep 23 16:22:13 2020 kern.info kernel: [   49.768522] device wlan0 entered promiscuous mode
Wed Sep 23 16:22:14 2020 daemon.err hostapd: Using interface wlan0 with hwaddr bc:f6:85:c4:be:ea and ssid "OpenWrt"
Wed Sep 23 16:22:14 2020 kern.info kernel: [   50.095662] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
Wed Sep 23 16:22:14 2020 kern.info kernel: [   50.108629] br-lan: port 2(wlan0) entered blocking state
Wed Sep 23 16:22:14 2020 kern.info kernel: [   50.119281] br-lan: port 2(wlan0) entered forwarding state
Wed Sep 23 16:22:14 2020 daemon.notice hostapd: wlan0: interface state UNINITIALIZED->ENABLED
Wed Sep 23 16:22:14 2020 daemon.notice hostapd: wlan0: AP-ENABLED
Wed Sep 23 16:22:14 2020 daemon.notice netifd: Network device 'wlan0' link is up
1 Like

Put option country 'ZZ' in the wifi-device section, replace ZZ with the ISO two-letter code for your country.

1 Like

@mk24 yes, thank you.

In luci, it's 'wireless -> /wlan0 -> advanced settings -> country code'

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.