(resolved) calling CRDA many times and failing on boot.

Hi,

On booting up dietpi on a rpi B it takes a while before the wireless comes up and I can ssh into it. I’m running it headless with dietpi v92.

dmesg shows the info below. Lots of time is spent calling CRDA. Can this be set so this doesn’t happen?

I’m not sure why CRDA can’t be found. The rpi has an internet connection.

What can I do to speed up the time from power on to being able to ssh into the rpi.?

Thanks,
Gordon Williams


[ 2.060620] EXT4-fs (mmcblk0p2): INFO: recovery required on readonly filesystem
[ 2.074497] EXT4-fs (mmcblk0p2): write access will be enabled during recovery
[ 2.143721] usb 1-1: new high-speed USB device number 2 using dwc_otg
[ 2.158443] Indeed it is in host mode hprt0 = 00001101
[ 2.374540] usb 1-1: New USB device found, idVendor=0424, idProduct=9512
[ 2.388859] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 2.404689] hub 1-1:1.0: USB hub found
[ 2.416735] hub 1-1:1.0: 3 ports detected
[ 2.703723] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[ 2.814090] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[ 2.827160] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 2.843808] smsc95xx v1.0.4
[ 2.908733] smsc95xx 1-1.1:1.0 eth0: register ‘smsc95xx’ at usb-20980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:a5:0d:22
[ 3.003689] usb 1-1.3: new high-speed USB device number 4 using dwc_otg
[ 3.135215] usb 1-1.3: New USB device found, idVendor=0cf3, idProduct=9271
[ 3.149039] usb 1-1.3: New USB device strings: Mfr=16, Product=32, SerialNumber=48
[ 3.163353] usb 1-1.3: Product: USB2.0 WLAN
[ 3.173866] usb 1-1.3: Manufacturer: ATHEROS
[ 3.184828] usb 1-1.3: SerialNumber: 12345
[ 7.899081] EXT4-fs (mmcblk0p2): recovery complete
[ 8.255334] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 8.270064] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[ 8.285529] devtmpfs: mounted
[ 8.296047] Freeing unused kernel memory: 348K (c07c3000 - c081a000)
[ 10.082457] udevd[159]: starting version 175
[ 11.454022] gpiomem-bcm2835 20200000.gpiomem: Initialised: Registers at 0x20200000
[ 12.466613] cfg80211: Calling CRDA to update world regulatory domain
[ 12.863542] usb 1-1.3: ath9k_htc: Firmware htc_9271.fw requested
[ 12.954152] usbcore: registered new interface driver ath9k_htc
[ 13.166174] usb 1-1.3: ath9k_htc: Transferred FW: htc_9271.fw, size: 51272
[ 13.249978] random: nonblocking pool is initialized
[ 13.412086] ath9k_htc 1-1.3:1.0: ath9k_htc: HTC initialized with 33 credits
[ 15.654128] cfg80211: Calling CRDA to update world regulatory domain
[ 15.880552] ath9k_htc 1-1.3:1.0: ath9k_htc: FW Version: 1.3
[ 15.913913] ath9k_htc 1-1.3:1.0: FW RMW support: Off
[ 15.933892] ath: EEPROM regdomain: 0x809c
[ 15.933923] ath: EEPROM indicates we should expect a country code
[ 15.933940] ath: doing EEPROM country->regdmn map search
[ 15.933961] ath: country maps to regdmn code: 0x52
[ 15.934020] ath: Country alpha2 being used: CN
[ 15.934033] ath: Regpair used: 0x52
[ 16.065344] ieee80211 phy0: Atheros AR9271 Rev:1
[ 16.104087] cfg80211: Calling CRDA to update world regulatory domain
[ 18.183520] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ 18.843962] cfg80211: Calling CRDA to update world regulatory domain
[ 19.185282] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ 22.044036] cfg80211: Calling CRDA to update world regulatory domain
[ 25.233852] cfg80211: Calling CRDA to update world regulatory domain
[ 28.423901] cfg80211: Calling CRDA to update world regulatory domain
[ 31.614044] cfg80211: Calling CRDA to update world regulatory domain
[ 34.803859] cfg80211: Calling CRDA to update world regulatory domain
[ 36.470964] smsc95xx 1-1.1:1.0 eth0: hardware isn’t capable of remote wakeup
[ 37.997142] cfg80211: Calling CRDA to update world regulatory domain
[ 39.894454] wlan0: authenticate with 64:66:b3:f4:35:f8
[ 40.895086] wlan0: send auth to 64:66:b3:f4:35:f8 (try 1/3)
[ 40.904435] wlan0: authenticated
[ 40.906801] ath9k_htc 1-1.3:1.0 wlan0: disabling HT/VHT due to WEP/TKIP use
[ 41.154017] cfg80211: Calling CRDA to update world regulatory domain
[ 44.313780] cfg80211: Calling CRDA to update world regulatory domain
[ 47.473935] cfg80211: Calling CRDA to update world regulatory domain
[ 50.633803] cfg80211: Exceeded CRDA call max attempts. Not calling CRDA
[ 86.887378] wlan0: associate with 64:66:b3:f4:35:f8 (try 1/3)
[ 95.012187] wlan0: associate with 64:66:b3:f4:35:f8 (try 2/3)
[ 95.557869] Adding 102396k swap on /var/swap. Priority:-1 extents:1 across:102396k SSFS
[ 103.129204] wlan0: associate with 64:66:b3:f4:35:f8 (try 3/3)
[ 111.250545] wlan0: association with 64:66:b3:f4:35:f8 timed out
[ 113.812027] wlan0: authenticate with 64:66:b3:f4:35:f8
[ 114.813087] wlan0: send auth to 64:66:b3:f4:35:f8 (try 1/3)
[ 114.824596] wlan0: authenticated
[ 114.833994] wlan0: associate with 64:66:b3:f4:35:f8 (try 1/3)
[ 114.839964] wlan0: RX AssocResp from 64:66:b3:f4:35:f8 (capab=0x411 status=0 aid=3)
[ 114.864205] wlan0: associated
[ 114.864716] cfg80211: Calling CRDA to update world regulatory domain
[ 118.023912] cfg80211: Calling CRDA to update world regulatory domain
[ 121.183951] cfg80211: Calling CRDA to update world regulatory domain
[ 124.343939] cfg80211: Calling CRDA to update world regulatory domain
[ 127.503983] cfg80211: Calling CRDA to update world regulatory domain
[ 130.663991] cfg80211: Calling CRDA to update world regulatory domain
[ 133.823980] cfg80211: Calling CRDA to update world regulatory domain
[ 136.984015] cfg80211: Calling CRDA to update world regulatory domain
[ 140.144058] cfg80211: Calling CRDA to update world regulatory domain
[ 143.304102] cfg80211: Calling CRDA to update world regulatory domain
[ 146.464059] cfg80211: Calling CRDA to update world regulatory domain
[ 149.624067] cfg80211: Exceeded CRDA call max attempts. Not calling CRDA
root@dietpi:~#

Hi Gordon,

Done some research, appears to be an issue with Raspbian Jessie.

Going from this post, could you please try the following:

apt-get install crda -y
reboot

Let me know if the error is gone, and, another copy of your dmesg please so we can check boot times. Thanks.

Hi,
That looks quite different now.

Not sure that it is totally correct though. If I go

root@dietpi:~# crda
COUNTRY environment variable not set.

If I run:

root@dietpi:~# iw reg get
country US:
(2402 - 2472 @ 40), (N/A, 30)
(5170 - 5250 @ 80), (N/A, 17)
(5250 - 5330 @ 80), (N/A, 23), DFS
(5735 - 5835 @ 80), (N/A, 30)
(57240 - 63720 @ 2160), (N/A, 40)

dmesg is below.

If I read it correctly it goes from a world domain to China domain to US domain
[ 8.968853] cfg80211: World regulatory domain updated:
Then
[ 12.460889] cfg80211: Regulatory domain changed to country: CN
then
[ 41.207151] cfg80211: Regulatory domain changed to country: US

Regards,
Gordon Williams



[ 1.985609] mmcblk0: mmc0:0007 SD04G 3.70 GiB
[ 1.996407] vc_vchi_sm_init: failed to open VCHI service (-1)
[ 2.002140] [vc_sm_connected_init]: failed to initialize shared memory service
[ 2.031225] [vc_sm_connected_init]: end - returning -1
[ 2.042818] mmcblk0: p1 p2
[ 2.079701] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 2.094727] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[ 2.110036] devtmpfs: mounted
[ 2.120663] Freeing unused kernel memory: 352K (c07c2000 - c081a000)
[ 2.144995] usb 1-1: new high-speed USB device number 2 using dwc_otg
[ 2.159167] Indeed it is in host mode hprt0 = 00001101
[ 2.375603] usb 1-1: New USB device found, idVendor=0424, idProduct=9512
[ 2.390052] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 2.405882] hub 1-1:1.0: USB hub found
[ 2.418099] hub 1-1:1.0: 3 ports detected
[ 2.705061] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[ 2.825656] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[ 2.855105] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 2.881315] smsc95xx v1.0.4
[ 2.964410] smsc95xx 1-1.1:1.0 eth0: register ‘smsc95xx’ at usb-20980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:a5:0d:22
[ 3.095052] usb 1-1.3: new high-speed USB device number 4 using dwc_otg
[ 4.057517] udevd[159]: starting version 175
[ 5.442322] gpiomem-bcm2835 20200000.gpiomem: Initialised: Registers at 0x20200000
[ 8.236207] usb 1-1.3: New USB device found, idVendor=0cf3, idProduct=9271
[ 8.249942] usb 1-1.3: New USB device strings: Mfr=16, Product=32, SerialNumber=48
[ 8.264498] usb 1-1.3: Product: USB2.0 WLAN
[ 8.275567] usb 1-1.3: Manufacturer: ATHEROS
[ 8.286505] usb 1-1.3: SerialNumber: 12345
[ 8.561842] cfg80211: Calling CRDA to update world regulatory domain
[ 8.851876] usb 1-1.3: ath9k_htc: Firmware htc_9271.fw requested
[ 8.869734] usbcore: registered new interface driver ath9k_htc
[ 8.968853] cfg80211: World regulatory domain updated:
[ 8.981421] cfg80211: DFS Master region: unset
[ 8.986074] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[ 9.009673] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[ 9.024703] cfg80211: (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[ 9.039822] cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[ 9.055870] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[ 9.072640] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[ 9.089118] cfg80211: (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[ 9.104336] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[ 9.119217] cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[ 9.231936] usb 1-1.3: ath9k_htc: Transferred FW: htc_9271.fw, size: 51272
[ 9.439956] random: nonblocking pool is initialized
[ 9.477226] ath9k_htc 1-1.3:1.0: ath9k_htc: HTC initialized with 33 credits
[ 11.915647] ath9k_htc 1-1.3:1.0: ath9k_htc: FW Version: 1.3
[ 11.942270] ath9k_htc 1-1.3:1.0: FW RMW support: Off
[ 11.985238] ath: EEPROM regdomain: 0x809c
[ 11.985271] ath: EEPROM indicates we should expect a country code
[ 11.985291] ath: doing EEPROM country->regdmn map search
[ 11.985309] ath: country maps to regdmn code: 0x52
[ 11.985365] ath: Country alpha2 being used: CN
[ 11.985379] ath: Regpair used: 0x52
[ 12.127562] ieee80211 phy0: Atheros AR9271 Rev:1
[ 12.155072] cfg80211: Calling CRDA for country: CN
[ 12.460889] cfg80211: Regulatory domain changed to country: CN
[ 12.527467] cfg80211: DFS Master region: unset
[ 12.534125] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[ 12.603208] cfg80211: (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[ 12.680331] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2300 mBm), (N/A)
[ 12.715371] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2300 mBm), (0 s)
[ 12.756263] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 3000 mBm), (N/A)
[ 12.826903] cfg80211: (57240000 KHz - 59400000 KHz @ 2160000 KHz), (N/A, 2800 mBm), (N/A)
[ 12.905251] cfg80211: (59400000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4400 mBm), (N/A)
[ 12.957910] cfg80211: (63720000 KHz - 65880000 KHz @ 2160000 KHz), (N/A, 2800 mBm), (N/A)
[ 14.504028] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ 15.500256] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ 32.412442] smsc95xx 1-1.1:1.0 eth0: hardware isn’t capable of remote wakeup
[ 36.165805] wlan0: authenticate with 64:66:b3:f4:35:f8
[ 37.175245] wlan0: send auth to 64:66:b3:f4:35:f8 (try 1/3)
[ 37.179336] wlan0: authenticated
[ 37.185224] ath9k_htc 1-1.3:1.0 wlan0: disabling HT/VHT due to WEP/TKIP use
[ 37.195130] wlan0: associate with 64:66:b3:f4:35:f8 (try 1/3)
[ 37.198820] wlan0: RX AssocResp from 64:66:b3:f4:35:f8 (capab=0x411 status=12 aid=3)
[ 37.198908] wlan0: 64:66:b3:f4:35:f8 denied association (code=12)
[ 40.081844] wlan0: authenticate with 64:66:b3:f4:35:f8
[ 41.086752] wlan0: send auth to 64:66:b3:f4:35:f8 (try 1/3)
[ 41.089110] wlan0: authenticated
[ 41.095088] wlan0: associate with 64:66:b3:f4:35:f8 (try 1/3)
[ 41.101203] wlan0: RX AssocResp from 64:66:b3:f4:35:f8 (capab=0x411 status=0 aid=3)
[ 41.126261] wlan0: associated
[ 41.129588] cfg80211: Calling CRDA for country: US
[ 41.207151] cfg80211: Regulatory domain changed to country: US
[ 41.207234] cfg80211: DFS Master region: unset
[ 41.207250] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[ 41.207278] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 3000 mBm), (N/A)
[ 41.207402] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 1700 mBm), (N/A)
[ 41.207724] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2300 mBm), (0 s)
[ 41.207747] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 3000 mBm), (N/A)
[ 41.207765] cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
[ 53.622344] Adding 102396k swap on /var/swap. Priority:-1 extents:1 across:102396k SSFS
root@dietpi:~#

Hi,

A bit of searching I thought that I found something useful, but no

http://askubuntu.com/questions/147066/how-can-i-change-an-atheros-wireless-nic-region-regulatory-domain-in-ubuntu

sudo apt-get install crda
sudo vi /etc/default/crda

then change the line REGDOMAIN= to your country code, eg.

REGDOMAIN=CA

I modified the file (country was blank before) as above and rebooted
dmesg was about the same - actually took longer to associate with the router but I don’t think that is associated with this problem.

Interestingly CRDA still is not set even though I added the country code :frowning:
root@dietpi:~# crda
COUNTRY environment variable not set.

Could this be set somewhere else?

Gordon Williams

Hi Gordon,

Thanks for the update.
When i’ve finished working on v99, i’ll take a look and run some tests. Will let you know the results.

I’ve created a Git Ticket for this bug. Will try and run some tests soon.

OK, I will keep on checking back.
Gordon

Hi Gordon,

This will be resolved in the v100 update. You can also manually patch this issue on your system by running the following:

/DietPi/dietpi/dietpi-apt-get_update 1
apt-get install iw crda --no-install-recommends -y

Thanks, I will give it a try.
Gordon Williams

Hi,

I have updated to V100.

It looks like it is still going World,CN,US.

I have in /etc/default/crda
REGDOMAIN=CA

So it is using US rather than CA. :roll_eyes:

Is it possible to turn off “calling CRDA” and just have the correct domain set on rPi?

When the rPi is going to be used in my project in the field, it is going to be using wifi but there isn’t going to be an internet connection so calling CRDA is useless anyway.

Thanks,
Gordon

[ 2.108182] devtmpfs: mounted
[ 2.118790] Freeing unused kernel memory: 352K (c07c2000 - c081a000)
[ 2.144974] usb 1-1: new high-speed USB device number 2 using dwc_otg
[ 2.158383] Indeed it is in host mode hprt0 = 00001101
[ 2.375560] usb 1-1: New USB device found, idVendor=0424, idProduct=9512
[ 2.389715] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 2.405419] hub 1-1:1.0: USB hub found
[ 2.417773] hub 1-1:1.0: 3 ports detected
[ 2.705047] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[ 2.835785] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[ 2.861233] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 2.883755] smsc95xx v1.0.4
[ 2.963923] smsc95xx 1-1.1:1.0 eth0: register ‘smsc95xx’ at usb-20980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:a5:0d:22
[ 3.095081] usb 1-1.3: new high-speed USB device number 4 using dwc_otg
[ 4.053886] udevd[159]: starting version 175
[ 5.436926] gpiomem-bcm2835 20200000.gpiomem: Initialised: Registers at 0x20200000
[ 8.236145] usb 1-1.3: New USB device found, idVendor=0cf3, idProduct=9271
[ 8.250097] usb 1-1.3: New USB device strings: Mfr=16, Product=32, SerialNumber=48
[ 8.264403] usb 1-1.3: Product: USB2.0 WLAN
[ 8.275216] usb 1-1.3: Manufacturer: ATHEROS
[ 8.286326] usb 1-1.3: SerialNumber: 12345
[ 8.545785] cfg80211: Calling CRDA to update world regulatory domain
[ 8.833075] usb 1-1.3: ath9k_htc: Firmware htc_9271.fw requested
[ 8.850617] usbcore: registered new interface driver ath9k_htc
[ 8.950334] cfg80211: World regulatory domain updated:
[ 8.962782] cfg80211: DFS Master region: unset
[ 8.967416] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[ 8.991099] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[ 9.006253] cfg80211: (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[ 9.021610] cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[ 9.037960] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[ 9.055134] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[ 9.071894] cfg80211: (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[ 9.087413] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[ 9.102446] cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[ 9.215288] usb 1-1.3: ath9k_htc: Transferred FW: htc_9271.fw, size: 51272
[ 9.418869] random: nonblocking pool is initialized
[ 9.460727] ath9k_htc 1-1.3:1.0: ath9k_htc: HTC initialized with 33 credits
[ 11.915438] ath9k_htc 1-1.3:1.0: ath9k_htc: FW Version: 1.3
[ 11.954711] ath9k_htc 1-1.3:1.0: FW RMW support: Off
[ 11.995310] ath: EEPROM regdomain: 0x809c
[ 11.995347] ath: EEPROM indicates we should expect a country code
[ 11.995405] ath: doing EEPROM country->regdmn map search
[ 11.995423] ath: country maps to regdmn code: 0x52
[ 11.995437] ath: Country alpha2 being used: CN
[ 11.995450] ath: Regpair used: 0x52
[ 12.146831] ieee80211 phy0: Atheros AR9271 Rev:1
[ 12.185510] cfg80211: Calling CRDA for country: CN
[ 12.319748] cfg80211: Calling CRDA for country: CN
[ 12.537913] cfg80211: Current regulatory domain intersected:
[ 12.572259] cfg80211: DFS Master region: unset
[ 12.597942] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[ 12.699800] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[ 12.774320] cfg80211: (2457000 KHz - 2482000 KHz @ 25000 KHz), (N/A, 2000 mBm), (N/A)
[ 12.835203] cfg80211: (2474000 KHz - 2482000 KHz @ 8000 KHz), (N/A, 2000 mBm), (N/A)
[ 12.927315] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[ 13.169588] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[ 13.245129] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[ 13.294252] cfg80211: (57240000 KHz - 59400000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[ 13.362510] cfg80211: (59400000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[ 14.634331] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ 15.590589] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ 32.532014] smsc95xx 1-1.1:1.0 eth0: hardware isn’t capable of remote wakeup
[ 36.286007] wlan0: authenticate with 64:66:b3:f4:35:f8
[ 37.302787] wlan0: send auth to 64:66:b3:f4:35:f8 (try 1/3)
[ 37.307391] wlan0: authenticated
[ 37.312654] ath9k_htc 1-1.3:1.0 wlan0: disabling HT/VHT due to WEP/TKIP use
[ 37.315165] wlan0: associate with 64:66:b3:f4:35:f8 (try 1/3)
[ 37.318871] wlan0: RX AssocResp from 64:66:b3:f4:35:f8 (capab=0x411 status=12 aid=2)
[ 37.318925] wlan0: 64:66:b3:f4:35:f8 denied association (code=12)
[ 37.683957] wlan0: authenticate with 64:66:b3:f4:35:f8
[ 38.345043] wlan0: send auth to 64:66:b3:f4:35:f8 (try 1/3)
[ 38.349907] wlan0: authenticated
[ 38.365137] wlan0: associate with 64:66:b3:f4:35:f8 (try 1/3)
[ 38.369650] wlan0: RX AssocResp from 64:66:b3:f4:35:f8 (capab=0x411 status=0 aid=2)
[ 38.393894] wlan0: associated
[ 38.394687] cfg80211: Calling CRDA for country: US
[ 38.527527] cfg80211: Regulatory domain changed to country: US
[ 38.527573] cfg80211: DFS Master region: unset
[ 38.527632] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[ 38.527662] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 3000 mBm), (N/A)
[ 38.527688] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 1700 mBm), (N/A)
[ 38.527706] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2300 mBm), (0 s)
[ 38.527767] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 3000 mBm), (N/A)
[ 38.527789] cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
[ 50.426847] Adding 102396k swap on /var/swap. Priority:-1 extents:1 across:102396k SSFS
root@dietpi:~#

Hi Gordon,

Yep, looks like its ignoring the /etc/default/crda file completely.

I came accross this for Atheros based wifi devices: [SOLVED] WLAN ath5k: regulatory domain set but it is ignored? / Networking, Server, and Protection / Arch Linux Forums. Although this is for Arch, it appears you can set the regulatory domain (country) by writing to the EEPROM on your wifi device.
I would attempt this at my end, unfortunately, I dont own a Atheros based wifi device.

As for disabling crda, you could try blacklisting the crda module (cfg80211):

echo -e "blacklist cfg80211" > /etc/modprobe.d/blacklist-cfg80211.conf

I’ve done the following:
echo -e “blacklist cfg80211” > /etc/modprobe.d/blacklist-cfg80211.conf

and rebooted and I don’t think that there is any change. Still going world,CN,US

cfg80211 is still being used. So I don’t see any effect of the blacklist.

I also tried uninstalling crda and the two dependencies (iw and db) no longer required and that just brought me back to the beginning of the thread with many more calls to CRDA.

Gordon

[ 2.144996] usb 1-1: new high-speed USB device number 2 using dwc_otg
[ 2.159052] Indeed it is in host mode hprt0 = 00001101
[ 2.375593] usb 1-1: New USB device found, idVendor=0424, idProduct=9512
[ 2.389649] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 2.405395] hub 1-1:1.0: USB hub found
[ 2.417668] hub 1-1:1.0: 3 ports detected
[ 2.705066] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[ 2.815654] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[ 2.840869] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 2.878388] smsc95xx v1.0.4
[ 2.953582] smsc95xx 1-1.1:1.0 eth0: register ‘smsc95xx’ at usb-20980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:a5:0d:22
[ 3.075155] usb 1-1.3: new high-speed USB device number 4 using dwc_otg
[ 4.061526] udevd[159]: starting version 175
[ 5.469086] gpiomem-bcm2835 20200000.gpiomem: Initialised: Registers at 0x20200000
[ 8.206229] usb 1-1.3: New USB device found, idVendor=0cf3, idProduct=9271
[ 8.220185] usb 1-1.3: New USB device strings: Mfr=16, Product=32, SerialNumber=48
[ 8.234649] usb 1-1.3: Product: USB2.0 WLAN
[ 8.245560] usb 1-1.3: Manufacturer: ATHEROS
[ 8.256349] usb 1-1.3: SerialNumber: 12345
[ 8.517410] cfg80211: Calling CRDA to update world regulatory domain
[ 8.805672] usb 1-1.3: ath9k_htc: Firmware htc_9271.fw requested
[ 8.822353] usbcore: registered new interface driver ath9k_htc
[ 8.921567] cfg80211: World regulatory domain updated:
[ 8.934219] cfg80211: DFS Master region: unset
[ 8.938859] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[ 8.962590] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[ 8.977490] cfg80211: (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[ 8.992707] cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[ 9.007753] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[ 9.024552] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[ 9.041143] cfg80211: (5490000 KHz - 5730000 KHz @ 160000 KHz), (N/A, 2000 mBm), (0 s)
[ 9.057784] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[ 9.073152] cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[ 9.185816] usb 1-1.3: ath9k_htc: Transferred FW: htc_9271.fw, size: 51272
[ 9.374355] random: nonblocking pool is initialized
[ 9.431763] ath9k_htc 1-1.3:1.0: ath9k_htc: HTC initialized with 33 credits
[ 11.874176] ath9k_htc 1-1.3:1.0: ath9k_htc: FW Version: 1.3
[ 11.887891] ath9k_htc 1-1.3:1.0: FW RMW support: Off
[ 11.909684] ath: EEPROM regdomain: 0x809c
[ 11.909764] ath: EEPROM indicates we should expect a country code
[ 11.909784] ath: doing EEPROM country->regdmn map search
[ 11.909797] ath: country maps to regdmn code: 0x52
[ 11.909813] ath: Country alpha2 being used: CN
[ 11.909825] ath: Regpair used: 0x52
[ 12.057159] ieee80211 phy0: Atheros AR9271 Rev:1
[ 12.092366] cfg80211: Calling CRDA for country: CN
[ 12.424255] cfg80211: Calling CRDA for country: CN
[ 12.531118] cfg80211: Current regulatory domain intersected:
[ 12.568106] cfg80211: DFS Master region: unset
[ 12.587937] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[ 12.705300] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[ 12.767037] cfg80211: (2457000 KHz - 2482000 KHz @ 25000 KHz), (N/A, 2000 mBm), (N/A)
[ 12.837836] cfg80211: (2474000 KHz - 2482000 KHz @ 8000 KHz), (N/A, 2000 mBm), (N/A)
[ 12.959318] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)
[ 13.115852] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)
[ 13.165315] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[ 13.238277] cfg80211: (57240000 KHz - 59400000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[ 13.343290] cfg80211: (59400000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[ 14.633954] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ 15.594790] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ 32.522476] smsc95xx 1-1.1:1.0 eth0: hardware isn’t capable of remote wakeup
[ 36.275830] wlan0: authenticate with 64:66:b3:f4:35:f8
[ 37.293761] wlan0: send auth to 64:66:b3:f4:35:f8 (try 1/3)
[ 37.305613] wlan0: authenticated
[ 37.305918] ath9k_htc 1-1.3:1.0 wlan0: disabling HT/VHT due to WEP/TKIP use
[ 37.315291] wlan0: associate with 64:66:b3:f4:35:f8 (try 1/3)
[ 37.318988] wlan0: RX AssocResp from 64:66:b3:f4:35:f8 (capab=0x411 status=12 aid=1)
[ 37.319090] wlan0: 64:66:b3:f4:35:f8 denied association (code=12)
[ 40.202031] wlan0: authenticate with 64:66:b3:f4:35:f8
[ 41.206304] wlan0: send auth to 64:66:b3:f4:35:f8 (try 1/3)
[ 41.208623] wlan0: authenticated
[ 41.215076] wlan0: associate with 64:66:b3:f4:35:f8 (try 1/3)
[ 41.219395] wlan0: RX AssocResp from 64:66:b3:f4:35:f8 (capab=0x411 status=0 aid=1)
[ 41.243935] wlan0: associated
[ 41.247616] cfg80211: Calling CRDA for country: US
[ 41.326814] cfg80211: Regulatory domain changed to country: US
[ 41.326959] cfg80211: DFS Master region: unset
[ 41.327279] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[ 41.327309] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 3000 mBm), (N/A)
[ 41.327375] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 1700 mBm), (N/A)
[ 41.327404] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz, 160000 KHz AUTO), (N/A, 2300 mBm), (0 s)
[ 41.327424] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 3000 mBm), (N/A)
[ 41.327440] cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
[ 53.053825] Adding 102396k swap on /var/swap. Priority:-1 extents:1 across:102396k SSFS
root@dietpi:~#

Hi,

Where can I find the wpa_supplicant.conf file? In it there should be a line:

Country code

The ISO/IEC alpha2 country code for the country in which this device is

currently operating.

#country=US

My wireless AP router was set to US. If I set that to CA then on boot it goes World,CN,CA. I guess it picks up the country from the router.

Gordon Williams

Some more info:

The ath9k driver (and all other softmac drivers?) sets its own regulatory restrictions based on its EEPROM, i.e. the ART (Atheros Radio Test) partition on flash. Setting the domain from userland can only further restrict the regulatory settings. So if EEPROM says Japan, you can use all 14 channels, if you then set it to US, you can use merely the 12. It does not work the other way around, i.e. if EEPROM says US, you only can use the allowed 12 channels, no matter what you set in userspace! The value 98 represents a synthesized regulatory domain, based on the intersection of the available source of regulatory information (which can include the EEPROM, the userland setting, and a country IE from your AP).

It looks like when it goes World,CN,CA it takes an intersection of all these domains to find the regulatory environment that fits them all.

If I go:
root@dietpi:~# iw reg get
country CA:
(2402 - 2472 @ 40), (N/A, 30)
(5170 - 5250 @ 80), (N/A, 17)
(5250 - 5330 @ 80), (N/A, 24), DFS
(5490 - 5730 @ 160), (N/A, 24), DFS
(5735 - 5835 @ 80), (N/A, 30)

now if I set it to JP for instance:
root@dietpi:~# iw reg set JP

root@dietpi:~# iw reg get
country 98:
(2402 - 2472 @ 40), (N/A, 20)
(5170 - 5250 @ 80), (N/A, 17)
(5250 - 5330 @ 80), (N/A, 20), DFS
(5490 - 5710 @ 160), (N/A, 23), DFS

If I try and set it back to CA it stays at “country 98” which an intersection of the valid regulations for both CA and JP

Hi Gordon,

Thanks for the updates, and interesting find.

What we know:

  • /etc/default/crda has no effect on crda or setting country code.
  • CRDA seems to revert to a failsafe. No country code set = Country 00 (failsafe)
  • We can run iw reg set to manually set country code.

Option 1:
The blacklist works for me. Disables the cfg80211 module:
run lsmod to see if the module is loaded, before and after. Make sure you reboot after running the below code.

echo -e "blacklist cfg80211" > /etc/modprobe.d/blacklist-cfg80211.conf

Option 2:
Use the DietPi Wheezy image which has none of this crda stuff. We still support Wheezy (i prefer it personally).

Option 3:
Add the following command to a boot script:

iw reg set CA

Hi,

Whether or not I have the blacklist, I get the same lsmod shown below:

root@dietpi:~# lsmod
Module Size Used by
ctr 4001 1
ccm 8278 1
snd_bcm2835 22317 0
snd_pcm 92581 1 snd_bcm2835
snd_timer 23454 1 snd_pcm
snd 68161 3 snd_bcm2835,snd_timer,snd_pcm
arc4 1972 2
ath9k_htc 62678 0
ath9k_common 26119 1 ath9k_htc
ath9k_hw 469847 2 ath9k_common,ath9k_htc
ath 22870 3 ath9k_common,ath9k_htc,ath9k_hw
mac80211 622304 1 ath9k_htc
cfg80211 499834 4 ath,ath9k_common,mac80211,ath9k_htc
rfkill 22491 2 cfg80211
bcm2835_gpiomem 3703 0
uio_pdrv_genirq 3690 0
uio 10002 1 uio_pdrv_genirq

Does this match yours?

Maybe I haven’t got the black list correctly set?
in file:
/etc/modprobe.d/blacklist-cfg80211.conf
I have on the first line:
blacklist cfg80211

Gordon Williams

Hi Gordon,

cfg80211 499834 4 ath,ath9k_common,mac80211,ath9k_htc

>

This is strange. As the cfg80211 module states it being used by the ath devices, it appears your Atheros card is overriding the blacklisted module in some way?

Maybe try blacklisting the mac80211 module aswell?

**Try running the following to see if yours returns the same value:**

```text
root@DietPi:~# cat /etc/modprobe.d/blacklist-cfg80211.conf
blacklist cfg80211

Before Blacklist:

root@DietPi:~# lsmod
Module                  Size  Used by
ecb                     2035  0
md4                     3386  0
nls_utf8                1173  1
cifs                  383469  2
cfg80211              420690  0
rfkill                 16659  2 cfg80211
8192cu                528485  0
sg                     18159  0
bcm2835_gpiomem         2995  0
uio_pdrv_genirq         2966  0
uio                     8235  1 uio_pdrv_genirq
snd_bcm2835            19769  0
snd_pcm                74825  1 snd_bcm2835
snd_timer              18157  1 snd_pcm
snd                    52116  3 snd_bcm2835,snd_timer,snd_pcm
fuse                   81710  1
root@DietPi:~# echo -e "blacklist cfg80211" > /etc/modprobe.d/blacklist-cfg80211.conf

After Blacklist:

root@DietPi:~# lsmod
Module                  Size  Used by
ecb                     2035  0
md4                     3386  0
nls_utf8                1173  1
cifs                  383469  2
8192cu                528485  0
sg                     18159  0
bcm2835_gpiomem         2995  0
uio_pdrv_genirq         2966  0
uio                     8235  1 uio_pdrv_genirq
snd_bcm2835            19769  0
snd_pcm                74825  1 snd_bcm2835
snd_timer              18157  1 snd_pcm
snd                    52116  3 snd_bcm2835,snd_timer,snd_pcm
fuse                   81710  1

My blacklist was exactly the same as your for cfg80211.

I have added:
root@dietpi:~# cat /etc/modprobe.d/blacklist-mac80211.conf
blacklist mac80211

I get the same sequence in dmesg.

and

root@dietpi:~# lsmod
Module Size Used by
ctr 4001 1
ccm 8278 1
snd_bcm2835 22317 0
snd_pcm 92581 1 snd_bcm2835
snd_timer 23454 1 snd_pcm
snd 68161 3 snd_bcm2835,snd_timer,snd_pcm
arc4 1972 2
ath9k_htc 62678 0
ath9k_common 26119 1 ath9k_htc
ath9k_hw 469847 2 ath9k_common,ath9k_htc
ath 22870 3 ath9k_common,ath9k_htc,ath9k_hw
mac80211 622304 1 ath9k_htc
cfg80211 499834 4 ath,ath9k_common,mac80211,ath9k_htc
rfkill 22491 2 cfg80211
bcm2835_gpiomem 3703 0
uio_pdrv_genirq 3690 0
uio 10002 1 uio_pdrv_genirq

so the blacklist is not doing it’s work.

I had made a post about some other ideas, but something glitched when I submitted it and everything was lost. Will try again.
Gordon

If I don’t have crda then I will get a dmesg like the first post with multiple calls to update CRDA that go unanswered until it times out.

As a newbee, you will have to tell me what boot script I should try adding the iw command.

A couple of other thoughts:

  1. looking at the dmesg a few things are unclear. It connects to the wireless at around 41 seconds, but before that time
    [ 8.538025] cfg80211: Calling CRDA to update world regulatory domain

    [ 8.952880] cfg80211: World regulatory domain updated:

    [ 12.171573] cfg80211: Calling CRDA for country: CN
    [ 12.386345] cfg80211: Calling CRDA for country: CN
    [ 12.559086] cfg80211: Current regulatory domain intersected:

Then wireless router association and authentication followed by
[ 41.232623] cfg80211: Calling CRDA for country: CA
[ 41.309597] cfg80211: Regulatory domain changed to country: CA

For the world and CN, with no internet connection, I’m not sure what they are calling and who is answering!

The regulatory domain change to CA comes from the the wireless router regulatory domain setting. That info get transmitted to the rPi.

  1. If I run crda

root@dietpi:~# crda
COUNTRY environment variable not set.

if I add a country environment variable:
root@dietpi:~# export COUNTRY=CA
root@dietpi:~# echo $COUNTRY
CA
root@dietpi:~# crda
Failed to set regulatory domain: -7

You are not supposed to run crda from the command line according to the docs. But this does show that the new COUNTRY variable is being read and then rejected as the kernel is not supposed to make changes for unexpected requests.

How can one set an environment variable early during the boot process (newbee here)? As we have seen, crda is not reading the config file in /etc/default.

Gordon

From the CRDA man pages:
NAME
crda - send to the kernel a wireless regulatory domain for a given ISO
/ IEC 3166 alpha2

SYNOPSIS
crda

Description
crda is the Linux wireless central regulatory domain agent. crda is
intended to be used by udev scripts and should not be run manually
unless debugging udev scripts. crda is triggered to run by the kernel
by sending a udev event upon a new regulatory domain change. Regulatory
domain changes are triggered by the wireless kernel subsystem (upon
initialization and on reception of country IEs), wireless drivers, or
userspace (see iw ). Upon a regulatory domain change the kernel sends a
udev change event for the regulatory platform. The kernel ignores regu‐
latory domains sent to it if it does not expect them. The regulatory
domain is read by crda from the regulatory.bin file.

RSA Digital Signature
If built with openssl or gcrypt support crda will have embedded into it
an RSA digital signature which will prevent it from reading corrupted
or non-authored regulatory.bin files. Authorship is respected by the
RSA public key packed into crda. This specific crda package has been
built with an RSA public key from John Linville (the Linux wireless
kernel maintainer) and as such will only read regulatory.bin files
signed by him. For further information see the regulatory.bin man page.

UDEV RULE
A udev regulatory rule must be put in place in order to receive and
parse udev events from the kernel in order to get udev to call crda
with the passed ISO / IEC 3166 alpha2 country code. An example udev
rule which can be used (usually in /lib/udev/rules.d/85-regula‐
tory.rules ):

KERNEL==“regulatory*”, ACTION==“change”, SUBSYSTEM==“platform”,
RUN+="/sbin/crda"

Environment variable
Set the COUNTRY environment variable with a specific ISO / IEC 3166
alpha2 country code and then run crda without arguments. This will send
a regulatory domain for that alpha2 to the kernel.

SEE ALSO
iw(8) regulatory.bin(5)

http://wireless.kernel.org/en/developers/Regulatory/


in the crda.c file they look for a country code

env_country = getenv(“COUNTRY”);
if (!env_country) {
fprintf(stderr, “COUNTRY environment variable not set.\n”);
return -EINVAL;
}

if (!reglib_is_valid_regdom(env_country)) {
fprintf(stderr, "COUNTRY environment variable must be an "
“ISO ISO 3166-1-alpha-2 (uppercase) or 00\n”);
return -EINVAL;
}

but dietpi does not have one set so an invalid argument is returned. (BTW, I don’t know C so I’m guessing somewhat)

Gordon