Raspberry Pi PirateBox

Posted by uraliss 
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
Re: Raspberry Pi PirateBox
November 22, 2012 09:10PM
I can see the wifi network, but it always fails to connect from both my laptop and my phone.

Here is the PS output

  PID TTY          TIME CMD
 2517 tty1     00:00:02 bash
 2599 tty1     00:00:00 ps


And the ifconfig output

eth0      Link encap:Ethernet  HWaddr b8:27:eb:ad:6b:e2  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 cool smiley  TX bytes:0 (0.0 cool smiley

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 cool smiley  TX bytes:0 (0.0 cool smiley

mon.wlan0 Link encap:UNSPEC  HWaddr F8-D1-11-1B-71-F8-00-00-00-00-00-00-00-00-00-00  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5313 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1385655 (1.3 Micool smiley  TX bytes:0 (0.0 cool smiley

wlan0     Link encap:Ethernet  HWaddr f8:d1:11:1b:71:f8  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:35 errors:0 dropped:13 overruns:0 frame:0
          TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:8881 (8.6 Kicool smiley  TX bytes:5538 (5.4 Kicool smiley


Re: Raspberry Pi PirateBox
November 24, 2012 08:46AM
Sorry, I want to know the output of

ps ax

---

Btw: did you deactivate the network manager of debian? It seems there is no IP set on the wlan0 interface, which is the reason, that your box won't work.
Re: Raspberry Pi PirateBox
November 24, 2012 06:56PM
I don't think that I disabled the network manager. When I run the desktop environment I still have the WiFi Config program, though it only shows my home network as disconnected, and offers no information about the pirate box network that is broadcasting.

Here are the results from ps ax

Should I wipe the SD card and try again from step 1?

  PID TTY      STAT   TIME COMMAND
    1 ?        Ss     0:02 init [2]  
    2 ?        S      0:00 [kthreadd]
    3 ?        S      0:00 [ksoftirqd/0]
    4 ?        S      0:00 [kworker/0:0]
    5 ?        S      0:00 [kworker/u:0]
    6 ?        S<     0:00 [khelper]
    7 ?        S      0:00 [kdevtmpfs]
    8 ?        S<     0:00 [netns]
    9 ?        S      0:00 [sync_supers]
   10 ?        S      0:00 [bdi-default]
   11 ?        S<     0:00 [kblockd]
   12 ?        S      0:00 [khubd]
   13 ?        S<     0:00 [rpciod]
   14 ?        S      0:00 [kworker/0:1]
   15 ?        S      0:00 [khungtaskd]
   16 ?        S      0:00 [kswapd0]
   17 ?        S      0:00 [fsnotify_mark]
   18 ?        S<     0:00 [nfsiod]
   19 ?        S<     0:00 [crypto]
   26 ?        S<     0:00 [kthrotld]
   27 ?        S<     0:00 [VCHIQ-0]
   28 ?        S<     0:00 [VCHIQr-0]
   29 ?        S<     0:00 [dwc_otg]
   30 ?        S<     0:00 [DWC Notificatio]
   31 ?        S      0:00 [kworker/u:1]
   32 ?        S      0:01 [mmcqd/0]
   33 ?        S      0:00 [jbd2/mmcblk0p2-]
   34 ?        S<     0:00 [ext4-dio-unwrit]
  133 ?        S      0:00 [flush-179:0]
  141 ?        Ss     0:00 udevd --daemon
  260 ?        S      0:00 udevd --daemon
  267 ?        S<     0:00 [cfg80211]
  268 ?        S      0:00 udevd --daemon
 1153 ?        S      0:00 [kworker/0:2]
 1675 ?        S      0:00 /usr/sbin/ifplugd -i eth0 -q -f -u0 -d10 -w -I
 1676 ?        S      0:00 /usr/sbin/ifplugd -i wlan0 -q -f -u0 -d10 -w -I
 1679 ?        S      0:00 /usr/sbin/ifplugd -i lo -q -f -u0 -d10 -w -I
 1699 ?        S      0:00 [kworker/u:2]
 1732 ?        Ss     0:00 /sbin/wpa_supplicant -s -B -P /var/run/wpa_supplicant.wlan0.pid -i wlan0 -W -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
 1828 ?        Ss     0:00 /sbin/wpa_cli -B -P /var/run/wpa_action.wlan0.pid -i wlan0 -p /var/run/wpa_supplicant -a /sbin/wpa_action
 2022 ?        S      0:00 /bin/sh /sbin/wpa_action wlan0 CONNECTED
 2038 ?        S      0:00 /sbin/ifup -v --force wlan0=default
 2052 ?        S      0:00 /usr/sbin/hostapd /opt/piratebox/conf/hostapd.conf
 2066 ?        S      0:00 dhclient -1 -v -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases wlan0
 2068 ?        S      0:00 [kworker/0:3]
 2069 ?        S      0:00 [kworker/0:4]
 2108 ?        Sl     0:00 /usr/sbin/rsyslogd -c5
 2111 ?        S      0:00 /usr/sbin/ifplugd -i mon.wlan0 -q -f -u0 -d10 -w -I
 2140 ?        S      0:00 /usr/sbin/dnsmasq -x /var/run/piratebox_dnsmasq.pid -C /opt/piratebox/conf/dnsmasq_generated.conf
 2181 ?        S      0:01 python /opt/piratebox/bin/droopy -H piratebox.lan -d /opt/piratebox/share/Shared -c  -m  8080
 2207 ?        S      0:00 /usr/sbin/lighttpd -f /opt/piratebox/conf/lighttpd/lighttpd.conf
 2251 ?        Ss     0:00 /usr/sbin/cron
 2288 ?        Ss     0:00 /usr/bin/dbus-daemon --system
 2331 ?        Ss     0:00 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 102:104
 2336 ?        S      0:00 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 102:104
 2363 ?        Ss     0:00 /usr/sbin/sshd
 2393 ?        Ss     0:00 /usr/sbin/thd --daemon --triggers /etc/triggerhappy/triggers.d/ --socket /var/run/thd.socket --pidfile /var/run/thd.pid --user nobody /dev/input/event0
 2405 tty1     Ss     0:00 /bin/login --   
 2406 tty2     Ss+    0:00 /sbin/getty 38400 tty2
 2407 tty3     Ss+    0:00 /sbin/getty 38400 tty3
 2408 tty4     Ss+    0:00 /sbin/getty 38400 tty4
 2409 tty5     Ss+    0:00 /sbin/getty 38400 tty5
 2410 tty6     Ss+    0:00 /sbin/getty 38400 tty6
 2411 ?        Ss+    0:00 /sbin/getty -L ttyAMA0 115200 vt100
 2413 ?        Sl     0:00 /usr/sbin/console-kit-daemon --no-daemon
 2480 ?        Sl     0:00 /usr/lib/policykit-1/polkitd --no-debug
 2490 tty1     S      0:00 -bash
 2500 tty1     R+     0:00 ps ax

Re: Raspberry Pi PirateBox
November 24, 2012 08:56PM
Well, the piratebox daemons are all up and running.
I think you have to disable your network-manager to fix this problem. The network manager resets the IP of the wlan0 device which results in a not working piratebox.
Re: Raspberry Pi PirateBox
November 25, 2012 12:22AM
I am pretty new to linux and having a bit of trouble with this.
I tried
sudo apt-get remove network-manager

but it said "not installed, so not removed"
I do have WiFi Config on the desktop, but cannot figure out the package name to try and remove it. Any suggestions?

Thanks for all the help!
Re: Raspberry Pi PirateBox
November 25, 2012 11:28AM
only do

/etc/init.d/network-manager stop
update-rc.d network-manager remove



this stops it and disables the autostart
Re: Raspberry Pi PirateBox
December 01, 2012 06:11PM
I tried running those commands, but it just says "command not found." It seems that network manager is not installed.

I wiped the card and installed again, and ended up back in the same. The raspberry pi is broadcasting a network, but no one can connect.
Is there some other network managing program on Wheezy that may be conflicting with the piratebox?
Re: Raspberry Pi PirateBox
December 01, 2012 11:14PM
I'll have a close look to my rpi tomorrow and write you my results.
Re: Raspberry Pi PirateBox
January 20, 2013 05:51AM
At this point in the setup:
sed 'sgrinning smileyROOPY_USE_USER="yes"grinning smileyROOPY_USE_USER="no":' -i /opt/piratebox/conf/piratebox.conf

I get the following error:
sed: couldn't open temporary file /opt/piratebox/conf/sed2CY2EP: Permission denied

Earlier in the comments one user suggested changing the DROOP_USE_USER="yes" in piratebox.config. They also suggesting stopping and restarting the piratebox service.

Neither fix solved the problem.

I'm a Windows guy, so I have limited experience with linux. What am I missing?

Any good help is appreciated.
Re: Raspberry Pi PirateBox
January 20, 2013 10:18AM
Hi,
try to run the command with a "sudo" in front of.
It's an issue of the howto, I just corrected.

Matthias

PS: Sudo runs a command as "root" user (administrator)
Re: Raspberry Pi PirateBox
February 24, 2013 08:46PM
Had this same issue with clients not being allowed to connect to the access point. They would not get
an IP address assigned.

Using a TP-Link TL-WN722N USB WiFi stick on a model B rev 1 Pi. Also had to mod the Pi to bypass
the fuses to the USB ports. Not enough power to support the USB WiFi stick in the stock configuration.

The base issue is that wlan0 is not being configured with an IP address (192.168.77.1). Appears that
it may be a timing problem. Possibly the USB WiFi is not ready when piratebox_setup_wlan.sh runs?

Problem occurs randomly from a reboot. Sometimes it works, sometimes not. If I manually set the IP
on wlan0 by running "./piratebox_setup_wlan.sh ../config/piratebox_config start", or just ifconfig'ing the IP
and netmask onto wlan0, it all works great.

As the previous poster said, there is no network-manager running/loaded on the system. I am using the
"2012-12-16 wheezy raspian with PirateBox 0.6C" image.
Re: Raspberry Pi PirateBox
February 24, 2013 09:05PM
Thank you.
Seems like a boot order problem or somthing like that.

I filed it as this issue. We'll have a look onto it.

Matthias
Re: Raspberry Pi PirateBox
February 25, 2013 08:07AM
Can I please you to test a modification for me?

please edit /opt/piratebox/init.d/piratebox and change the top of the script to

### BEGIN INIT INFO
# Provides:          piratebox
# Required-Start:    $all
# Required-Stop:     $network $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      1 0 6
# Short-Description: All services around piratebox
# Description:       Based on /opt/piratebox/conf/piratebox.conf starts:  * DNSMASQ * HOSTAPD * DROOPY * WLAN-config * CHAT
### END INIT INFO

after this change, please run

sudo update-rc.d  piratebox remove
sudo update-rc.d piratebox  defaults

Then try to reproduce the problem with the looesed IP adress on wlan0

Thank you
Matthias
Re: Raspberry Pi PirateBox
February 25, 2013 02:28PM
OK, I updated the piratebox startup script and rebooted the Pi.

I have the Pi connected to a ethernet network also, so it is dhcp'ing an address off of there, too.

After the Pi restarted, I ssh'ed into it and checked wlan0 for an address. It did not have one. Poked
around a bit in /var/log, and didn't see anything striking. Left the Pi for a about 5 minutes and then when
I came back, the ssh connection had dropped. I re-logged in, and checked wlan0. It now has an IP
address.

I'll try some more reboots, and see if there is any consistency.

Grrr. Restarted Pi a bunch of times. I had IP address/wlan0 failure for the first few reboots. Now,
whenever I reboot (clean shutdown, reboot command), the address is assigned properly.

Pulling the power on the Pi while it was up (unclean shutdown), caused the subsequent reboot to
return without an IP assigned to wlan0. Took 2 more reboots (clean) to get an IP assigned at boot time.

Gotta believe this is an initialization timing issue with the USB WiFi stick. Not sure how to test its
readyness, short of checking to see if wlan0 was assigned an address after the ifconfig in piratebox_setup_wlan.sh.
Re: Raspberry Pi PirateBox
February 25, 2013 02:31PM
interesting constellation.

Yes, a bootup-usb-power issue can the problem. I'll test this
Re: Raspberry Pi PirateBox
February 25, 2013 09:08PM
edited
did the patch for myself with some troubles.. will update the stuff soon



Edited 2 time(s). Last edit at 02/26/2013 03:41PM by Matthias.
Re: Raspberry Pi PirateBox
February 26, 2013 07:28PM
Language: PHP
cd /tmp sudo wget http://freeshell.de/~matze/piratebox/piratebox_setup_wlan.sh.patch sudo wget http://freeshell.de/~matze/piratebox/piratebox.conf.patch   sudo patch /opt/piratebox/bin/piratebox_setup_wlan.sh < piratebox_setup_wlan.sh.patch sudo patch /opt/piratebox/conf/piratebox.conf < piratebox.conf.patch

this works and is double tested.

edit: If you give me the feedback that it works, I'll upload a new RPi image containing the new sources



Edited 2 time(s). Last edit at 03/04/2013 07:45PM by Matthias.
Re: Raspberry Pi PirateBox
March 04, 2013 07:27PM
I've got the same problem with my Pi based Piratebox not setting up IP correctly - at the end of the boot sequence you should get the message My IP address is 192.168.1.79 192.168.77.1 When clients can't connect the second IP address is missing. I've downloaded the patch above (had to use sudo in front of both 'wget...' lines and add .patch at the end of ....setup_wlan.sh to get the patching to run) but it is still failing to setup IP correctly. I have tried an Alfa AWUS036NH wifi and a WIPI usb adapter (both powered via a usb hub) and both fail 4 times out of 5

On another problem the piratebox is brilliant at presenting the index.html frontpage to anyone who logs on to the piratebox wifi SSID but on all the browsers/devices I've tried it leaves the original homepage url (eg www.yahoo.co.uk) at the top of the page rather than putting up the new lan url. Is that anything to do with the faulty code in the function fnGetDomain(url) my editor is reporting in index.html ?

On a more positive note I've managed to get samba running so I can publish via the piratebox html pages of info from windows pc's on a separate lan on the ethernet side.
Re: Raspberry Pi PirateBox
March 04, 2013 07:56PM
Quote

I've got the same problem with my Pi based Piratebox not setting up IP correctly - at the end of the boot sequence you should get the message My IP address is 192.168.1.79 192.168.77.1 When clients can't connect the second IP address is missing. I've downloaded the patch above (had to use sudo in front of both 'wget...' lines and add .patch at the end of ....setup_wlan.sh to get the patching to run) but it is still failing to setup IP correctly. I have tried an Alfa AWUS036NH wifi and a WIPI usb adapter (both powered via a usb hub) and both fail 4 times out of 5
I fixed the note above and added the .patch .
Yes, there are a few users with the problem above. I'm still assuming that the boot order is not good at the current image.
So, please adjust /opt/piratebox/init.d/piratebox that the header looks like this

#! /bin/sh
# /etc/init.d/piratebox

### BEGIN INIT INFO
# Provides:          piratebox
# Required-Start:    $all
# Required-Stop:     $network $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      6 1 0
# Short-Description: All services around piratebox
# Description:       Based on /opt/piratebox/conf/piratebox.conf starts:  * DNSMASQ * HOSTAPD * DROOPY * WLAN-config * CHAT
### END INIT INFO
and run

update-rc.d remove piratebox
update-rc.d piratebox defaults

After this, you may encounter some issues with droopy. If you can detect droopy after startup in the process-list (ps), exchange /opt/piratebox/bin/droopy with this fixed version of github.
We are going to release a new image soon, including these fixes.


Quote

On another problem the piratebox is brilliant at presenting the index.html frontpage to anyone who logs on to the piratebox wifi SSID but on all the browsers/devices I've tried it leaves the original homepage url (eg www.yahoo.co.uk) at the top of the page rather than putting up the new lan url. Is that anything to do with the faulty code in the function fnGetDomain(url) my editor is reporting in index.html ?
Yes, currently there is no hostname based redirect. The "faulty code" was an idea to improve one of the iframes (droopy)... it is not active.
The hostname switch only happens in the fork OFFLINEART for the same named project and is not implemented in PirateBox (yet). To get the hostname based redirect working properly, you need to generate a few lighttpd-config files for that....
Re: Raspberry Pi PirateBox
March 05, 2013 02:45PM
I've tried the init.d mod above on both my 'modified with samba' version and on a clean image 'straight out of the download' and unfortunately both show the same prob still, with both the Alfa Wifi and a WIPI. All of this is on a 256 Pi but it seems the same on a 512 As the Wifi adapter is on a separate usb hub I've tried powering that up and down at reboot as well, without any apparent effect.
Re: Raspberry Pi PirateBox
March 05, 2013 03:32PM
can you please connect a monitor and see the bootup and check what is going on when the piratebox-init.d stuff comes in place?
This is my last idea about that.

I have this TL-WN722N USB dongle and tested it today again without issues.. (only last option is that the interface probing via patch is invalid).

Maybe the alfa-wifi takes much longer that something else to get ready .. you maybe change the CNT from 10 to 30 in /opt/piratebox/bin/piratebox_setup_wlan.sh set- then the script wait 30 seconds until the device is ready....
Re: Raspberry Pi PirateBox
March 05, 2013 05:41PM
I've tried a range of unsuccessful combinations - changing channel on nearby home router from 1 (conflicts?) to 11, turning all nearby wifi routers off (checked with scanner), powering wifi adapters from pi itself or from powered hub, using either Alfa adapter or smaller WIPI adapter.
The only combo that (so far) exhibits perfect operation with a score of no fails in 10 tries is to leave ethernet lead out of Pi. If I plug ethernet lead in to router ( with routers wifi turned off) performance drops immediately! Does that give any clues?

In the process I've killed the samba modded version SD card itself, so this is all based on out of the box piratebox image - Ho Hum...

Haven't tried looking at the init.d on bootup - is that the stuff that follows [....] Starting script piratebox : ?
Thanks
Re: Raspberry Pi PirateBox
March 05, 2013 06:23PM
>> can you please connect a monitor and see the bootup and check what is going on when the piratebox-init.d stuff comes in place?

Did you this to see if something "fails" during startup?
Re: Raspberry Pi PirateBox
March 05, 2013 07:50PM
please be patient.. it seems it started to occur for me to know (after reflashing my sdcard)
Re: Raspberry Pi PirateBox
March 05, 2013 08:07PM
This is the stuff that appears towards the end of the boot sequence. Hopefully I've replicated it accurately complete with ....:.

[ ok ] Starting OpenBSD Secure Shell server: sshd
My IP address is 192.168.1.79 -----see my note below
[….] Starting script piratebox :
Generating hosts file ….
Generating dnsmasq…..
Generating Environment-config for ligttpd …..
Empty tmp folder
rm: cannot remove ‘/opt/piratebox/tmp’ : Is a directory
[….] Setting up wlan : Probing interface wlan0Bringing up wifi interface wlan0
Setting up wlan0
[ ok ] Starting hostap… :.
[ ok ] Starting dnsmasq… :.
[ ok ] Starting droopy…:.
Generated HTML-Shoutbox File.
[ ok ] Starting lighttpd…:.

Debian GNU/Linux wheezy/sid raspberrypi tty1

Raspberrypi login:

Note: This line is missing when the pi successfully boots up with the Ethernet unplugged
The line is there with Ethernet in and is unchanged whether boot is successful or not
None of the other lines change at all
I can't see any lines higher up the boot sequence which are varying with/without success
Hope this helps
Re: Raspberry Pi PirateBox
March 05, 2013 08:13PM
The my IP Adress line is only a simple script which I just checked... without success.. it only checks if some ip exists.

I just created a modified init.d/piratebox file to write down a few things to the disc, but since them the problem does not occur again. hmpf

edit: i tried several methods during startup: softreboot; soft off & on ; hard off & on
edit2: After having an process list, I can assume, that it again something with that fu*** network manager, which interferes.



Edited 2 time(s). Last edit at 03/05/2013 08:25PM by Matthias.
Re: Raspberry Pi PirateBox
March 05, 2013 08:30PM
What you can try, it worked for me at three reboots.

sudo nano /etc/network/interfaces

auto lo

iface lo inet loopback
iface eth0 inet **manual**


iface wlan0 inet manual
      pre-up ifconfig $IFACE up
      post-down ifconfig $IFACE down

### disalbed for PirateBox
#allow-hotplug wlan0
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp

add these lines
      pre-up ifconfig $IFACE up
      post-down ifconfig $IFACE down

Maybe it fixes it
Re: Raspberry Pi PirateBox
March 05, 2013 09:08PM
I've found another combo that works reliably (no fails in 10 tries) - ethernet in, with WIPI and USB keyboard directly into pi ie no usb hub and no mouse. Since this thing will normally operate headless thats at least a useful combo!
I've put hub back between keyboard and thats now failing so I'll try your latest mod and report back!

Update - the keyboard doesn't seem to work now via the hub so I think the hub is suspicious - I'll get a new one tomorrow and report back



Edited 1 time(s). Last edit at 03/05/2013 09:18PM by keitho.
Re: Raspberry Pi PirateBox
March 06, 2013 07:11AM
Tested my RPi this morning again.

1. boot - totally cold ; ok.
2. boot- short-off & on ok
3. boot wihtout ethernet ; tested wifi with my mobile phone => ok, no lag
Re: Raspberry Pi PirateBox
March 06, 2013 12:20PM
I think its getting a little clearer! Your latest mod doesn't seem to solve the boot prob so I've reverted to previous mods. The old usb hub seems to be contributing to yesterdays prob but with a new hub I've got 100% successful bootup with the ethernet in, no mouse, a keyboard direct into pi and the WIPI adapter either direct into pi, on the new hub powered or on the new hub unpowered.

What isn't now working at all in any config is the ALFA AWUS036NH adapter although my notes show it worked occasionally yesterday. I haven't installed any specific drivers for the WIPI or the ALFA - does the ALFA need drivers on the pi?

Thanks.