jbum
Posts: 7
Joined: Mon Nov 28, 2016 12:39 am

Raspbian Stretch - ifconfig wlan0 up not getting IP

Fri Jan 18, 2019 9:09 pm

I have read through all related posts but still cannot figure this out yet.

I have the following:
  • RPi 2 (fresh install of Raspbian Stretch)
  • RPi 2 (Raspbian Stretch upgraded from Jessie)
  • RPi Zero W (fresh install of Raspbian Stretch)
I am not having any issues with the two systems where I have installed fresh copies of Raspbian Stretch. The problem only exists on the system where I upgraded Jessie to Stretch.

I am able to get a Wifi connection (wlan0) when the system is started or rebooted. However, I am not able to regain the connection when issuing

Code: Select all

$ sudo ifconfig wlan0 down
$ sudo ifconfig wlan0 up
When I still had Jessie installed, this was working without a hitch. It's only after the upgrade when it stopped working. Again, on the systems where I have installed Stretch as a fresh installation, this works so I'm at a loss as to what is wrong (or different).

System information is as follows.

Code: Select all

$ uname -a
Linux raspberrypi 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux

Code: Select all

$ lsusb
Bus 001 Device 006: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
Bus 001 Device 005: ID 0781:5583 SanDisk Corp. 
Bus 001 Device 004: ID 04d9:1203 Holtek Semiconductor, Inc. Keyboard
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Code: Select all

$ lsmod
Module                  Size  Used by
8192cu                589824  0
evdev                  24576  2
sg                     28672  0
cfg80211              573440  1 8192cu
rfkill                 28672  3 cfg80211
snd_bcm2835            32768  0
snd_pcm                98304  1 snd_bcm2835
snd_timer              32768  1 snd_pcm
snd                    69632  3 snd_timer,snd_bcm2835,snd_pcm
uio_pdrv_genirq        16384  0
fixed                  16384  0
uio                    20480  1 uio_pdrv_genirq
ip_tables              24576  0
x_tables               32768  1 ip_tables
ipv6                  425984  46

Code: Select all

$ sudo cat /etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

Code: Select all

$ sudo cat /etc/network/interfaces.d/wlan0 
auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet dhcp

allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Code: Select all

$ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="<ssid value>"
    psk=<encrypted passphrase using wpa_passphrase>
}
When the connection is made,

Code: Select all

$ sudo ifconfig wlan0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.10  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::265c:712c:fc23:cb08  prefixlen 64  scopeid 0x20<link>
        inet6 2601:646:9301:dcb0::2  prefixlen 128  scopeid 0x0<global>
        inet6 2601:646:9301:dcb0:8a43:9c42:6c0d:9ef2  prefixlen 64  scopeid 0x0<global>
        ether 74:da:38:6b:a5:11  txqueuelen 1000  (Ethernet)
        RX packets 23100  bytes 3997720 (3.8 MiB)
        RX errors 0  dropped 16  overruns 0  frame 0
        TX packets 2018  bytes 337655 (329.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


$ sudo iwconfig wlan0
wlan0     IEEE 802.11bgn  ESSID:"<ssid value>"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:2.462 GHz  Access Point: 20:10:7A:18:CE:EF   
          Bit Rate:72.2 Mb/s   Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:****-****-****-****-****-****-****-****   Security mode:open
          Power Management:off
          Link Quality=100/100  Signal level=66/100  Noise level=0/100
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0
So after an ifconfig down / up, this is what I see... but no IP is obtained. Hoping someone can help troubleshoot this. I would rather not reinstall (fresh) just to get this piece working. Thanks.

Code: Select all

wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 74:da:38:6b:a5:11  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 29328 (28.6 KiB)
        RX errors 0  dropped 40  overruns 0  frame 0
        TX packets 0  bytes 25742 (25.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


jbum
Posts: 7
Joined: Mon Nov 28, 2016 12:39 am

Re: Raspbian Stretch - ifconfig wlan0 up not getting IP

Fri Jan 18, 2019 9:53 pm

Thanks for the suggestion. I applied the wifi country but that still doesn't change anything. Also, the other systems that work do NOT have the wifi country set in wpa_supplicant.conf. So that doesn't appear to be a factor here.

Code: Select all

$ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
	ssid="<ssid value>"
	psk=<encrypted passphrase>
}

User avatar
DougieLawson
Posts: 42760
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: Raspbian Stretch - ifconfig wlan0 up not getting IP

Fri Jan 18, 2019 10:21 pm

What security does your AP use? Is it WPA or WPA2? Is it old, insecure, deprecated WEP?
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

jbum
Posts: 7
Joined: Mon Nov 28, 2016 12:39 am

Re: Raspbian Stretch - ifconfig wlan0 up not getting IP

Fri Jan 18, 2019 10:55 pm

It's using WPA2.

jbum
Posts: 7
Joined: Mon Nov 28, 2016 12:39 am

Re: Raspbian Stretch - ifconfig wlan0 up not getting IP

Sat Jan 19, 2019 9:55 pm

So reinstall? I don’t think i have a lot to back up so I might go that route.

jbum
Posts: 7
Joined: Mon Nov 28, 2016 12:39 am

Re: Raspbian Stretch - ifconfig wlan0 up not getting IP

Mon Jan 21, 2019 6:16 am

Just an update. I reinstalled a fresh copy of Stretch but the same symptoms were seen using ifdown/ifup. A crude workaround for now is to do the following.

Code: Select all

sudo ifconfig wlan0 down
sudo rmmod 8192cu
sudo modprobe 8192cu
This successfully initializes everything and I'm able to obtain an IP. This really is a sledgehammer approach though.

Anyway, I did notice that there is an error when I issue an "ifconfig wlan0 down". Can anyone make sense of what it says?

Code: Select all

Jan 20 21:57:13 raspberrypi avahi-daemon[309]: Interface wlan0.IPv6 no longer releva
nt for mDNS.
Jan 20 21:57:13 raspberrypi avahi-daemon[309]: Leaving mDNS multicast group on inter
face wlan0.IPv6 with address 2601:646:9301:dcb0:a10f:47ae:d15a:6e1b.
Jan 20 21:57:13 raspberrypi dhcpcd[420]: wlan0: carrier lost
Jan 20 21:57:13 raspberrypi avahi-daemon[309]: Interface wlan0.IPv4 no longer releva
nt for mDNS.
Jan 20 21:57:13 raspberrypi kernel: [  107.411845] ------------[ cut here ]---------
---
Jan 20 21:57:13 raspberrypi kernel: [  107.412489] WARNING: CPU: 2 PID: 87 at net/wireless/sme.c:981 __cfg80211_disconnected+0x4b0/0x500 [cfg80211]
Jan 20 21:57:13 raspberrypi kernel: [  107.412546] Modules linked in: 8192cu evdev cfg80211 sgrfkill snd_bcm2835(C) snd_pcm snd_timer snd uio_pdrv_genirq fixed uio ip_tables x_tables ipv6
 Jan 20 21:57:13 raspberrypi kernel: [  107.412662] CPU: 2 PID: 87 Comm: kworker/u8:2
  Tainted: G         C      4.14.79-v7+ #1159
  Jan 20 21:57:13 raspberrypi kernel: [  107.412675] Hardware name: BCM2835
  Jan 20 21:57:13 raspberrypi kernel: [  107.413113] Workqueue: cfg80211 cfg80211_event_work [cfg80211]
  Jan 20 21:57:13 raspberrypi kernel: [  107.413182] [<8010ff30>] (unwind_backtrace) from [<8010c174>] (show_stack+0x20/0x24)
  Jan 20 21:57:13 raspberrypi kernel: [  107.413206] [<8010c174>] (show_stack) from [<80788fa4>] (dump_stack+0xd4/0x118)
  Jan 20 21:57:13 raspberrypi kernel: [  107.413229] [<80788fa4>] (dump_stack) from [<8011dd50>] (__warn+0xf8/0x110)
  Jan 20 21:57:13 raspberrypi kernel: [  107.413251] [<8011dd50>] (__warn) from [<8011de38>] (warn_slowpath_null+0x30/0x38)
  Jan 20 21:57:13 raspberrypi kernel: [  107.413627] [<8011de38>] (warn_slowpath_null) from [<7f19c694>] (__cfg80211_disconnected+0x4b0/0x500 [cfg80211])
   Jan 20 21:57:13 raspberrypi kernel: [  107.414374] [<7f19c694>] (__cfg80211_disconnected [cfg80211]) from [<7f16fefc>] (cfg80211_process_wdev_events+0x144/0x14c [cfg80211])
   Jan 20 21:57:13 raspberrypi kernel: [  107.415084] [<7f16fefc>] (cfg80211_process_wdev_events [cfg80211]) from [<7f16ff40>] (cfg80211_process_rdev_events+0x3c/0x70 [cfg80211])
   Jan 20 21:57:13 raspberrypi kernel: [  107.415689] [<7f16ff40>] (cfg80211_process_rdev_events [cfg80211]) from [<7f16a294>] (cfg80211_event_work+0x24/0x2c [cfg80211])
      Jan 20 21:57:13 raspberrypi kernel: [  107.415978] [<7f16a294>] (cfg80211_event_work [cfg80211]) from [<801379b4>] (process_one_work+0x158/0x454)
   Jan 20 21:57:13 raspberrypi kernel: [  107.416000] [<801379b4>] (process_one_work) from [<80137d14>] (worker_thread+0x64/0x5b8)
   Jan 20 21:57:13 raspberrypi kernel: [  107.416022] [<80137d14>] (worker_thread) from [<8013dd98>] (kthread+0x13c/0x16c)
   Jan 20 21:57:13 raspberrypi kernel: [  107.416045] [<8013dd98>] (kthread) from [<801080ac>] (ret_from_fork+0x14/0x28)
   Jan 20 21:57:13 raspberrypi kernel: [  107.416060] ---[ end trace 5265c3cc1f7c01c7 ]---
   Jan 20 21:57:13 raspberrypi avahi-daemon[309]: Leaving mDNS multicast group on interface wlan0.IPv4 with address 192.168.0.10.
   Jan 20 21:57:13 raspberrypi avahi-daemon[309]: Withdrawing address record for 2601:646:9301:dcb0::5 on wlan0.
   Jan 20 21:57:13 raspberrypi avahi-daemon[309]: Withdrawing address record for 2601:646:9301:dcb0:a10f:47ae:d15a:6e1b on wlan0.
   Jan 20 21:57:13 raspberrypi avahi-daemon[309]: Withdrawing address record for 192.168.0.10 on wlan0.
   Jan 20 21:57:14 raspberrypi dhcpcd[420]: wlan0: deleting address 2601:646:9301:dcb0::5/128
   Jan 20 21:57:14 raspberrypi dhcpcd[420]: wlan0: deleting address 2601:646:9301:dcb0:a10f:47ae:d15a:6e1b/64
   Jan 20 21:57:14 raspberrypi dhcpcd[420]: wlan0: deleting default route via fe80::e683:99ff:fea0:66e3
   Jan 20 21:57:14 raspberrypi dhcpcd[420]: wlan0: deleting route to 2601:646:9301:dcb0::/64
   Jan 20 21:57:14 raspberrypi dhcpcd[420]: wlan0: deleting address fe80::304a:ecfe:714b:15d8
   Jan 20 21:57:14 raspberrypi dhcpcd[420]: wlan0: deleting default route via 192.168.0.1
   Jan 20 21:57:14 raspberrypi dhcpcd[420]: wlan0: deleting route to 192.168.0.0/24

Return to “Troubleshooting”