User Tools

Site Tools


PirateBox on a extroot System

Usually the PirateBox is installed on a FAT USB Stick using different loopback devices for extending the root filesystem. The loopback devices are pointing to files, that ext3-filesystems. In some cases you don't want to have this, or you want to have a bigger ext3 root using the OpenWrt extroot system. The following steps are based upon OpenWrt's wiki on extroot.

The following steps assume:

  • The extroot device is a USB Stick and the ext3 partition is the first
    • If not, apply your custom configuration (i.e. SDCard has a different dev-node name , different partition name)
  • You have prepared the USB Stick for yourself
  • The following steps only includes the basic PirateBox steps. You won't have an auto installer or box-install-setup scripts
  • You already have installed OpenWrt on the box (not the custom images from the auto directory)
  • You Box is powered and you are logged in via telnet or serial access

Make internet available at the system

The easiest way to make Internet available is on system, which have a dedicated WAN port. It will work out of the box if you home network is not

On systems with only one ethernet port like the MR3020 or VoCore you have two options:

Use Wifi for internet connection

If you use the wifi method, you can easily stay connected via ethernet cable. The pitfall on this method is, that the wifi settings are being lost during the PirateBox installation1). To prevent a failing installation you have to do a few additional steps later.

The steps to setup the wifi for internet connection is are the following. Change the SSID to you home SSID. If you home SSID or passphrase contains whitespaces, enclose the name with '. If you homenetwork is unecrypted, leave out the encryption and key line. Lern more about the correct settings on OpenWrt's wiki page. This does not work with a wifi containing a captive portal.

uci set  network.wlan=interface
uci set  network.wlan.proto=dhcp
uci set  wireless.radio0.disabled=0
uci set  wireless.@wifi-iface[0].mode=sta
uci set  wireless.@wifi-iface[0].ssid=<you homenetwork>  
uci set  wireless.@wifi-iface[0].encryption=psk2  
uci set  wireless.@wifi-iface[0].key=<your wifi  password>   
uci commit
/etc/init.d/network  restart

Use LAN Port for internet connection

If you are connected via wifi, you will be disconnected during the installation, because the wifi settings changes and you are only able to connect to the box with a static IP adress and the new wifi SSID “PirateBox - Share freely”. If you are connected via serial access, this is the easiest version.

cp /etc/config/network /etc/config/network.backup
uci set network.wan=interface 
uci set network.wan.ifname=$( uci get network.lan.ifname )
uci set network.wan.macaddr=$( uci get network.lan.macaddr )  ## this line is needed at VoCore
uci set network.wan.proto=dhcp
uci del network.lan.ifname
uci commit

Then connect the box via ethernet cable

Check internet

Make sure your internet is working on the Box.

ping -c

Install needed packages for extroot

If you use one of our prepared images you can find on this step can be skipped.

opkg install
opkg update
opkg install kmod-usb-storage kmod-fs-ext4 block-mount kmod-usb2
reboot & exit                   

Expected error messages are:

kmod: failed to insert /lib/modules/3.10.49/sd_mod.ko
kmod: failed to insert /lib/modules/3.10.49/usbcore.ko
kmod: failed to insert /lib/modules/3.10.49/ext4.ko

These are the reason, why this steps ands with an reboot to properly load the kernel modules

Enable extroot

Reconnect to the Box after the reboot (and login). The following commands apply to the BarrierBreaker-release of OpenWrt.

Then run the following commands:

mkdir /mnt/sda1 
mount /dev/sda1 /mnt/sda1
tar -C /overlay -cvf - . | tar -C /mnt/sda1 -xf -
uci add fstab mount
uci set fstab.@mount[-1].target=/overlay
uci set fstab.@mount[-1].device=/dev/sda1
uci set fstab.@mount[-1].fstype=ext3
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

After this reboot the extroot is available.

Check extroot

Reconnect to the Box after the reboot. Check if the box accepted the extroot, run mount and compare it to the following example

rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,noatime)
sysfs on /sys type sysfs (rw,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/sda1 on /overlay type ext4 (rw,relatime,data=ordered)        <----- this line
overlayfs:/overlay on / type overlayfs (rw,noatime,lowerdir=/,upperdir=/overlay) <----- this line
tmpfs on /dev type tmpfs (rw,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)

Install PirateBox

The next steps are used for installing the basic PirateBox.

Prepare Steps for Wifi internet

The following step is needed if you use wifi as internet connection (true for VoCore):

mkdir -p  /mnt/usb/install/
cd  /mnt/usb/install/

FIXME It should be possible to download all needed packages using the cache option. With a clever use of the opkg options, you should be able to install all needed stuff for the imageboard and minidlna.


Prepare configuration

PirateBox relies on the ext.config2). So we change the configuration.

opkg update
opkg install extendRoot          ## we only make use of the configuration file
sed -i 's|ext_linktarget="/usr/local"|ext_linktarget=""|g'  /etc/ext.config

Install PirateBox

Then we go ahead installing PirateBox

opkg update
opkg install piratebox
#The following commands is that the upload-daemon is running with the lighttpd user
sed -i 's|DROOPY_USE_USER="no"|DROOPY_USE_USER="yes"|g' /opt/piratebox/conf/piratebox.conf
/opt/piratebox/bin/  /opt/piratebox/conf/piratebox.conf part2

After this, do a reboot.

Yes, with that way of the installation, the content in opt/piratebox is still use a loopback interface.

Post Installation Steps

(for Wifi-Internet) Reset the settings

After the PirateBox script has finished, some settings needs to be restored.

uci set wireless.@wifi-iface[0].mode=ap
uci set wireless.@wifi-iface[0].encryption=none
uci set wireless.@wifi-iface[0].network=lan
uci commit

After the next reboot the access point for PirateBox should be working as expected.

(for LAN-Internet) Reset the settings

The next step is to make the lan port usable for PirateBox as well.

uci set network.lan.ifname=$( uci get network.wan.ifname )
uci del network.wan=interface
uci commit

After the next reboot the LAN port is reachable under the IP

PirateBox Post-installation

  1. Set a password using passwd command
  2. Board is not installed.
  3. You don't need the timesave function anymore, because it is now included to BreakingBarrier3). If you still want to enable the timesave function, run
/opt/piratebox/bin/  /opt/piratebox/conf/piratebox.conf install
/etc/init.d/piratebox timesave
This will be changed in future in a way, that the changed settings will be available after a reboot
I tried to make in independed, but it seems there are some coding issues in 1.0 PirateBox
it restores the oldest timestamp found on the disk. We might need to add an additional cron for regulary updating a timestamp
openwrt/extroot.txt · Last modified: 2015/02/09 07:34 by matthias