akhepcat / bridgeap

Automagically bridge any live interface to any idle interface using NATS, DHCP, and HostAP where applicable
53 stars 1 forks source link

Unable to set up on Raspberry Pi #2

Open djlauria opened 7 years ago

djlauria commented 7 years ago

I have a wired connection that I am trying to share via wifi on a Raspberry Pi 3, running latest Raspbian. Following the installation instructions in the wiki: 1) update-rc.d bridgeap defaults gives the error: update-rc.d: error: initscript does not exist: /etc/init.d/bridgeap

2) ignoring that and continuing, sudo /usr/local/sbin/bridgeap start gives:

Starting bridgeap interface bridging Error for wireless request "Set Mode" (8B06) : SET failed on device wlan0 ; Invalid argument. failed to set Master mode

akhepcat commented 7 years ago

1) did you copy (or link) /usr/local/sbin/bridgeap to /etc/init.d/ , prior to running the update-rc.d?

2) in /etc/default/bridgeap.conf, change IGNORE_MODE=0 to 1

djlauria commented 7 years ago

Hi, changing IGNORE_MODE to 1 had no effect. Got this error again: Starting bridgeap interface bridging Error for wireless request "Set Mode" (8B06) : SET failed on device wlan0 ; Invalid argument. failed to set Master mode

Is there a folder issue? The instructions had me link the whole folder to /etc/init.d: ln -s /usr/local/src/bridgeap /etc/init.d
Also, bridgeap.conf is in /etc/bridgeap, from here: cp bridgeap/*conf* /etc/bridgeap

akhepcat commented 7 years ago

re: 1) If you're cutting and pasting from the wiki text, the '/etc/init.d' dirspec was missing a trailing slash. Most folk would automatically work around that during tab-completion, but cut-n-paste would miss it. I've added it.

re: 2) sorry, /etc/bridgeap/bridgeap.conf (staging version has /etc/default as an option) - you may still see the error, but the script won't die on it. it's just noise from the iwconfig command trying to set master mode in a way the driver doesn't support, but that's resolved during hostapd startup.

djlauria commented 7 years ago

Got a little further. The problem is that the command as written symlinks the folder instead of script. I needed to symlink as follows: ln -s /usr/local/src/bridgeap/bridgeap /usr/local/sbin/
ln -s /usr/local/src/bridgeap/bridgeap /etc/init.d/

I should mention that raspbian did not have radvd, hostapd, or isc-dhcp-client installed, so I used their package manager to install them.

So the update-rc.d completes without error. I've set IGNORE_MODE to 1, and now get this:

Starting bridgeap interface bridging Configuration file: /usr/local/src/bridgeap/hostapd.conf-bridgeap Failed to create interface mon.wlan0: -95 (Operation not supported) wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE wlan0: Could not connect to kernel driver Using interface wlan0 with hwaddr b8:27:eb:66:ab:ad and ssid "bridgeap" wlan0: interface state COUNTRY_UPDATE->ENABLED wlan0: AP-ENABLED Internet Systems Consortium DHCP Server 4.3.1 Copyright 2004-2014 Internet Systems Consortium. All rights reserved. Usage: dhcpd [-p <UDP port #>] [-f] [-d] [-q] [-t|-T] [-4|-6] [-cf config-file] [-lf lease-file] [-tf trace-output-file] [-play trace-input-file] [-pf pid-file] [--no-pid] [-s server] [if0 [...ifN]]

If you think you have received this message due to a bug rather than a configuration issue please read the section on submitting bugs on either our web page at www.isc.org or in the README file before submitting a bug. These pages explain the proper process and the information we find helpful for debugging..

exiting. dhcp server failed to start

akhepcat commented 7 years ago

Ah, fixed the wiki for that missing tail. d'oh!

If you run the bridgeap script with debugging ( bash -x bridgeap start ) what does the full dhcp command look like? Different distros have different support for different options, so i'm wondering if it's a strangeness with your version of raspian...

djlauria commented 7 years ago

Here's what I got:

`sudo bash -x /usr/local/sbin/bridgeap start

If you think you have received this message due to a bug rather than a configuration issue please read the section on submitting bugs on either our web page at www.isc.org or in the README file before submitting a bug. These pages explain the proper process and the information we find helpful for debugging..

exiting.

akhepcat commented 7 years ago

Hrm... apparently raspbian recompiled the dhcp server to remove the user/group options for your build, which means that DHCP won't drop privileges after starting (bad security design)

I'll drop an option into the config file to ignore DHCP user/group (run as root) which you'll be able to use to bypass that error.

akhepcat commented 7 years ago

the DHCP issue should be resolvable by unsetting the two options in the bridgeap config file: DHCP_USER and DHCP_GROUP.

comment them out, and the server -should- start up.

djlauria commented 7 years ago

Ok, commenting those out, here is the output:

`Starting bridgeap interface bridging Configuration file: /usr/local/src/bridgeap/hostapd.conf-bridgeap Failed to create interface mon.wlan0: -95 (Operation not supported) wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE wlan0: Could not connect to kernel driver Using interface wlan0 with hwaddr b8:27:eb:66:ab:ad and ssid "bridgeap" random: Only 7/20 bytes of strong random data available from /dev/random random: Not enough entropy pool available for secure operations WPA: Not enough entropy in random pool for secure operations - update keys later when the first station connects wlan0: interface state COUNTRY_UPDATE->ENABLED wlan0: AP-ENABLED Internet Systems Consortium DHCP Server 4.3.1 Copyright 2004-2014 Internet Systems Consortium. All rights reserved. Usage: dhcpd [-p <UDP port #>] [-f] [-d] [-q] [-t|-T] [-4|-6] [-cf config-file] [-lf lease-file] [-tf trace-output-file] [-play trace-input-file] [-pf pid-file] [--no-pid] [-s server] [if0 [...ifN]]

If you think you have received this message due to a bug rather than a configuration issue please read the section on submitting bugs on either our web page at www.isc.org or in the README file before submitting a bug. These pages explain the proper process and the information we find helpful for debugging..

exiting. dhcp server failed to start `

akhepcat commented 7 years ago

Okay, so if it fails, always send post the logs in bash debug mode, or else it's really not useful text.

Another thing to check is your apparmor logs. That's going to be something that you might need to adjust, if you're running apparmor, or selinux. I don't have any way to help you, since I don't use them on my APs

djlauria commented 7 years ago

Oops, sorry about that:

pi@bwrsd-pi-001:~ $ sudo bash -x /usr/local/sbin/bridgeap start

If you think you have received this message due to a bug rather than a configuration issue please read the section on submitting bugs on either our web page at www.isc.org or in the README file before submitting a bug. These pages explain the proper process and the information we find helpful for debugging..

exiting.

akhepcat commented 7 years ago

Try re-pulling - you don't have the latest commit.

djlauria commented 7 years ago

And, done. This is fantastic; thanks for the extra time to get this working!

djlauria commented 7 years ago

Actually, one last question: I assumed with the presence of update-rc.d that it should start automatically, but that's not the case. No big deal, just wondering if there's anything there I can help troubleshoot before we close this.

akhepcat commented 7 years ago

Hrm.. it may be that your systemd configuration is not supporting the legacy /etc/init.d/ startup files.

I suppose i should look at creating a systemd-compatible unit file

djlauria commented 7 years ago

If you do, let me know if I can help troubleshoot in some way. Everything else is working perfectly, so I'll leave it up to you as to whether to keep the issue open. Thanks again for all your help.