I have a raspberry pi 4 running raspberry pi os lite(headless). I have a wifi dongle attached to the pi for a better wifi signal (wlan1) as the built-in one was giving me issues, but I couldn't get wlan0 to connect to the network either. I'm using wpa_supplicant which worked perfect at my house but the location I'm at now has a hidden ssid and that seems to be the issue.
Ive tried using scan_ssid=1 which I thought would be the solution but it just didn't connect witch I thought to be very odd. I've tried adding a bunch of other options to get it to work such as 'proto', 'key_mgmt', 'pairwise' etc.
If I use sudo raspi-config to change the wifi network I get the error 'Could not communicate with wpa_supplicant' and 'There was an error running option N2 Wireless LAN'
here is the network configuration in /etc/wpa_supplicant...
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
network={
ssid="Hidden_Network"
scan_ssid=1
psk="password"
key_mgmt=WPA-PSK
}
output of 'ipa && ipr'
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 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 pfifo_fast state UP group default qlen 1000
link/ether b8:27:eb:bd:b8:c5 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.100/8 brd 10.255.255.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fe80::fb4:fdb9:f917:c380/64 scope link
valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether b8:27:eb:e8:ed:90 brd ff:ff:ff:ff:ff:ff
4: wlan1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether 84:16:f9:1a:1e:2e brd ff:ff:ff:ff:ff:ff
10.0.0.0/8 dev eth0 proto dhcp scope link src 10.0.0.100 metric 202
added lines to /etc/dhcpcd.conf...
interface eth0
metric 202
static ip_address=10.0.0.100
denyinterfaces wlan0
interface wlan1
metric 302
static ip_address=172.16.0.62
static domain_name_servers=1.1.1.1
static routers=172.16.0.1