MODEP, Pisound, WiFi, and You

#1

This post aims to explain how the WiFi hotspot is configured in MODEP, and by extension, how the WiFi works in a few other Blokaslabs projects.

The WiFi hotspot is powered by the hostapd package, and that package relies on some essential configuration files that are either part of the base MODEP image, or provided by the pisound-btn package.


General Info

Up-to-Date Systems

If you have ran all your updates on the pi, the configuration files you should be concerned with are here:

/etc/default/hostapd
/etc/hostapd/hostapd.conf

The /etc/default/hostapd file points the hostapd service to the actual location of the config file it should use. In an up-to-date system, this points to /etc/hostapd/hostapd.conf

The /etc/hostapd/hostapd.conf file is where you will find the SSID, password, boadcast settings, and other relevant settings for the WiFi hotspot, in case you are interesting in changing anything.

Base MODEP Image

If you have never ran updates on your base MODEP image (2018-09-11-MODEP.img), then your hostapd config actually lives in a different place:
/usr/local/pisound/scripts/pisound-btn/hostapd.conf


Troubleshooting a Broken sudo apt-get update/upgrade

Due to some changes in both the hostapd and the pisound-btn packages, it’s very likely that now, an apt-get update / apt-get upgrade will cause trouble on the base MODEP install (2018-09-11-MODEP.img).

You may see output like this from the sudo apt-get upgrade:

....
May 28 00:13:58 modep systemd[1]: hostapd.service: Unit entered failed state.
May 28 00:13:58 modep systemd[1]: hostapd.service: Failed with result 'exit-code'.
dpkg: error processing package hostapd (--configure):
subprocess installed post-installation script returned error exit status 1
....
dpkg: dependency problems prevent configuration of pisound-btn:
pisound-btn depends on hostapd (>= 1:2.3); however:
Package hostapd is not configured yet.
dpkg: error processing package pisound-btn (--configure):
dependency problems - leaving unconfigured
....
Errors were encountered while processing:
hostapd
pisound-btn
E: Sub-process /usr/bin/dpkg returned an error code (1)

In this state, neither pisound-btn nor hostapd are configured correctly, and we’ll have to get hostapd sorted out in order to fix pisound-btn.


  1. Check for the existence of /etc/hostapd/hostapd.conf.dpkg-new
    If this file exists, we don’t have a lot of work to get this fixed:
    ls -l /etc/hostapd/hostapd.conf.dpkg-new

  2. Move the conf to where it belongs:
    sudo mv /etc/hostapd/hostapd.conf.dpkg-new /etc/hostapd/hostapd.conf

  3. After putting the config in the right spot, we will probably want to adjust the SSID in /etc/hostapd/hostapd.conf to match what it was before. With your preferred editor (vim/nano/etc) we should make the adjustment:
    sudo nano /etc/hostapd/hostapd.conf

  4. Find the line with ssid=Pisound and change that to ssid=MODEP

  5. Save changes to the file and exit the editor

  6. Hostapd should be configured properly now, and then we need to fix the broken packages:
    sudo dpkg --configure -a

  7. In the dpkg step, you may be prompted to compare differences in config files, to keep your current ones, or use the new config files. (I kept my current config)
    Use D to compare the differences in the config files
    Use N to keep your current config
    Use Y to use the new config

  8. If that all finishes without error, you can either sudo reboot your pi, or you can use the systemctl command to try and stop/start the WiFi hotspot:

sudo systemctl stop wifi-hotspot
sudo systemctl start wifi-hotspot

After all that, you should have your WiFi back up and running. If not, there are a few other things you could check:

  1. The /etc/default/hostapd config file should have a line that points to your fixed hostapd.conf:
    DAEMON_CONF="/etc/hostapd/hostapd.conf"

  2. If that DAEMON_CONF is pointed to "" or just commented out, you will need to uncomment it and point it to the correct config file, as in the example above


Hopefully this post is helpful to folks who want to tweak their WiFi settings, or anyone who has gotten hung up by failed apt-get upgrade.

Play on!

4 Likes

MODEP no longer running following rpi-update
#2

Hey! Thank you for this write up and your insights into the issue. We have just published pisound-btn 1.09-3 package update which should upgrade correctly and repair WiFi hotspot. In case someone already got stuck with dpkg dependency problems, the above post should help to get out of that state.

0 Likes