RPi3 box troubleshooting

Posted by JiG 
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Now, this forum is in read-only mode. You find details Details hereContinue on /r/PirateBox
JiG
RPi3 box troubleshooting
June 05, 2016 03:40PM
Greetings, all! I decided to tinker with the RPi by making a piratebox. I am using:
RPi 3+ (the latest one w/ built-in wifi)
TP-LINK TL-WN822N v3
Power supply battery (not using this yet, just a wall outlet for now)

I have followed all steps on this tutorial: [piratebox.cc]
And this one: [piratebox.cc]
which I think is based on this discussion: [forum.piratebox.cc]
I have also read several other forum posts, including this one about disregarding the Pi3's built-in wifi: [forum.piratebox.cc]

I am having an issue activating the usb wifi instead of built-in. While carrying out the commands in the steps linked above, at one point I was actually able to connect to the piratebox and check out the chat, forum, etc. and everything seemed to be working. Even though I had changed:
/opt/piratebox/conf/piratebox.conf
/opt/piratebox/conf/hostapd.conf

to reflect wlan1 and phy1 instead of wlan0 and phy0, it was still not using the usb wifi. I know this because I unplugged the usb wifi adapter from the Pi and was still able to cruise around the piratebox web interface. Now that I've exhausted the options in the above links, I cannot even connect via built-in wifi. Right now I'm connected via ethernet through my router to my pc. I am running Ubuntu MATE 16.04, accessing the Pi via terminal.

Here are some file configurations based on all the tutorials I've followed so far:

[alarm@alarmpi ~]$ iwconfig
wlan0     unassociated  Nickname:"<WIFI@REALTEK>"
          Mode:Auto  Frequency=2.412 GHz  Access Point: Not-Associated   
          Sensitivity:0/0  
          Retry: off   RTS thr: off   Fragment thr: off
          Power Management: off
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

lo        no wireless extensions.

eth0      no wireless extensions.

wlan1     IEEE 802.11bgn  ESSID: off/any  
          Mode:Managed  Access Point: Not-Associated   Tx-Power=1496 dBm   
          Retry short limit:7   RTS thr: off   Fragment thr: off
          Power Management: on

Contents of /opt/piratebox/conf/hostapd.conf

interface=wlan1
#driver=nl80211
driver=rtl871xdrv
#driver=rtl8192cu
ssid=PirateBox - Share Freely
hw_mode=g
channel=1
#auth_algs=1
#ieee80211n=1
ieee80211n=1


Contents of /opt/piratebox/conf/piratebox.conf

#########
## Config for pirate-box WWW Release
##  written by Matthias Strubel  (matthias.strubel@aod-rpg.de) 2011-02-22
##  licenced by gpl ; feel free to improve or send me feedback
##
##  2012-04-12 Created
##  2012-06-08 Changed IP Stuff to generating dnsmasq.conf stuff
##             ADDed SubConfig for IPV6 config
##             Changed Order of config
##  2013-08-14 Added timesave url
##
########

#######
## Configuration help
##    If you plan to use one laptop as the piratebox:
##        Set DO_IFCONFIG , USE_APN, USE_DNSMASQ to yes
##    If you plan to run a two component setup (one router and one providing the storage+$
##     connected with ethernet:
##        Set DO_IFCONFIG , USE_APN, USE_DNSMASQ  to no
##        Configure your ethernet eth0 (or whatever) to a static IP
##        force your router to publish the  HOST Option with your static IP; in case of d$
##        Have a look at [wiki.daviddarts.com] for futher instructions
##
##    You may deactivated severall option as needed. It's flexible.


#----------------- Folder Configuration  -------------------#

PIRATEBOX_FOLDER="/opt/piratebox"
WWW_FOLDER="/opt/piratebox/www"

#Do not change untill really needed.
PIRATEBOX_PYTHONPATH="$PIRATEBOX_FOLDER/python_lib"


#Datafolder  , where is you usb-stick // drive mounted
SHARE_FOLDER="$PIRATEBOX_FOLDER/share"

#Upload Folder
# Change this if you want to user uploaded data in a subfolder
#   Make sure the folder exists
# UPLOADFOLDER="$SHARE_FOLDER/Upload"
UPLOADFOLDER="$SHARE_FOLDER/Shared"

#----------------- Startup Configuration  -------------------#
# Which Steps has to be done

#Do network config
DO_IFCONFIG="yes"

#Do IW config - setting up a wlan0 interface with iw
#  for some wifi-cards required
DO_IW="yes"
#Iw physical interface
PHY_IF="phy1"

# Check if interface exists
#  should be set to yes if you use a USB wifi card
PROBE_INTERFACE="yes"
#  wait how many seconds until throw an error
PROBE_TIME=10

#Start services...
#   act like a apn  / <yes|no>
#    please have a look @ hostapd.conf ; you may need to change some options, regarding w$
USE_APN="yes"
#   act like dns&dhcp (dnsmasq)
USE_DNSMASQ="yes"

#HOSTNAME  ... if you really want to change it, plz change:
#    bin/droopy
#    conf/hosts
HOST="piratebox.lan"

#----------------- Configuration for DNSMASQ & IF-Setup  -------------------#
# Name of the wlan interface
INTERFACE="wlan1"
# On which interface DNSMASQ should listen. -i is the parameter for dnsmasq
# Make it empty to disable
DNSMASQ_INTERFACE="wlan1"

#Brdige add interfacce (setr yes to enable bridging)
DO_BRIDGE="no"
BRIDGE="br-lan"

#Network
NET=192.168.77

#IP-SHORT (is stringed together)
#  Which IP is your Box??  i.e. 1 => 192.168.77.1
IP_SHORT=1

#DHCP LEASE Start
START_LEASE=10
#DHCP LEASE End Range
END_LEASE=250
#Leasetime  (When should the client renew it's IP)
LEASE_DURATION=12h

# Where is the leasefile stored to?
LEASE_FILE_LOCATION=$PIRATEBOX_FOLDER/tmp/lease.file


# Define the netmask
NETMASK=255.255.255.0

#SET IP for ifconfig stuff - DON'T CHANGE
IP=$NET.$IP_SHORT

#Load Config about ipv6 stuff - DON'T CHANGE
 . $PIRATEBOX_FOLDER/conf/ipv6.conf

#----------------- Configuration for the pure piratebox -------------------#
## droopy, webserver, shoutbox- and forum-server

## Timesave file for non RTC devices
TIMESAVE="$PIRATEBOX_FOLDER/share/timesave_file"

#On non OpenWRT you can use the default output format
# as an input format. For OpenWrt you need to specify +%C%g%m%d%H%M
# The content is exchanged during makefile processing and image build
TIMESAVE_FORMAT="+%C%g%m%d %H%M"

#Start droopy? - Enable upload?
DROOPY_ENABLED="yes"
#Image-SRC
IMAGENAME="piratebox-logo-small.png"
IMAGE="$PIRATEBOX_FOLDER/src/$IMAGENAME"
DROOPY_TXT=""
DROOPY_PORT="8080"
# Set correct permissions for an uploaded file
DROOPY_CHMOD="755"
DROOPY_USERDIR=""
# Uncomment line below for adding directory feature
#DROOPY_USERDIR=" -u True "

#Use UserId from lighttpd for droopy  (use on ext-filesystems)
DROOPY_USE_USER="yes"

#Configuration for chat  (If you decide to move the chat folder, you have to change /opt/$
CHATFILE="$WWW_FOLDER/cgi-bin/data.pso"

#Generated File
GEN_CHATFILE="$WWW_FOLDER/chat_content.html"

#Generated File for DiskUsage
GEN_DISKFILE="$WWW_FOLDER/diskusage.html"

# Reset Shoutbox on Startup?
RESET_CHAT="yes"

#Inititiation Chat-Message
CHATMSG="<div class='message'><date>00:00:00</date> <name>PirateBox:</name> <data class='$

#Activate Global chat
# Still experimentall!
GLOBAL_CHAT="no"

#On which broadcast address should it send
#  Take care on the syntax!!
GLOBAL_DEST="[ #255.255.255.255# , #10.255.255.255# , #$NET.255# ]"

#------------------------ Additional configuration for lighttpd
LIGHTTPD_USER=nobody
LIGHTTPD_GROUP=nogroup


#------------------------ Hook in user-config
.  $PIRATEBOX_FOLDER/conf/hook_custom.conf

When following the guide here: [piratebox.cc]
I looked into the /prebuild/hostapd/ folder to see what was available:
[alarm@alarmpi ~]$ cd /prebuild/hostapd/
[alarm@alarmpi hostapd]$ ls
hostapd-2.5-1-armv7h.pkg.tar.xz
hostapd-8188eu-armv7h.pkg.tar.xz
hostapd-8192cu-armv7h.pkg.tar.xz
hostapd-RTL8188C_8192C_USB_linux-v4.0.2_9000.20130911-1-armv7h.pkg.tar.xz

I didn't know if I needed the 3rd or 4th file listed. I started with the 4th one, and when that did not work quite correctly, I chose the 3rd and ran this as part of step 1:
pacman -U /prebuild/hostapd/hostapd-8192cu-armv7h.pkg.tar.xz

When I check system status, I see:

[alarm@alarmpi hostapd]$ systemctl status piratebox
* piratebox.service - PirateBox Service
   Loaded: loaded (/etc/systemd/system/piratebox.service; disabled; vendor preset: disable
   Active: active (exited) since Mon 2016-02-22 14:40:17 UTC; 3 months 12 days ago
  Process: 243 ExecStart=/opt/piratebox/init.d/piratebox_alt start (code=exited, status=0/
 Main PID: 243 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/piratebox.service
           |-288 /usr/sbin/dnsmasq -x /var/run/piratebox_dnsmasq.pid -C /opt/piratebox/con
           |-293 python /opt/piratebox/bin/droopy -d /opt/piratebox/share/Shared -m  --chm
           `-311 /usr/sbin/lighttpd -f /opt/piratebox/conf/lighttpd/lighttpd.conf

Jun 04 23:25:00 alarmpi dnsmasq[288]: read /opt/piratebox/conf/hosts_mesh - 0 addresses
Jun 04 23:25:00 alarmpi dnsmasq[288]: read /opt/piratebox/conf/hosts_generated - 1 address
Jun 04 23:25:00 alarmpi piratebox_alt[243]: /opt/piratebox/bin/delete_empty.sh: line 12: cd: /opt/piratebox/share/Shared: No such file 

Jun 04 23:25:00 alarmpi piratebox_alt[243]: 0
Jun 04 23:25:01 alarmpi piratebox_alt[243]: Generated HTML-Shoutbox File.
Jun 04 23:25:01 alarmpi piratebox_alt[243]: CRITICAL: /opt/piratebox/share/Shared modified 1206 minutes ago. Threshold set to 5 minutes
Jun 04 23:25:01 alarmpi piratebox_alt[243]: Generated HTML-DiskUsage File.
Jun 04 23:25:01 alarmpi piratebox_alt[243]: Starting lighttpd...
Jun 04 23:25:01 alarmpi piratebox_alt[243]: 0
Jun 04 23:25:05 alarmpi systemd[1]: Started PirateBox Service.
lines 1-20/20 (END)

I read where someone suggested running:

sudo /opt/piratebox/rpi/bin/wifi_detect.sh

So I did and I see this:

[alarm@alarmpi hostapd]$ sudo /opt/piratebox/rpi/bin/wifi_detect.sh
[sudo] password for alarm: 
Found nl80211 device capable of AP mode...
warning: config file /etc/pacman.conf, line 98: directive 'IgnorePkg' in section 'aur' not recognized.
:: hostapd and hostapd-RTL8188C_8192C_USB_linux are in conflict. Remove hostapd-RTL8188C_8192C_USB_linux? [y/N] y
:: Proceed with installation? [Y/n] y
[alarm@alarmpi hostapd]$


I am not sure what I've done wrong. Can someone point me in the right direction?
Re: RPi3 box troubleshooting
June 13, 2016 06:32PM
Seems there are some issues together with the wifi sticks having the crappy realtek chipset together with the RPi3.

As stylesuxxs does not have time for debugging, it seems I need to invest some hours for tracing that. I'll open up and issue and try to bang my head around that stuff...
Re: RPi3 box troubleshooting
June 21, 2016 12:57AM
I would just go with the onboard wifi the RP3 has already as it works very well. Some of the chips inside USB wfi sticks are very cheap and nasty. They work fine to give you an network connection but they are not very good for use as an AP, how many people will be using them for a pirate box setup.

With the FCC trying to prevent changing the firmware in AP boxes off the shelf it looks like the RP3 will be the SOC board of ALL Hacktivists anyway.
JiG
Re: RPi3 box troubleshooting
June 21, 2016 01:21AM
The only reason I went for a USB stick wifi adapter was to get better range. I have a rpi 2 as well and an Edimax EW-7811Un plug-in adapter. Would I get better range on the rpi 3 with built in wifi or the Edimax or the 822n? Or would it be better to use the rpi 2 instead? Is it possible to turn off the Bluetooth adapter within the rpi 3 - sends like something I would not want on all the time, no?
Hi,
what should i write in /opt/piratebox/conf/hostapd.conf , if i want piratebox to use wlan1 if possible, else use wlan0 (that crappy built-in)
Thanks.
Re: RPi3 box troubleshooting
October 12, 2016 02:48PM
I think the issue of whether you can use the built-in wifi adapter in the RP3 should be in the FAQ as it would save a lot of time for first time Pirate Box users.
I also have the use of a better adapter with more range and will try that as well once I get things put together. The parts are on order right now.
This is a cool idea and sort of similar to the media player use of the Pi I have also started to put together. I dont see there being a problem but it is good to see there is this forum if there is one.

I do have one question which does not seem to be addressed anywhere. If I am going to use the pirate box with several people and they want to stream a movie from my box, will there be some sort of bandwidth problem when I get a couple of people wanting to view or watch a few different movies at the same time? Is the RP3 going to be bogged down trying to stream more than one movie at a time?

Maybe that will only be a problem with the slower speed of moving data off a usb2 stick where they will be located, but I am not sure.

Thanks for all you guys do here.
Re: RPi3 box troubleshooting
October 13, 2016 05:06AM
About the wifi issue:
- I added it to my public documentation todo list.

About the streaming:
It depends on the quality of your video you are streaming. I do not know about performance meassurements, but I think a two or three stream should be possible on a 720p video. If you have a good USB stick, the wifi network is the limiting factor.