Wifi Not Auto Starting on Raspberry PI 3

676 views
Skip to first unread message

Jorge Corona

unread,
Dec 18, 2017, 7:27:43 PM12/18/17
to Mender List mender.io
Wifi works if I run "ifup wlan0" but it's not auto starting. I am puzzled to why that is. The interface face seems fine:

iface lo inet loopback
auto eth0
iface eth0 inet dhcp
# Wirelss Setup
auto wlan0
iface wlan0 inet static
        address 10.0.0.1
        netmask 255.255.255.0
        network 10.0.0.0
        broadcast 10.0.0.255


My local.conf addition for Mender/ Yocto are:
MENDER_ARTIFACT_NAME = "release-1a"
INHERIT += "mender-full"
MACHINE ?= "raspberrypi3"
MENDER_STORAGE_TOTAL_SIZE_MB = "3000"
MENDER_DATA_PART_SIZE_MB = "1000"
IMAGE_ROOTFS_MAXSIZE ?= "20000000"
MENDER_PARTITION_ALIGNMENT_KB = "4096"
MENDER_BOOT_PART_SIZE_MB = "40"
IMAGE_INSTALL_append = " kernel-image kernel-devicetree kernel-modules networkmanager iw php hostapd dnsmasq libmicrohttpd-dev wpa-supplicant linux-firmware init-ifupdown"
IMAGE_FSTYPES_remove += " rpi-sdimg"
DISTRO_FEATURES_append = " systemd wifi"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""
IMAGE_FSTYPES = "ext4"
KERNEL_IMAGETYPE = "uImage"

and bblayers.conf is:
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
  /home/ubuntu/pyro/poky/meta \
  /home/ubuntu/pyro/poky/meta-poky \
  /home/ubuntu/pyro/poky/meta-yocto-bsp \
  /home/ubuntu/pyro/openembedded-core/meta \
  /home/ubuntu/pyro/meta-openembedded/meta-oe \
  /home/ubuntu/pyro/meta-openembedded/meta-python \
  /home/ubuntu/pyro/meta-openembedded/meta-networking \
  /home/ubuntu/pyro/meta-raspberrypi \
  /home/ubuntu/pyro/meta-mender/meta-mender-core \
  /home/ubuntu/pyro/meta-mender/meta-mender-raspberrypi \
  /home/ubuntu/pyro/meta-mender/meta-mender-demo \
  /home/ubuntu/pyro/meta-kw \
  "

I have my custom layer as follows:

.
├── conf
│   └── layer.conf
├── COPYING.MIT
├── README
├── recipes-connectivity
│   ├── dnsmasq
│   │   ├── dnsmasq_%.bbappend
│   │   └── files
│   │       └── dnsmasq.conf
│   └── hostapd
│       ├── files
│       │   └── hostapd.conf
│       └── hostapd_%.bbappend
├── recipes-core
   ├── init-ifupdown
   │   ├── files
   │   │   └── interfaces
   │   └── init-ifupdown_%.bbappend
   └── startup.bb


I want to make the pi an access point and am not sure if that is why the wlan0 is not starting up or if their something else that is wrong?

Drew Moseley

unread,
Dec 18, 2017, 8:00:04 PM12/18/17
to men...@lists.mender.io

I don't think you should be installing init-ifupdown; how and why it appears to be working for you I cannot say.  With systemd-networkd enabled, that should handle the bulk of the automatic network initialization.  You will need to install the linux-firmware-bcm43430 package to get the driver and you will also need to setup an appropriate wpa_supplicant.conf file for your AP.

Drew

--
You received this message because you are subscribed to the Google Groups "Mender List mender.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mender+un...@lists.mender.io.
To post to this group, send email to men...@lists.mender.io.
Visit this group at https://groups.google.com/a/lists.mender.io/group/mender/.

Mirza Krak

unread,
Dec 19, 2017, 2:53:20 AM12/19/17
to mender
2017-12-19 1:27 GMT+01:00 Jorge Corona <ikkys...@gmail.com>:
> Wifi works if I run "ifup wlan0" but it's not auto starting. I am puzzled to
> why that is. The interface face seems fine:
>
>> iface lo inet loopback
>> auto eth0
>> iface eth0 inet dhcp
>> # Wirelss Setup
>> auto wlan0
>> iface wlan0 inet static
>> address 10.0.0.1
>> netmask 255.255.255.0
>> network 10.0.0.0
>> broadcast 10.0.0.255

init-ifplugd does not have "automatic" network detection which means
that you either have to write a udev rule that calls "ifup wlan0" when
wlan0 is registered or run "ifplugd" to get network change events
(will basically just call ifup wlan0 when network interface is added).

But it seems that you are installing NetworkManager AND init-ifplugd.
NetworkManager is enough if you want to use that, but then you need to
make sure that turn on the feature where NetworkManager handles the
"interface" file (managed=true) or provide a "NetworkManager" style
configuration file.

But as Drew already mentioned it is much better to use
systemd-networkd, for the "simple" use-cases at least.

--
Med Vänliga Hälsningar / Best Regards

Mirza Krak

Jorge Corona

unread,
Dec 20, 2017, 6:12:07 PM12/20/17
to Mender List mender.io
I am using  init-ifupdown because if I don't use this then ifup gives me errors and I want to load the /etc/network/interfaces file. I am not using network manager either I think. I just want to the wifi to start up automatically. 

My setup instructions do not require wpa_supplicant.conf file to work because I use  hostapd.conf . So this is how it works now:

ifup wlan0 # uses /etc/networking/interfaces
systemctl restart dnsmasq   # uses /etc/dnsmasq.conf
systemctl restart hostapd     # uses /etc/hostapd.conf


I tried the systemd-networkd and it looks like I needed to enable resolv or enable network manager... I tried disabling and re-enabling both at the same time and it seems to be working now. I can reboot and the wifi is on. I will rebuild and test to see which services I need. Also, I needed to create a file in /etc/systemd/network called wireless.network. Does anyone know how to append this file?

Thanks for your help, now I need to create a startup script to load the firewall rules.

Mirza Krak

unread,
Dec 20, 2017, 6:23:09 PM12/20/17
to mender
2017-12-21 0:12 GMT+01:00 Jorge Corona <ikkys...@gmail.com>:
> I am using init-ifupdown because if I don't use this then ifup gives me
> errors and I want to load the /etc/network/interfaces file. I am not using
> network manager either I think. I just want to the wifi to start up
> automatically.
>
> My setup instructions do not require wpa_supplicant.conf file to work
> because I use hostapd.conf . So this is how it works now:
>
> ifup wlan0 # uses /etc/networking/interfaces
> systemctl restart dnsmasq # uses /etc/dnsmasq.conf
> systemctl restart hostapd # uses /etc/hostapd.conf
>
>
> I tried the systemd-networkd and it looks like I needed to enable resolv or
> enable network manager... I tried disabling and re-enabling both at the same
> time and it seems to be working now. I can reboot and the wifi is on. I will
> rebuild and test to see which services I need. Also, I needed to create a
> file in /etc/systemd/network called wireless.network. Does anyone know how
> to append this file?

A while back I was using an RPi2 together with an WiFi chip connected
on USB. I then setup up my self a "demo" layer to get this working
together with Mender and it is available here [1]. It uses
systemd-networkd/resolv and installs some configuration files which
enable WiFi at start-up. Hopefully it can be a source of inspiration.

[1]. https://github.com/mirzak/meta-mender-demo

Jorge Corona

unread,
Dec 20, 2017, 7:34:08 PM12/20/17
to Mender List mender.io
Great. That worked.  Any links to startup / first time boot? I need to disable and enable services and add iptables rules.
Reply all
Reply to author
Forward
0 new messages