2

I was trying to set up an ad-hoc network on my Raspberry Pi 4 and now the WiFi is not working. If I try to run ifconfig there is no wlan0 interface that shows up. I have also tried to manually change the WiFi settings but it gives the error message "Could not communicate with wpa_supplicant". When I hover my mouse over the WiFi GUI, it gives me the error message "Connection to dhcpcd lost". I have gone through the /etc/network/interfaces file and deleted all the changes that I made to it and rebooted, but still not change. Does anyone else have any ideas on how to fix this?

user110896
  • 29
  • 1
  • 2
  • *Does anyone else have any ideas on how to fix this?* - **NO** because we don't know what **YOU** did. – Milliways Nov 06 '19 at 06:35
  • Just plain `ifconfig` only shows interfaces in an "up" state. To see all interfaces use `ifconfig -a` or `ip link`. – goldilocks Nov 06 '19 at 15:20

2 Answers2

2

I got the same message "Connection to dhcpcd lost" after the following:

  • my rpi shut down in the middle of running any process.
  • At starting not loaded kernels correctly, the gui login was not shown, only command line. I solved this running:

.

# apt-get update
# dpkg --configure -a
# apt-get dist-upgrade
# apt-get -f install

The gui login was repaired. But the network gui had problems connecting to my wifi modem, my rpi only was loading and never finished, the wifi animation was changing all the time, never connected.

I tried to change the configurations "Wireless & Wired Network Settings", typing static IP, Router, DNS Servers, DNS Search. It only one time worked, but the next time returned to perform rarely without getting connection again despite many attempts of writting static data.

After a while, and looking for on internet I found that my configuration file /etc/dhcpcd.conf had written many times the same network but not indicated interface, something like this:

SSID MY_NETWORK
static ip_address=192.168.0.2
static routers=192.168.0.1 
static domain_name_servers=8.8.8.8 
static domain_search=8.8.4.4

SSID MY_NETWORK
static ip_address=192.168.0.3
static routers=192.168.0.1 
static domain_name_servers=8.8.8.8 
static domain_search=8.8.4.4

SSID MY_NETWORK
static ip_address=192.168.0.4
static routers=192.168.0.1 
static domain_name_servers=8.8.8.8 
static domain_search=8.8.4.4

SSID MY_NETWORK-5G
static ip_address=192.168.0.2
static routers=192.168.0.1 
static domain_name_servers=8.8.8.8 
static domain_search=8.8.4.4

SSID MY_NETWORK-5G
static ip_address=192.168.0.3
static routers=192.168.0.1 
static domain_name_servers=8.8.8.8 
static domain_search=8.8.4.4

SSID MY_NETWORK-5g
static ip_address=192.168.0.4
static routers=192.168.0.1 
static domain_name_servers=8.8.8.8 
static domain_search=8.8.4.4

I deleted the previous configuration and only wrote this:

interface wlan0
SSID MY-NETWORK
static ip_address=192.168.0.15/24
static routers=192.168.0.1 
static domain_name_servers=8.8.8.8 
static domain_search=8.8.4.4

interface wlan0
SSID MY-NETWORK-5G
static ip_address=192.168.0.15/24
static routers=192.168.0.1
static domain_name_servers=8.8.8.8
static domain_search=8.8.4.4

Rebooted and and now it's working properly. I hope this helps someone

1

I assume you are using Raspbian. On this, dhcpcd is configured to support normal networking out of the box, e.g. use WiFi in managed mode with hook scripts in /lib/dhcpcd/dhcpcd-hooks/. I'm fairly sure that dhcpcd does not support an ad-hoc network with this configuration so you have to do it all by hand.

I suggest to use systemd-networkd to setup an ad-hoc network because it is strait forward and can do very good "unusual" networking. Look at How to setup an unprotected Ad Hoc (IBSS) Network and if possible with WPA encryption?.

Ingo
  • 40,606
  • 15
  • 76
  • 189