This is an old revision of the document!
Piratebox on the A5-V11
If you liked having Piratebox on the Zsun. I am now bringing it to you now on a device the size of a pack of gum! After many MONTHS of installing, troubleshooting, resetting e.d. I now have a complete working Piratebox installation for the A5-V11. I would like to share my installation scripts in order to let you install your own.
This tutorial was created with OpenWRT LEDE 18.06.5 using the similar Zsun manual method
This tutorial is for the technical minded but should be simple to follow until we get a full install package/script working for extroot. NOBODY will take responsibility or be liable for anything you do to your device. If you brick it trying these procedures, YOU are solely responsible for your actions. YOU HAVE BEEN WARNED. However, we can try and help in the forums. This has been recently tested on Nov 17, 2019 and working with PirateBox v1.1.4.
0a. PreSetup A5-V11 from STOCK FIRMWARE
You need:
- laptop/PC with Ethernet Port
- telnet client (I use putty)
- Ethernet Cable
- VFAT formatted USB flash drive (might not be empty)
Download:
- u-boot 256 This is version 3 which supports recovery from USB as well as TFTP and serial.
- Copy them to USB drive, rename OpenWrt image to firmware.bin
- Connect your laptop/PC to the A5-V11 via Ethernet and power up the A5-V11
- Connect the USB Flash drive to the A5-V11
- Telnet to the A5-V11 with the following command:
telnet 192.168.100.1
- The username and password are admin
- Mount the USB flash drive with the following command:
mount /dev/sda1 /mnt
- Wait a few seconds and verify that you see files
ls /mnt
- You should see your files. Do not go further if you do not see files !
- Upgrade uboot - be careful, do not reset router during and after this operation !
mtd_write write /mnt/uboot256.img Bootloader
- You should see on console
#Unlocking Bootloader … #Writing from /mnt/uboot256.img to Bootloader … [w]
- Upgrade firmware - do not reset router during this operation!
mtd_write write /mnt/firmware.bin Kernel
- You should see on console
#Unlocking Kernel … #Writing from /mnt/firmware.bin to Kernel … [w]
Reboot router with the following command.
reboot
0b. PreSetup A5-V11 from OpenWRT
You need:
- laptop/PC with Ethernet Port
- pscp client (windows cli)
- Ethernet Cable
Download:
- In a command line interface be it bash for linux or CMD for Windows, copy over the sysupgrade using pscp. below is an example.
pscp -scp "C:\path\to\image\openwrt-ramips-rt305x-a5-v11-squashfs-sysupgrade.bin" root@192.168.1.1:/tmp/firmware.bin
- Connect to your A5-V11 device via SSH and run
sysupgrade -n -v /tmp/firmware.bin
Your device should reboot once the update is complete. Now, I had an issue with my old uboot not letting it boot due to bad magic. Fortunatly I was able to recover by installing the updated uboot256.img via serial and tftp.
1a. Network Debacle
I have an issue with my router that ANY device connected to it via static IP wont recieve DNS addresses from the gateway (my router). Here is a simple fix if you cant ping google.com from your A5-V11.
uci set network.lan.proto='dhcp' uci commit service network reload
Now try pinging google.com
ping google.com
if you see success, kill ping with a CTRL+Z
1b. Setup Mounts
Format USB Drive
- Copy and paste one line at a time
cd /tmp export LD_LIBRARY_PATH='/lib:/usr/lib:/tmp/lib:/tmp/usr/lib' opkg update && opkg install -d ram e2fsprogs dosfstools fdisk wget http://druss.org/public/parts chmod +x /tmp/parts ./parts /tmp/usr/sbin/mkfs.fat /dev/sda1 /tmp/usr/sbin/mkfs.ext4 /dev/sda2
- copy and paste into command shell
mkdir -p /opt/piratebox/share uci add fstab mount uci set fstab.@mount[-1].target=/opt/piratebox/share uci set fstab.@mount[-1].device=/dev/sda1 uci set fstab.@mount[-1].fstype=vfat uci set fstab.@mount[-1].options=rw,sync uci set fstab.@mount[-1].enabled=1 uci set fstab.@mount[-1].enabled_fsck=0 uci commit mkdir /mnt/sda2 mount -t ext4 /dev/sda2 /mnt/sda2 tar -C /overlay -cvf - . | tar -C /mnt/sda2 -xf - uci add fstab mount uci set fstab.@mount[-1].target=/overlay uci set fstab.@mount[-1].device=/dev/sda2 uci set fstab.@mount[-1].fstype=ext4 uci set fstab.@mount[-1].options=rw,sync uci set fstab.@mount[-1].enabled=1 uci set fstab.@mount[-1].enabled_fsck=0 uci commit reboot
- Reconnect to device
At this point, if you botch anything below, you can pull the USB drive, kill the partitions and start over at step 1b.
2. Install Packages
- Copy and paste each code block and reboot between installation blocks as noted. Due to “newer” packages, I have been running out of ram and I am having to split them up so the process doesn't kill itself while configuring. I will work on an alternate solution soon.
opkg update && opkg install python lighttpd lighttpd-mod-cgi lighttpd-mod-redirect lighttpd-mod-alias lighttpd-mod-setenv lighttpd-mod-fastcgi
- Reboot
opkg update && opkg install perl perlbase-base perlbase-cgi perl-cgi perlbase-essential perlbase-file perlbase-bytes perlbase-config perlbase-data perlbase-db-file perlbase-digest perlbase-encode perlbase-encoding perlbase-fcntl perlbase-gdbm-file perlbase-integer perlbase-socket perlbase-time perlbase-unicode perlbase-unicore perlbase-utf8 perlbase-xsloader
You may get an error that it couldn't install pearlbase-cgi, package is missing. Included perl-cgi and looking into it further.
- Reboot
opkg update && opkg install php7-cgi php7-fastcgi unzip minidlna
LEDE 18.06 does not have php5 but php7. Lets hope this doesn't mess too much up.
- Reboot
2-5. Lets set up wifi
uci set wireless.radio0.disabled=0 uci set wireless.@wifi-iface[0].ssid='Piratebox - Share Freely' uci commit /etc/init.d/network reload && wifi
3. Set-up Piratebox, Imageboard & MiniDLNA
- Copy and paste each line separately.
cd /tmp wget http://downloads.piratebox.de/piratebox-ws_current.tar.gz tar xzf piratebox-ws_current.tar.gz cd piratebox cp -rv piratebox /opt cp /opt/piratebox/src/openwrt.example.minidlna /etc/config/minidlna sed -i 's|DO_IFCONFIG="yes"|DO_IFCONFIG="no"|g' /opt/piratebox/conf/piratebox.conf sed -i 's|USE_APN="yes"|USE_APN="no"|g' /opt/piratebox/conf/piratebox.conf sed -i 's|NET=192.168.77|NET=192.168.1|g' /opt/piratebox/conf/piratebox.conf sed -i 's|DNSMASQ_INTERFACE="wlan0"|DNSMASQ_INTERFACE="br-lan"|g' /opt/piratebox/conf/piratebox.conf sed -i 's|DROOPY_CHMOD|#DROOPY_CHMOD|g' /opt/piratebox/conf/piratebox.conf sed -i 's|getenv = CDLL("libc.so.6").getenv|getenv = CDLL("libc.so.0").getenv|g' /opt/piratebox/bin/droopy /etc/init.d/lighttpd stop /etc/init.d/lighttpd disable /opt/piratebox/init.d/piratebox_alt start /opt/piratebox/bin/install_piratebox.sh /opt/piratebox/conf/piratebox.conf imageboard /opt/piratebox/bin/board-autoconf.sh
- Enter in a code for your imageboard.
uci set network.lan.proto='static' uci set system.@system[0].hostname='piratebox' uci commit service network reload && /etc/init.d/system reload
- Press Enter (you will be disconnected)
- Reconnect to 'Piratebox - Share Freely' SSID and back to 192.168.1.1
4. Create piratebox start
vi /etc/init.d/piratebox
- Copy the below code. In your shell window, press I to insert text then right-click or paste to insert. Be sure ALL of it has been pasted. Press ESC, SHIFT+Z, Shift+Z to save. (editor will auto close)
#!/bin/sh /etc/rc.common NAME=piratebox START=55 STOP=20 start() { /opt/piratebox/init.d/piratebox_alt start } stop() { /opt/piratebox/init.d/piratebox_alt stop }
5. Finalization
- Copy and paste each line separately.
chmod +x /etc/init.d/piratebox /etc/init.d/piratebox start /etc/init.d/piratebox enable reboot
6. Options are optional
~Sarge, RvB
6.1 Enable PHP
sed -i 's|#include "/opt/piratebox/conf/lighttpd/fastcgi-php.conf"|include "/opt/piratebox/conf/lighttpd/fastcgi-php.conf"|g' /opt/piratebox/conf/lighttpd/lighttpd.conf sed -i 's|doc_root =|;doc_root =|g' /etc/php.ini echo "<?php phpinfo() ?>" > /opt/piratebox/share/content/phpinfo.php /etc/init.d/piratebox reload
- test
http://piratebox.lan/content/phpinfo.php you should get a long php info page of stuff. If it works, you can delete the phpinfo page with this command.
rm /opt/piratebox/share/content/phpinfo.php
6.2 Enable IRC
- Copy and past each line
sed -i 's|ENABLE_IRC_SERVER="no"|ENABLE_IRC_SERVER="yes"|g' /opt/piratebox/conf/piratebox.conf /etc/init.d/piratebox restart
6.3 Change Upload Folder
mkdir -p /opt/piratebox/share/Shared/Uploaded sed -i 's|UPLOADFOLDER="$SHARE_FOLDER/Shared"|UPLOADFOLDER="$SHARE_FOLDER/Shared/Uploaded"|g' /opt/piratebox/conf/piratebox.conf /etc/init.d/piratebox restart
7. Fixes
- MiniDLNA
Minidlna config points to the wrong path. So we need to fix it
vi /etc/config/minidlna
Press I on the keyboard to get into edit mode
change the line that reads list media_dir '/mnt/usb/PirateBox/Shared/'
to list media_dir '/opt/piratebox/share/Shared/'
Press SHIFT+Z, SHIFT+Z on the keyboard to save.
/etc/init.d/minidlna reload
to save changes
Credits
- Matthias - for the Piratebox Project and updated code.
- meduza - for the majority of the scripting for the Zsun.
- stylesuxx - for the wifi configuration and troubleshooting.
- TheExpertNoob - for troubleshooting and this wiki guide.
If I forgot anyone else, PM me.