1

My /etc/dhcpcd.conf file is configured so that if I manually run this wpa_supplicant command from the terminal:

wpa_supplicant -B -D nl80211 -P /var/run/wpaSupplicantPid.pid -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf

it fetches my static IP address and settings and I get connectivity. However, this is not automatic, and the connected state does not survive a reboot and I need to run this command again to get connectivity. If it survived the reboot, I wouldn't mind running the command once, so I presume this could be solved by altering the startup script, but that is beyond my scope of knowledge. I've also seen all the related questions about calling wpa_supplicant from the dhcpcd somehow using "hooks" (in quotes because I'm new to the term), but I have not been able to figure out how to configure a hook script to run the proper wpa_supplicant command. On startup, a wpa_supplicant command does execute, but it does not result in connectivity and I don't know where to find/alter it. Running ps -aux | grep supplicant with connectivity yields:

root      2364  0.0  0.0  44892  3100 ?        Ss   10:46   0:00 wpa_supplicant -B -D nl80211 -P /var/run/wpaSupplicantPid.pid -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf 
root      2843  0.0  0.0  21536  1056 pts/0    S+   11:17   0:00 grep --color=auto supplicant

and after reboot ps -aux | grep supplicant yields the following and there is no connectivity:

root       834  0.0  0.0  44752  2792 ?        Ss   11:19   0:00 /sbin/wpa_supplicant -u -s -O /run/wpa_supplicant
root      1972  0.0  0.0  21536  1032 pts/0    S+   11:20   0:00 grep --color=auto supplicant

Here is my /etc/dhcpcd.conf file:

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
#clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
duid

# Persist interface configuration when dhcpcd exits.
persistent
# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones    

slaac private
    noarp

    denyinterfaces eth0

    profile 10.1.3.1
    interface wlan0
    static ip_address=10.1.3.252/24
    static routers=10.1.3.1
    static domain_name_servers=8.8.8.8 8.8.4.4
    wpa_supplicant_start()
    env wpa_supplicant_conf=/etc/wpa_supplicant/wpa_supplicant.conf

My /etc/wpa_supplicant/wpa_supplicant.conf file contains:

network={
        ssid="myssid"
        #psk="mypassword"
        psk=dfda8d552e6e45de5d3fffcb4dcfa8383jdhst3674k9555507ece98c7952b7f6
}
country=US
ctrl_interface=/var/run/wpa_supplicant
update_config=1
Shmod
  • 13
  • 5

2 Answers2

0

See https://raspberrypi.stackexchange.com/a/37921/42636 for info on configuring networking. In your case I would set /etc/wpa_supplicant/wpa_supplicant.conf to:

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="SSID"
        psk="PASSWORD"
}

Undo all changes to /etc/dhcpcd.conf to get an DHCP address. For static address add the following to an unchanged /etc/dhcpcd.conf:

interface wlan0
static ip_address=10.1.3.252/24
static routers=10.1.3.1
static domain_name_servers=8.8.8.8 8.8.4.4
Dirk
  • 3,749
  • 3
  • 19
  • 27
0

I do not really understand all the trouble. Please flash an image from Raspbian Stretch 2018-06-27. Then you have the possibilities to setup wireless using the Desktop or the command line or doing a headless setup. How to do that you can look at the official documentation for Wireless connectivity.

Btw.: the line in your /etc/wpa_supplicant/wpa_supplicant.conf is wrong. It looks:

ctrl_interface=/var/run/wpa_supplicant

But it must look like this, including DIR=

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
Ingo
  • 42,961
  • 20
  • 87
  • 207