lerner
Posts: 433
Joined: Sun Mar 29, 2015 12:12 am

RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 9:14 am

Hi folks.

A while back I went through the motions of setting up a RPI WAP.

It works/ed.

Today I was doing it a gain on another RPI.
This time a RPI 3 with built in wifi.

I went through the motions and it isn't working.

This is the walk through I am using:
https://frillip.com/using-your-raspberr ... h-hostapd/

I'm down to this part:
We can check if it's working at this stage by running sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf. If it's all gone well thus far, you should be able to see to the network Pi3-AP! If you try connecting to it, you will see some output from the Pi, but you won't receive and IP address until we set up dnsmasq in the next step. Use Ctrl+C to stop it.
Yes, that works.

I go on and do the rest - granted I messed it a couple of times - Ok: I"m not perfect.

Then I get to this part:
We aren't quite done yet, because we also need to tell hostapd where to look for the config file when it starts up on boot. Open up the default configuration file with sudo nano /etc/default/hostapd and find the line #DAEMON_CONF="" and replace it with DAEMON_CONF="/etc/hostapd/hostapd.conf".
Done.

I then do the dnsmasq file and set it up.

Get to the:
sudo service hostapd start
sudo service dnsmasq start
and reboot.

It doesn't work.
No wifi visible.

It seems that the hostapd.conf isn't done.

If I go in and do the "sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf it starts to be visible.

It workes/ed on the other one (with different IP numbers) so I'm stuck why it isn't working on the new one.

As I explained:
If it boots, the wifi isn't visible.
I run the /usr/sbin/hostapd /etc/hostapd/hostapd.conf and it is visible.

SurferTim
Posts: 1011
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 10:44 am

That tutorial may not work, depending on the OS version you are using. This should work on Jessie and Stretch.
https://github.com/SurferTim/documentat ... s-point.md

To check if all went well, run these from a terminal:

Code: Select all

sudo service hostapd status
sudo service dnsmasq status
Both should show active (running)

lerner
Posts: 433
Joined: Sun Mar 29, 2015 12:12 am

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 11:19 am

Strech and is up to date.

Did all the updates today as a matter of trying to "fix" the problem.

Shall look at and read the link.

Both show active.

SurferTim
Posts: 1011
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 11:23 am

If your AP ssid doesn't show up on a scan, it is one of two things.

Your /etc/hostapd/hostapd.conf file has an error.
You didn't edit /etc/default/hostapd and change the DAEMON_CONF line.

Post your hostapd.conf file if you have questions.

Edit Both must show active (running). If either shows active (exited), you have a problem.

lerner
Posts: 433
Joined: Sun Mar 29, 2015 12:12 am

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 11:31 am

Just before I post that, here's a kicker:

Did what you said, thanks "active".
(Checked files on other WAP. Same - if you know what I mean)

Strange.

Ran the sudo /usr/sbin/hostapd /etc/hostapd/hostapd.conf again and wifi becomes visible.

This is the file:

Code: Select all

cat /etc/hostapd/hostapd.conf 
interface=wlan0
driver=nl80211
ssid=MusicPi
hw_mode=g
channel=7
ieee80211n=1
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=a1b2c3d4e5
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

This is the /etc/default/hostapd file:

Code: Select all

cat /etc/default/hostapd 
# Defaults for hostapd initscript
#
# See /usr/share/doc/hostapd/README.Debian for information about alternative
# methods of managing hostapd.
#
# Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration
# file and hostapd will be started during system boot. An example configuration
# file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz
#
#DAEMON_CONF=""

# Additional daemon options to be appended to hostapd command:-
# 	-d   show more debug messages (-dd for even more)
# 	-K   include key data in debug messages
# 	-t   include timestamps in some debug messages
#
# Note that -B (daemon mode) and -P (pidfile) options are automatically
# configured by the init.d script and must not be added to DAEMON_OPTS.
#
#DAEMON_OPTS=""

DAEMON_CONF="/etc/hostapd/hostapd.conf"
Same as on the working WAP.

(Again - just to clarify: DIFFERENT IP addresses.)


Oh, just on that.....

Your example:
So for wlan0, we are going to provide IP addresses between 192.168.4.2 and 192.168.4.20,
That's not really "legal" for an IP sub-range.

Sure is is /24 subnet. But that range is not really a correct subnet set. AFAIK anyway.
(No big though - just mentioning coz I am learning that stuff now.)

SurferTim
Posts: 1011
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 11:35 am

This is the problem, and it will make the hostapd service show exited on boot.

In /etc/default/hostapd, change this

Code: Select all

#DAEMON_CONF=""
to this (note no #)

Code: Select all

DAEMON_CONF="/etc/hostapd/hostapd.conf"

lerner
Posts: 433
Joined: Sun Mar 29, 2015 12:12 am

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 11:40 am

Just while looking around:

Code: Select all

sudo cat /etc/wpa_supplicant/wpa_supplicant.conf 
country=AU
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
Ok, so that points to /var/run/wpa_suplicant.

Let's look there:

Code: Select all

pi@MusicPi:~ $ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf 
country=AU
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
pi@MusicPi:~ $ cd /var/run
pi@MusicPi:/var/run $ lf
alsa/          dhcpcd/              hostapd.pid  mosquitto.pid  rpcbind/       sendsigs.omit.d/  thd.pid      utmp
avahi-daemon/  dhcpcd.pid           initctl@     mount/         rpcbind.lock   shm@              thd.socket=
crond.pid      dhcpcd.sock=         lightdm/     network/       rpcbind.pid    squeezelite.pid   tmpfiles.d/
crond.reboot   dhcpcd.unpriv.sock=  lightdm.pid  ntpd.pid       rpcbind.sock=  sshd/             udev/
cups/          dnsmasq/             lock/        plymouth/      rsyslogd.pid   sshd.pid          udisks2/
dbus/          hogsuspend|          log/         resolvconf/    samba/         systemd/          user/
pi@MusicPi:/var/run $ lf wp*
ls: cannot access wp*: No such file or directory
pi@MusicPi:/var/run $ 
Does that mean something is missing?

Though the other WAP machine shows the same........ No such file or directory.

Have I been "hacked"?

SurferTim
Posts: 1011
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 11:44 am

/var/run/wpa_supplicant should be a directory.

Code: Select all

cd /var/run
ls -l

lerner
Posts: 433
Joined: Sun Mar 29, 2015 12:12 am

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 11:46 am

SurferTim wrote:
Fri Oct 20, 2017 11:35 am
This is the problem, and it will make the hostapd service show exited on boot.

In /etc/default/hostapd, change this

Code: Select all

#DAEMON_CONF=""
to this (note no #)

Code: Select all

DAEMON_CONF="/etc/hostapd/hostapd.conf"
Yeah, that is a bad thing I did, but if you look a bit further down, that line is there....

Code: Select all

# Additional daemon options to be appended to hostapd command:-
# 	-d   show more debug messages (-dd for even more)
# 	-K   include key data in debug messages
# 	-t   include timestamps in some debug messages
#
# Note that -B (daemon mode) and -P (pidfile) options are automatically
# configured by the init.d script and must not be added to DAEMON_OPTS.
#
#DAEMON_OPTS=""

DAEMON_CONF="/etc/hostapd/hostapd.conf"
sorry. I probably should remove the "default" line, but I'm still at the bottom of the curve.

SurferTim
Posts: 1011
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 11:49 am

I didn't see that. When you boot, does the status of the hostapd service show active (running)?

Edit: Did you change anything in /etc/network/interfaces? You shouldn't have. If you are using Stretch, there should be only one uncommented line in that file, and it starts with source-directory. Remove everything else.
Last edited by SurferTim on Fri Oct 20, 2017 11:52 am, edited 1 time in total.

lerner
Posts: 433
Joined: Sun Mar 29, 2015 12:12 am

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 11:52 am

Alas......

Code: Select all

pi@MusicPi:/etc $ cd /var/run
pi@MusicPi:/var/run $ ls -l
total 48
drwx------  3 root  root     60 Oct 20 17:17 alsa
drwxr-xr-x  2 avahi avahi    80 Oct 20 17:17 avahi-daemon
-rw-r--r--  1 root  root      4 Oct 20 17:17 crond.pid
----------  1 root  root      0 Oct 20 17:17 crond.reboot
drwxr-xr-x  3 root  lp      120 Oct 20 17:18 cups
drwxr-xr-x  2 root  root     60 Oct 20 17:17 dbus
drwxr-xr-x  3 root  root    120 Oct 20 22:34 dhcpcd
-rw-r--r--  1 root  root      4 Oct 20 17:17 dhcpcd.pid
srw-rw----  1 root  root      0 Oct 20 17:17 dhcpcd.sock
srw-rw-rw-  1 root  root      0 Oct 20 17:17 dhcpcd.unpriv.sock
drwxr-xr-x  2 root  root     80 Oct 20 17:17 dnsmasq
prw-------  1 root  root      0 Oct 20 17:17 hogsuspend
-rw-r--r--  1 root  root      4 Oct 20 17:17 hostapd.pid
lrwxrwxrwx  1 root  root     25 Oct 20 17:17 initctl -> /run/systemd/initctl/fifo
drwx--x--x  3 root  root     60 Oct 20 17:17 lightdm
-rw-r--r--  1 root  root      4 Oct 20 17:17 lightdm.pid
drwxrwxrwt  4 root  root    100 Oct 20 17:17 lock
drwxr-xr-x  3 root  root     60 Oct 20 17:17 log
-rw-r--r--  1 root  root      4 Oct 20 17:17 mosquitto.pid
drwxr-xr-x  2 root  root     60 Oct 20 17:17 mount
drwxr-xr-x  2 root  netdev   80 Oct 20 17:17 network
-rw-r--r--  1 root  root      3 Oct 20 17:17 ntpd.pid
drwxr-xr-x  2 root  root     40 Oct 20 17:17 plymouth
drwxr-xr-x  4 root  root     80 Oct 20 17:17 resolvconf
drwxr-xr-x  2 root  root     40 Oct 20 17:17 rpcbind
-r--r--r--  1 root  root      0 Oct 20 17:17 rpcbind.lock
-rw-r--r--  1 root  root      3 Oct 20 17:17 rpcbind.pid
srw-rw-rw-  1 root  root      0 Oct 20 17:17 rpcbind.sock
-rw-r--r--  1 root  root      4 Oct 20 17:17 rsyslogd.pid
drwxr-xr-x  4 root  root    360 Oct 20 17:18 samba
drwxr-xr-x  2 root  root     60 Oct 20 17:17 sendsigs.omit.d
lrwxrwxrwx  1 root  root      8 Oct 20 17:17 shm -> /dev/shm
-rw-r--r--  1 root  root      4 Oct 20 17:17 squeezelite.pid
drwxr-xr-x  2 root  root     40 Oct 20 17:17 sshd
-rw-r--r--  1 root  root      4 Oct 20 17:17 sshd.pid
drwxr-xr-x 15 root  root    380 Oct 20 17:17 systemd
-rw-r--r--  1 root  root      4 Oct 20 17:17 thd.pid
srwxr-xr-x  1 root  root      0 Oct 20 17:17 thd.socket
drwxr-xr-x  2 root  root     60 Jan  1  1970 tmpfiles.d
drwxr-xr-x  7 root  root    160 Oct 20 22:47 udev
drwx------  2 root  root     40 Oct 20 17:18 udisks2
drwxr-xr-x  3 root  root     60 Oct 20 17:17 user
-rw-rw-r--  1 root  utmp   2304 Oct 20 22:14 utmp
pi@MusicPi:/var/run $ 
They stop at u..... No w there.

(As on the other working WAP Pi.)


Shortly after boot:

Code: Select all

pi@MusicPi:~ $ sudo service hostapd status
● hostapd.service - LSB: Advanced IEEE 802.11 management daemon
   Loaded: loaded (/etc/init.d/hostapd)
   Active: active (running) since Fri 2017-10-20 17:17:06 AEDT; 4h 59min ago
  Process: 739 ExecStart=/etc/init.d/hostapd start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/hostapd.service
           └─920 /usr/sbin/hostapd -B -P /run/hostapd.pid /etc/hostapd/hostap...

Oct 20 17:17:05 MusicPi systemd[1]: Starting LSB: Advanced IEEE 802.11 mana.....
Oct 20 17:17:06 MusicPi hostapd[739]: Starting advanced IEEE 802.11 managem...d.
Oct 20 17:17:06 MusicPi systemd[1]: Started LSB: Advanced IEEE 802.11 manag...n.
Hint: Some lines were ellipsized, use -l to show in full.
pi@MusicPi:~ $ sudo service dnsmasq status
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
   Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled)
  Drop-In: /run/systemd/generator/dnsmasq.service.d
           └─50-dnsmasq-$named.conf, 50-insserv.conf-$named.conf
   Active: active (running) since Fri 2017-10-20 17:17:06 AEDT; 4h 59min ago
  Process: 833 ExecStartPost=/etc/




SurferTim wrote:
Fri Oct 20, 2017 11:44 am
/var/run/wpa_supplicant should be a directory.

Code: Select all

cd /var/run
ls -l

SurferTim
Posts: 1011
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 11:54 am

Did you change anything in /etc/network/interfaces? You shouldn't have. If you are using Stretch, there should be only one uncommented line in that file, and it starts with source-directory. Remove everything else.

Maybe you should start with a fresh install.

lerner
Posts: 433
Joined: Sun Mar 29, 2015 12:12 am

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 11:58 am

Code: Select all

cat 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

auto lo
iface lo inet loopback

iface eth0 inet manual

##  Old stuff.   replaced by WAP stuff at bottom.
#allow-hotplug wlan0
#iface wlan0 inet manual
#    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

#allow-hotplug wlan1
#iface wlan1 inet manual
#    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf


##  New stuff for WAP
allow-hotplug wlan0
iface wlan0 inet static
    address 192.168.1.105
    netmask 255.255.255.248
    network 192.168.1.104
    broadcast 192.168.1.111
#    network 192.168.0.0
pi@MusicPi:/etc $ 
Other than the IP addresses, this is a carbon copy of the file from the working WAP.

(It is 1 - 15)
(Exert)

Code: Select all

allow-hotplug wlan0
iface wlan0 inet static
  address 192.168.1.1
  netmask 255.255.255.240
##  14 usable addresses.  (Well 13, as this is one of them)
#  network 192.168.1.0
  network 192.168.0.0

SurferTim
Posts: 1011
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 12:00 pm

Which version of Raspbian are you using?

Code: Select all

cat /etc/os-release
cat /etc/rpi-issue

lerner
Posts: 433
Joined: Sun Mar 29, 2015 12:12 am

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 12:04 pm

Ok. "Pants on fire" to me.

But I have done the commands:

Code: Select all

sudo apt-get update
sudo apt-get upgrade
sudo rpi update
sudo apt-get dist-upgrade
Doesn't that update the "distribution" to the latest?

This is what I get from the commands:
pi@MusicPi:/etc $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@MusicPi:/etc $ cat /etc/rpi-issue
Raspberry Pi reference 2017-01-11
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 21a681692ac70e77d3ebe1dd2a76b31de1a72d89, stage4
pi@MusicPi:/etc $

SurferTim
Posts: 1011
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 12:10 pm

It shows you are running an early version of Jessie.

There is a big difference in the way Jessie and Stretch configure the network settings. I don't have access to my Jessie RPi right now, only my Stretch RPi.

lerner
Posts: 433
Joined: Sun Mar 29, 2015 12:12 am

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 12:20 pm

Tim, thanks for the help to now.

I am really sorry I mislead you on me running Strech.

I thought I updated to Strech from Jessie.

(Would you mine helping me get my head around what the:
sudo raspi update does
and the
sudo apt-get dist-upgrade

My attempts at understanding them went around in circles with the other two intermixed.

Doesn't one of them update the distribution - as the command kind of implies?

(I have recently built two ZERO (W) and another RPI3...... Maybe that/they is/are running Strech.)

But as I explained....... I thought I did update them from Jessie to Strech.

SurferTim
Posts: 1011
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 12:25 pm

It appears you have a bad install. I just booted my Jessie RPi, and it has a /var/run/wpa_supplicant directory.

lerner
Posts: 433
Joined: Sun Mar 29, 2015 12:12 am

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 12:30 pm

Weird.

Thanks.

Though the working WAP also doesn't have that directory either. (Just saying)

I'll have to do more digging.

Again: Thanks.

SurferTim
Posts: 1011
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 12:35 pm

The Jessie version I am using is 2017-04-10.

lerner
Posts: 433
Joined: Sun Mar 29, 2015 12:12 am

Re: RPI 3 wifi setup - not understanding what is going on.

Fri Oct 20, 2017 10:11 pm

So if this is what I get from "cat /etc/rpi-issue" I am using an OLD jessie?

pi@PIFACE:~ $ cat /etc/rpi-issue
Raspberry Pi reference 2015-11-21
Generated using Pi-gen, https://github.com/RPi-Distro/Pi-gen, jessie-stage4


Although I have updated it since.

Return to “Beginners”

Who is online

Users browsing this forum: tarbucndge and 35 guests