rpihotspot: Valid country code refused
Using the following command:
sudo ./setup-network.sh --install --ap-ssid="<ssid>" --ap-password="<pass>" --ap-country-code="FR"
The script refuses the country code, which is valid:
Invalid Access Point(AP) setup options are specified for installation.
Please provide the below [OPTION] for installation:
============================================================================
--ap-country-code Optional field for installation: Set Access Point(AP) Country Code. Default value is: IN.
Make sure that the entered Country Code matches WiFi Country Code if it exists in /etc/wpa_supplicant/wpa_supplicant.conf
Allowed Country codes are:
AD, AE, AF, AG, AI, AL, AM, AO, AQ, AR, AS, AT, AU, AW, AX, AZ, BA, BB, BD, BE, BF, BG, BH, BI, BJ, BL, BM, BN, BO, BQ,
BR, BS, BT, BV, BW, BY, BZ, CA, CC, CD, CF, CG, CH, CI, CK, CL, CM, CN, CO, CR, CU, CV, CW, CX, CY, CZ, DE, DJ, DK, DM,
DO, DZ, EC, EE, EG, EH, ER, ES, ET, FI, FJ, FK, FM, FO, FR, GA, GB, GD, GE, GF, GG, GH, GI, GL, GM, GN, GP, GQ, GR, GS,
GT, GU, GW, GY, HK, HM, HN, HR, HT, HU, ID, IE, IL, IM, IN, IO, IQ, IR, IS, IT, JE, JM, JO, JP, KE, KG, KH, KI, KM, KN,
KP, KR, KW, KY, KZ, LA, LB, LC, LI, LK, LR, LS, LT, LU, LV, LY, MA, MC, MD, ME, MF, MG, MH, MK, ML, MM, MN, MO, MP, MQ,
MR, MS, MT, MU, MV, MW, MX, MY, MZ, NA, NC, NE, NF, NG, NI, NL, NO, NP, NR, NU, NZ, OM, PA, PE, PF, PG, PH, PK, PL, PM,
PN, PR, PS, PT, PW, PY, QA, RE, RO, RS, RU, RW, SA, SB, SC, SD, SE, SG, SH, SI, SJ, SK, SL, SM, SN, SO, SR, SS, ST, SV,
SX, SY, SZ, TC, TD, TF, TG, TH, TJ, TK, TL, TM, TN, TO, TR, TT, TV, TW, TZ, UA, UG, UM, US, UY, UZ, VA, VC, VE, VG, VI,
VN, VU, WF, WS, YE, YT, ZA, ZM, ZW
I check the script, this value is compared to the one in wpa_supplicant.conf
. But it is actually the same:
sudo cat /etc/wpa_supplicant/wpa_supplicant.conf | grep 'country=' | awk -F '=' '{print $2}'
FR
Notes:
- The Pi’s network was configured with the “headless” method (by creating wpa_supplicant.conf on the boot partition)
- This is a fresh install of Raspbian Buster
- I tried with other codes, same issue
Edit : the issue also occurs on Raspbian Stretch
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (11 by maintainers)
Commits related to this issue
- FIXED issue #12 to trim extra spaces — committed to idev1/rpihotspot by idev1 4 years ago
- Merge pull request #16 from remifleurance/patch-1 Fixed issue #12 valid country code refused — committed to idev1/rpihotspot by idev1 4 years ago
- Merge pull request #17 from idev1/rpihotspot-bugfixes Merged the fixed made by @remifleurance for issue #12 . — committed to idev1/rpihotspot by idev1 4 years ago
Thanks @ihorbond for re-verifying the recommended steps!
Just to inform you that, I have considered your suggestion and now the script can clean the previously configured AP IP address entries in /etc/hosts file 😃
Moreover, I have also implemented a logic to read the host name entry from in-built hostname utility and the host name now is not defaultly hard-coded as raspberrypi. Below given is the code which does this.
Also, all the bug fixes from branch rpihotspot-bugfixes have been merged into master branch and therefore, I am requesting you to use the master branch to re-verify if its solving your problems those you already reported.
Thanks Pankaj
@idev1 thanks, you are right, 192.168.1.X is reserved that’s why it wasn’t working. I got it all working now, thanks. What I meant by "your script overwrites it with default “raspberrypi” is that I renamed my hostname via raspi-config -> network options but after running your script and checking /etc/hosts the 127.0.0.1 and 10.0.0.1 entries were postfixed with default “raspberrypi”. I think they should follow the same hostname as in /etc/hostname
Hi @ihorbond
Thanks for using the script and reporting an issue!
For your 1st question, i can say that in most of the WiFi router cases where we suggest Raspberry Pi to connect to a specific SSID (to access internet) and if that external WiFi router uses a local subnet starting from range “192.168.X.Y” (where, “192.168” represent chosen reserved local IP subnet range, “X” normally represents the gateway number from where it will redirect the network traffic of local subnet and lastly, “Y” represents the number which will then be assigned to each devices which request the connection to the WiFi router).
Now, if your WiFi router uses the range for e.g., “192.168.1.Y” and if you are setting up the Access Point (AP) network using the same WiFi router range (as “192.168.1.Y”) then, the AP network IP addresses will conflict with your WiFi router IP address range and hence, here in this case, the script will throw an error (as you already mentioned) and abort the AP network setup.
For your second question on not cleaning previous entries in /etc/hosts file, yes, I do agree with you that, this piece of code should clean the entries which the script is presently unable to do but, I have noted down this point and in the future version of the script, I will provide code to resolve this observed issue. Moreover, you also said that the script is presently using a static hostname “raspberrypi” (defined in script variable
hostName="raspberrypi"
). This is the default hostname the present downloaded Raspbian OS uses and there is no provision given in the network setup script to consider this as an input option (which can be considered in good to have feature in future release of the script) but, to handle this situation currently, you can change the said “hostName” entry in the script to serve your purpose of network setup.Lastly, I will appreciate you to use the branch script which has many bug fixes related to Buster OS upgrade. Here are the steps to use the branch script.
Make any directory. For e.g.:
sudo mkdir rpihotspot-bugfixes
CD into the above directory:
cd rpihotspot-bugfixes
Run the following command to clone the suggested branch (in my previous post):
sudo git clone -b rpihotspot-bugfixes https://github.com/idev1/rpihotspot.git
Step 3 will create a local repo: “rpihotspot”. CD into this local repo directory.
cd rpihotspot
Run the below command to verify you cloned the correct repo. The return output of this command must return * rpihotspot-bugfixes which will indicate that, you correctly cloned the suggested branch.
sudo git branch
After that, you can assign the execute permission to script “./setup-network.sh”.
sudo chmod ug+x ./setup-network.sh
Finally, you can setup the network using the install examples present in “./readme.md”. I used the following command to successfully setup an Access Point network.
sudo ./setup-network.sh --install --ap-ssid="*****" --ap-password="*****" --ap-country-code="IN"
I hope, I tried my best to give the answers of your asked questions 😃
Thanks Pankaj