When you connect to the Raspberry Pi via terminal session you can get the following warning message:
Wi-Fi is disabled because the country is not set. Use raspi-config to set the country before use.
Running raspi-config may not fix the problem.
The warning message is originated by the script /etc/profile.d/wifi-country.sh which uses the following command to check if WiFi has the country set:
/sbin/iw reg get
The execution of raspi-config, Localisation Options ⇒ Change Wi-fi Country should change the file /etc/wpa_supplicant/wpa_supplicant.conf, but such a change is possibile only if you already have the following lines in that file:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1
The update_config option allow wpa_cli to change the configuration file, and thus raspi-config. The change consists just in adding a line like this:
Reboot or restart the wpa_supplicant daemon to make the changes effective.