Solved "service netif restart" required on reboot

I can't seem to figure out why I have to use service netif restart every single time after I rebooted my system for the ifconfig to recognize (and make visible/accessible) my "wlan0".

This is the /etc/rc.conf
Code:
hostname="rpi-b"
ifconfig_DEFAULT="DHCP"
sshd_enable="YES"
sendmail_enable="NONE"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
growfs_enable="YES"
wlans_run0="wlan0"
ifconfig_wlan0="WPA DHCP" #Edited on post suggestion from SYNCDHCP
wpa_supplicant="YES"
wpa_supplicant_flags="-i wlan0 -c /etc/wpa_supplicant.conf"

And this is my /etc/wpa_supplicant.conf
Code:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=wheel
network={
    ssid="*****"
    psk="******"
}

I'm also adding the output for the service netif restart
Code:
$ sudo service netif restart
Stopping dhclient.
Stopping Network: lo0 ue0.
lo0: flags=8048<LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
    groups: lo
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
ue0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=80009<RXCSUM,VLAN_MTU,LINKSTATE>
    ether b8:27:eb:6f:b6:3d
    media: Ethernet autoselect (100baseTX <full-duplex>)
    status: active
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
Created wlan(4) interfaces: wlan0.
wpa_supplicant already running?  (pid=1133).
Starting Network: lo0 ue0 wlan0.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
    inet 127.0.0.1 netmask 0xff000000
    groups: lo
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
ue0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=80009<RXCSUM,VLAN_MTU,LINKSTATE>
    ether b8:27:eb:6f:b6:3d
    media: Ethernet autoselect (100baseTX <full-duplex>)
    status: active
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether c8:3a:35:c5:a9:66
    inet 192.168.1.145 netmask 0xffffff00 broadcast 192.168.1.255
    groups: wlan
    ssid ***** channel 6 (2437 MHz 11g) bssid c0:56:27:63:0e:3d
    regdomain FCC country US authmode WPA2/802.11i privacy ON
    deftxkey UNDEF AES-CCM 2:128-bit txpower 30 bmiss 7 scanvalid 60
    protmode CTS wme roaming MANUAL
    media: IEEE 802.11 Wireless Ethernet DS/1Mbps mode 11g
    status: associated
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

I'm adding the output for the dmesg bellow:
Code:
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2018 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
    The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.0-CURRENT #0 r336479: Thu Jul 19 15:30:30 UTC 2018
    root@releng3.nyi.freebsd.org:/usr/obj/usr/src/arm.armv6/sys/RPI-B arm
FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) (based on LLVM 6.0.1)
WARNING: WITNESS option enabled, expect reduced performance.
VT: init without driver.
CPU: ARM ARM1176 r0p7 (ECO: 0x00000000)
CPU Features:
  Thumb, Security, VMSAv7
Optional instructions:
  UMULL, SMULL, MLA, SIMD(ext)
  16KB/32B 4-way instruction cache
  16KB/32B 4-way WB data cache
real memory  = 0 (0 MB)
avail memory = 444571648 (423 MB)
random: unblocking device.
random: entropy device external interface
kbd0 at kbdmux0
ofwbus0: <Open Firmware Device Tree>
simplebus0: <Flattened device tree simple bus> on ofwbus0
intc0: <BCM2835 Interrupt Controller> mem 0x7e00b200-0x7e00b3ff on simplebus0
gpio0: <BCM2708/2835 GPIO controller> mem 0x7e200000-0x7e2000b3 irq 21,22,23,24 on simplebus0
gpio0: read-only pins: 46-53.
gpio0: reserved pins: 48-53.
gpiobus0: <OFW GPIO bus> on gpio0
systimer0 mem 0x7e003000-0x7e003fff irq 0,1,2,3 on simplebus0
Event timer "BCM2835-3" frequency 1000000 Hz quality 1000
Timecounter "BCM2835-3" frequency 1000000 Hz quality 1000
bcm_dma0: <BCM2835 DMA Controller> mem 0x7e007000-0x7e007eff irq 4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19 on simplebus0
bcmwd0: <BCM2708/2835 Watchdog> mem 0x7e100000-0x7e100027 on simplebus0
bcmrng0: <Broadcom BCM2835 RNG> mem 0x7e104000-0x7e10400f on simplebus0
mbox0: <BCM2835 VideoCore Mailbox> mem 0x7e00b880-0x7e00b8bf irq 20 on simplebus0
gpioc0: <GPIO controller> on gpio0
uart0: <PrimeCell UART (PL011)> mem 0x7e201000-0x7e201fff irq 25 on simplebus0
uart0: console (115200,n,8,1)
spi0: <BCM2708/2835 SPI controller> mem 0x7e204000-0x7e204fff irq 27 on simplebus0
spibus0: <OFW SPI bus> on spi0
iichb0: <BCM2708/2835 BSC controller> mem 0x7e205000-0x7e205fff irq 28 on simplebus0
sdhci_bcm0: <Broadcom 2708 SDHCI controller> mem 0x7e300000-0x7e3000ff irq 35 on simplebus0
mmc0: <MMC/SD bus> on sdhci_bcm0
iichb1: <BCM2708/2835 BSC controller> mem 0x7e804000-0x7e804fff irq 38 on simplebus0
iichb2: <BCM2708/2835 BSC controller> mem 0x7e805000-0x7e805fff irq 39 on simplebus0
bcm283x_dwcotg0: <DWC OTG 2.0 integrated USB controller (bcm283x)> mem 0x7e980000-0x7e98ffff irq 44 on simplebus0
usbus0 on bcm283x_dwcotg0
vchiq0: <BCM2835 VCHIQ> mem 0x7e00b840-0x7e00b84e irq 46 on simplebus0
vchiq: local ver 8 (min 3), remote ver 8.
pcm0: <VCHIQ audio> on vchiq0
vchiq1: <BCM2835 VCHIQ> mem 0x7e00b840-0x7e00b84e irq 47 on simplebus0
device_attach: vchiq1 attach returned 22
fb0: <BCM2835 VT framebuffer driver> on simplebus0
fbd0 on fb0
VT: initialize with new VT driver "fb".
fb0: 1824x984(1824x984@0,0) 24bpp
fb0: fbswap: 0, pitch 5472, base 0x1e6cd000, screen_size 5428224
cpulist0: <Open Firmware CPU Group> on ofwbus0
cpu0: <Open Firmware CPU> on cpulist0
gpioled0: <GPIO LEDs> on ofwbus0
cryptosoft0: <software crypto>
Timecounters tick every 1.000 msec
iicbus0: <OFW I2C bus> on iichb0
iic0: <I2C generic I/O> on iicbus0
usbus0: 480Mbps High Speed USB v2.0
ugen0.1: <DWCOTG OTG Root HUB> at usbus0
uhub0: <DWCOTG OTG Root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
mmcsd0: 16GB <SDHC NCard 1.0 SN 254225FB MFG 08/2013 by 130 JT> at mmc0 50.0MHz/4bit/65535-block
iicbus1: <OFW I2C bus> on iichb1
iic1: <I2C generic I/O> on iicbus1
iicbus2: <OFW I2C bus> on iichb2
iic2: <I2C generic I/O> on iicbus2
WARNING: WITNESS option enabled, expect reduced performance.
uhub0: 1 port with 1 removable, self powered
Trying to mount root from ufs:/dev/ufs/rootfs [rw]...
Warning: no time-of-day clock registered, system time will not be set accurately
ugen0.2: <vendor 0x0424 product 0x9512> at usbus0
uhub1 on uhub0
uhub1: <vendor 0x0424 product 0x9512, class 9/0, rev 2.00/2.00, addr 2> on usbus0
uhub1: MTT enabled
uhub1: 3 ports with 2 removable, self powered
ugen0.3: <vendor 0x0424 product 0xec00> at usbus0
smsc0 on uhub1
smsc0: <vendor 0x0424 product 0xec00, rev 2.00/2.00, addr 3> on usbus0
smsc0: chip 0xec00, rev. 0002
miibus0: <MII bus> on smsc0
ukphy0: <Generic IEEE 802.3u media interface> PHY 1 on miibus0
ukphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
ue0: <USB Ethernet> on smsc0
ue0: Ethernet address: b8:27:eb:6f:b6:3d
ugen0.4: <Ralink 802.11 n WLAN> at usbus0
lo0: link state changed to UP
smsc0: chip 0xec00, rev. 0002
ue0: link state changed to DOWN
ue0: link state changed to UP
run0 on uhub1
run0: <1.0> on usbus0
run0: MAC/BBP RT3070 (rev 0x0201), RF RT3020 (MIMO 1T1R), address c8:3a:35:c5:a9:66

What am I missing?
 
nactusberrilli ,
Right you are. It is suggested in the Wireless guide.
I have been struggling the last 3, or 4 days setting up a (wireless) connection from a laptop, and ran into some difficulties along the way. Depending on the connection/signal strength, has a direct affect upon the ability of the (net) init(8) to accomplish it's intended goal(s).
I know there's a (start) early/late tweak/option for this. But can't remember the specifics. I'll look, and post back. But someone more familiar may beat me to it. ;)
Does it work for you after changing SYNCDHCP to simply DHCP, as ShelLuser suggested?

--Chris
 
Does it work for you after changing SYNCDHCP to simply DHCP, as @ShelLuser suggested?
The change doesn't make any difference. It does not.

I'm going to edit my initial post to reflect the "whole" rc.conf. It seems I missed a few lines: just in case the
Code:
ifconfig_DEFAULT="DHCP"
might "feed" this problem. I have tried to comment out
Code:
ifconfig_DEFAULT="DHCP"
, and the DHCP allocation doesn't happen anymore. I can't ssh back into the device. I'd also like to point out that this is a Raspberry PI and I'm using the "run0" driver (a USB dongle). I have also updated the initial post to show my /etc/wpa_supplicant.conf and the output of the service netif restart.
 
Does the driver load some microcode? Might be someone starts the game too soon, when the thing is not done booting itself.
 
Does the driver load some microcode? Might be someone starts the game too soon, when the thing is not done booting itself.

The sysctl net.wlan.devices returns "run0" after a reboot (even before restarting netif), so I assume that the driver is fully loaded. I will edit my initial post to show the output of dmesg
 
This does not mean it is fully loaded by the time the first attempt is made. You would need some old-style printf debugging in the init scripts for that, I fear.
 
hah! I'm not opposed to old-style printf debugging scripting, however, ... I have no idea how to do that. Where do I start? :)
 
Back
Top