Manual Raspbian Lite 2017-03-02 Build Issues

Posted by bfesser 
Manual Raspbian Lite 2017-03-02 Build Issues
March 21, 2017 01:02PM
Hello,

I've been trying, for a couple weeks, to build a PirateBox based on 2017-03-02-raspbian-jessie-lite.img, for use on a Raspberry Pi Zero V1.2 with a RedBear IoT pHAT v1.0. For my anticipated use case, storage on the RasPi's SD card should be sufficient, so I'm not connecting any external USB storage.

I've run the install script (sudo ./install.sh board), after enabling SSH, on a freshly imaged SD card. I'm connecting to the Raspberry Pi via a Linksys USB100M Ethernet adapter, for the purposes of the installation and configuration. Once the installation script has completed, the WiFi AP appears, but on attempted connection, it fails to assign an IP address to the client. This was solved by running:

sudo systemctl stop dnsmasq
sudo systemctl disable dnsmasq
sudo systemctl restart piratebox

After reconnecting to the WiFi access point, I'm greeted with a lighttpd placeholder page:

Quote

Placeholder page

The owner of this web site has not put up any web pages yet. Please come back later.
. . .

I've spent quite a few days pouring over the PirateBox scripts and various configuration files, but I'm at a complete loss as for what to do now. The contents of a few files that I think might be relevant:

/etc/lighttpd/lighttpd.conf
server.modules = (
	"mod_access",
	"mod_alias",
	"mod_compress",
 	"mod_redirect",
#       "mod_rewrite",
)

server.document-root        = "/var/www/html"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log"
server.pid-file             = "/var/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"
server.port                 = 80


index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny             = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )

# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

/opt/piratebox/conf/lighttpd/lighttpd.conf
## Configuration for Piratebox

server.modules = (
# 	"mod_access",  not needed!
	"mod_alias",
#	"mod_compress",  Disabled, fixing reload Problem??
 	"mod_redirect",
#       "mod_rewrite",
        "mod_setenv",
	"mod_fastcgi"
)

server.document-root        = "/opt/piratebox/www"

## Locate the tmp storage into tmp. It is in most cases the ram
## Limit the uploads to 5MB to save - especially on small devices
## the device from dieing because OUT-OF-RAM exceptions
##     in KB  => 5MB 
server.upload-dirs          = ( "/tmp" )
server.max-request-size = 5120

server.errorlog             = "/opt/piratebox/tmp/error.log"
server.breakagelog 	    = "/opt/piratebox/tmp/break.log"
server.pid-file             = "/opt/piratebox/tmp/lighttpd.pid"

 server.username             = "nobody"
 server.groupname            = "nogroup"



index-file.names            = ( "index.php", "index.html",
                                "index.htm", "default.htm",
                               " index.lighttpd.html" )

url.access-deny             = ( "~", ".inc" )

# added .cgi .py
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" , ".cgi" , ".py" )


# Enable lighttpd on ipv6
$SERVER["socket"] == "[::]:80" {  }

dir-listing.encoding         	= "utf-8"
server.dir-listing           	= "enable"

# Grabs main css
dir-listing.external-css     	= "/content/css/page_style.css"

# Header
# Enables header section
dir-listing.show-header      	= "enable"
dir-listing.encode-header	= "disable"
# Hides HEADER.txt from listing
dir-listing.hide-header-file	= "enable"

# Footer
# Enables footer section
dir-listing.show-readme		= "enable"
dir-listing.encode-readme	= "disable"
# Hides README.txt from listing
dir-listing.hide-readme-file	= "enable"
# Diables default footer text
dir-listing.set-footer		= " "

# Disabled, maybe fixes reload problem on imageboard
#compress.cache-dir          = "/var/cache/lighttpd/compress/"
#compress.filetype           = ( "application/x-javascript", "text/css", "text/html", "text/plain" )

#n.a. on router    include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include "/opt/piratebox/conf/lighttpd/mime.types" 

#----------- ShoutBox-Env --------------
include "/opt/piratebox/conf/lighttpd/env"

#----------- cgi.conf --------------
server.modules += ( "mod_cgi" )

$HTTP["url"] =~ "^/cgi-bin/" {
#	cgi.assign = ( "" => "" ) 
  	cgi.assign = ( ".py" => "/usr/bin/python" )
}

## Warning this represents a security risk, as it allow to execute any file
## with a .pl/.py even outside of /usr/lib/cgi-bin.
#
#cgi.assign      = (
#	".pl"  => "/usr/bin/perl",
#	".py"  => "/usr/bin/python",
#)

$HTTP["url"] =~ "^/board/" {
    cgi.assign = ( ".pl" => "/usr/bin/perl" , )
}
#-------------------------------------


setenv.add-response-header += ( "Cache-Control" => "max-age=60, must-revalidate, no-store, no-cache, public" ) 

# 404 Error Page with redirect
#
server.error-handler-404 = "/redirect.html"

## for better debugging
#server.modules += ( "mod_accesslog" )
#accesslog.filename = "/opt/piratebox/tmp/access.log"


# Fix for iOS7
#   It ask especially different domains without a specific URL.
#   It want to get a "success" message, to allow full system/internet access
$HTTP["useragent"] =~ "CaptiveNetworkSupport" {
        server.document-root =  "/opt/piratebox/www/library/test/"
        index-file.names        = ( "success.html" )
        dir-listing.activate    = "disable"
        server.error-handler-404 = "/success.html"
}


include "/opt/piratebox/conf/lighttpd/fastcgi-php-generate203.conf"

## Uncommenting the following line enables PHP for the 
## complete PirateBox
#include "/opt/piratebox/conf/lighttpd/fastcgi-php.conf"

/opt/piratebox/conf/piratebox.conf
#########
## Config for pirate-box WWW Release
##  written by Matthias Strubel  (matthias.strubel@aod-rpg.de) (c)2011-2014 
##  licenced under the GPL-3 ; feel free to improve or send me feedback
########
## 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+website)
##     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 dnsmasq add the /etc/hosts entrys 
##        Have a look at [www.piratebox.cc] for futher instructions
##    
##    You may deactivated severall option as needed. It's flexible.


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

PIRATEBOX_FOLDER="/opt/piratebox"
WWW_FOLDER="/opt/piratebox/www"
WWW_CONTENT="/opt/piratebox/share/content" 

#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="no"
#Iw physical interface  
PHY_IF="phy0"

# Check if interface exists
#  should be set to yes if you use a USB wifi card
PROBE_INTERFACE="no"
#  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 wifi-card 
USE_APN="yes"
#   act like dns&dhcp (dnsmasq) 
USE_DNSMASQ="yes"

#HOSTNAME  ... if you really want to change it, plz change:
#   www/index.html
#
#   That is the Domain-Specifi part, where you reach always the local box
HOST="piratebox.lan"

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

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

#Network
NET=192.168.77

#IP-SHORT (is stringed together)
#  What IP does your Box have??  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


#--------------------------------------------------------------------------#
# Node-Config path

NODE_CONFIG="$PIRATEBOX_FOLDER/conf/node.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=""

#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
#   The following line needs to be commented for FAT32 / vfat partitions
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/piratebox/chat/cgi-bin/py* files )
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"

### Shoutbox is enabled. 
# When you set this option to "no", then the shoutbox file is not writable anymore
#   and in the json file the module is disabled. You should adjust the chat_init.txt 
#   to make clear, that the box is not working anymore.
SHOUTBOX_ENABLED="yes"

SHOUTBOX_CLIENT_TIMESTAMP="no"

#Inititiation Chat-Message
### This option was removed, you can find the chat message in conf/chat_init.txt

#Provide files needed for PirateBox custom dirlisting
CUSTOM_DIRLIST_COPY="yes"

#Generate config json for frontend
PBX_JSON_GENERATION="yes"
PBX_JSON_FILE="$WWW_FOLDER/piratebox_config.json"

#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


#------------------------ IRC Configuration

#Switch to yes if you want to enable the IRC-Server
ENABLE_IRC_SERVER="no"
IRC_USER="$LIGHTTPD_USER"

## If you want to save rooms and so on, create the folder
#  /opt/piratebox/share/IRC_STATE and make sure it is writeable
#  for IRC_USER (nobody per default)
#IRC_STATE_DIR="$SHARE_FOLDER/IRC_STATE"

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

Any advice would be greatly appreciated. Thank you for your time.

Regards,
Brandon F.
Re: Manual Raspbian Lite 2017-03-02 Build Issues
March 28, 2017 04:48AM
Uh, you need to stop lighttpd and install php. I think I had a discussion about this a few days before.
Re: Manual Raspbian Lite 2017-03-02 Build Issues
April 04, 2017 12:44PM
So, a summary of my setup procedure — mostly notes for my own use, but perhaps someone else may benefit. Don't try to run these commands verbatim!

Erase, image, and prepare SD card:
lsblk
sudo umount /dev/sdb1 /dev/sdb2
sudo dcfldd if=/dev/zero of=/dev/sdb
sync

sudo dcfldd if=2017-03-02-raspbian-jessie-lite.img of=/dev/sdb
sync
sudo eject /dev/sdb
[remove and re-insert card-reader]

cd /run/media/bfesser/boot/
touch ssh
cd
sync
sudo eject /dev/sdb

Insert SD card into RasPi, connect µUSB Ethernet & power, wait for partition re-size and reboot.

Connect to RasPi through SSH and perform pre-install configuration:
ssh -l pi raspberrypi.local
sudo raspi-config
- enable SSH
- change password
- change hostname
- localization (en_US.UTF-8; US, Central; US)
- memory split (16Mcool smiley
- reboot


Re-connect via SSH, update packages, and install Piratebox:
ssh -l pi <hostname>.local

sudo apt-get update && sudo apt-get upgrade -y

sudo apt-get -y install lighttpd
sudo /etc/init.d/lighttpd stop
sudo update-rc.d lighttpd remove

sudo apt-get -y install dnsmasq 
sudo /etc/init.d/dnsmasq  stop
sudo update-rc.d dnsmasq remove 

sudo apt-get -y  install hostapd
sudo /etc/init.d/hostapd  stop
sudo update-rc.d hostapd remove 

sudo apt-get -y install iw php5-cgi
sudo lighttpd-enable-mod fastcgi fastcgi-php

wget  http_//downloads.piratebox.de/piratebox-ws_current.tar.gz
tar xzf piratebox-ws_current.tar.gz
sudo ./piratebox/install.sh board
sudo update-rc.d piratebox defaults

sudo systemctl stop dnsmasq
sudo systemctl disable dnsmasq
sudo systemctl restart piratebox

sudo /opt/piratebox/bin/timesave.sh /opt/piratebox/conf/piratebox.conf install
sudo /opt/piratebox/bin/install_piratebox.sh /opt/piratebox/conf/piratebox.conf imageboard
sudo nano /opt/piratebox/www/board/config.pl
...change ADMIN_PASS and SECRET.
sudo apt-get install minidlna
sudo cp /etc/minidlna.conf /etc/minidlna.conf.bkp
sudo cp /opt/piratebox/src/linux.example.minidlna.conf /etc/minidlna.conf
sudo update-rc.d minidlna defaults
sudo service minidlna start

sudo reboot



Edited 8 time(s). Last edit at 04/05/2017 01:55AM by bfesser.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically.
  ******   **    **  **     **  ********   ********  
 **    **   **  **    **   **   **     **  **     ** 
 **          ****      ** **    **     **  **     ** 
 **           **        ***     ********   **     ** 
 **           **       ** **    **         **     ** 
 **    **     **      **   **   **         **     ** 
  ******      **     **     **  **         ********  
Message: