USB memory needs to be recreate / reinstalled

Posted by angoca 
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
USB memory needs to be recreate / reinstalled
December 17, 2016 08:38PM
I had a working PirateBox with a TP-Link MR3020; but the USB was removed, modified, and finally everything in the memory was deleted.

Now, I need to regenerate the content on this USB drive (the piratebox functionallity), but I do not know how to do it. I have tried to put the install directory in the memory, but nothing happens when I start the Pirate Box

These are the ouputs of the commands:

root@OpenWrt:/etc/init.d# mount
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,size=14592k)
tmpfs on /dev type tmpfs (rw,noatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,noatime,mode=600)
/dev/mtdblock3 on /overlay type jffs2 (rw,noatime)
overlayfs:/overlay on / type overlayfs (rw,relatime,lowerdir=/,upperdir=/overlay)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
/dev/sda1 on /mnt/usb type vfat (rw,noatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro)
none on /proc/bus/usb type usbfs (rw,relatime)
root@OpenWrt:/etc/init.d#  ls -la /mnt/
drwxr-xr-x    1 root     root             0 Jan  1 00:01 .
drwxr-xr-x    1 root     root             0 Jan  1 00:00 ..
drwxr-xr-x    2 root     root             0 Jan  1 00:01 ext
drwxrwxrwx    3 root     root         16384 Jan  1 00:20 usb
root@OpenWrt:/etc/init.d#  ls -la /mnt/usb
drwxrwxrwx    3 root     root         16384 Jan  1 00:20 .
drwxr-xr-x    1 root     root             0 Jan  1 00:01 ..
drwxrwxrwx    3 root     root         16384 Jan  1  1980 install
root@OpenWrt:/etc/init.d#  ls -la /mnt/usb/PirateBox
ls: /mnt/usb/PirateBox: No such file or directory
root@OpenWrt:/etc/init.d#  ls -la /mnt/usb/install
drwxrwxrwx    3 root     root         16384 Jan  1  1980 .
drwxrwxrwx    3 root     root         16384 Jan  1 00:20 ..
-rwxrwxrwx    1 root     root          4096 Dec 17  2016 ._OpenWRT.img.gz
-rwxrwxrwx    1 root     root          4096 Dec 17  2016 ._auto_package
-rwxrwxrwx    1 root     root          4096 Dec 17  2016 ._cache
-rwxrwxrwx    1 root     root          4096 Dec 17  2016 ._kareha_3.1.4.zip
-rwxrwxrwx    1 root     root          4096 Dec 17  2016 ._piratebox_ws_1.1_img.tar.gz
-rwxrwxrwx    1 root     root        108531 Oct  5  2016 OpenWRT.img.gz
-rwxrwxrwx    1 root     root            99 Jan  1  1980 auto_package_done
drwxrwxrwx    2 root     root         32768 Dec 17  2016 cache
-rwxrwxrwx    1 root     root        222185 Oct  5  2016 kareha_3.1.4.zip
-rwxrwxrwx    1 root     root        237503 Oct  5  2016 piratebox_ws_1.1_img.tar.gz
root@OpenWrt:/etc/init.d#  ls -la /opt/piratebox
ls: /opt/piratebox: No such file or directory
root@OpenWrt:/etc/init.d#  ls -la /opt/piratebox/www
ls: /opt/piratebox/www: No such file or directory
root@OpenWrt:/etc/init.d#  cat /etc/pbx_custom_image
PBX_auto_Image_2.3.2
root@OpenWrt:/etc/init.d#  cat /etc/openwrt_release
DISTRIB_ID="OpenWrt_backports"
DISTRIB_RELEASE="12.09.2"
DISTRIB_REVISION="r42647"
DISTRIB_CODENAME="attitude_adjustment"
DISTRIB_TARGET="ar71xx/generic"
DISTRIB_DESCRIPTION="OpenWrt_backports Attitude Adjustment 12.09.2"
DISTRIB_BACKPORT="V0.3-MaStr"
root@OpenWrt:/etc/init.d#  cat /opt/piratebox/version
cat: can't open '/opt/piratebox/version': No such file or directory
root@OpenWrt:/etc/init.d#  cat /opt/piratebox/tmp/error.log
cat: can't open '/opt/piratebox/tmp/error.log': No such file or directory
root@OpenWrt:/etc/init.d#  cat /opt/piratebox/tmp/break.log
cat: can't open '/opt/piratebox/tmp/break.log': No such file or directory
root@OpenWrt:/etc/init.d#  cat /etc/config/network

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config interface 'lan'
        option ifname 'eth0'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'

root@OpenWrt:/etc/init.d#  cat /etc/config/wireless
config wifi-device  radio0
        option type     mac80211
        option channel  11
        option hwmode   11ng
        option macaddr  c4:e9:84:a0:e0:84
        option htmode   HT20
        list ht_capab   SHORT-GI-20
        list ht_capab   SHORT-GI-40
        list ht_capab   RX-STBC1
        list ht_capab   DSSS_CCK-40
        # REMOVE THIS LINE TO ENABLE WIFI:
        option disabled 1

config wifi-iface
        option device   radio0
        option network  lan
        option mode     ap
        option ssid     OpenWrt
        option encryption none

root@OpenWrt:/etc/init.d#  dmesg | tail -n 20
[   31.070000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   31.080000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 3000 mBm), (N/A)
[   31.090000] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 1700 mBm), (N/A)
[   31.090000] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz), (N/A, 2300 mBm), (0 s)
[   31.100000] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 3000 mBm), (N/A)
[   31.110000] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
[   31.560000] loop: module loaded
[   31.620000] ip_tables: (C) 2000-2006 Netfilter Core Team
[   31.790000] nf_conntrack version 0.5.0 (455 buckets, 1820 max)
[   32.080000] ip6_tables: (C) 2000-2006 Netfilter Core Team
[   32.360000] batman_adv: B.A.T.M.A.N. advanced 2013.4.0 (compatibility version 14) loaded
[   36.850000] ADDRCONF(NETDEV_UP): eth0: link is not ready
[   36.850000] device eth0 entered promiscuous mode
[   36.860000] ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   37.410000] eth0: link up (100Mbps/Full duplex)
[   37.410000] br-lan: port 1(eth0) entered forwarding state
[   37.420000] br-lan: port 1(eth0) entered forwarding state
[   37.420000] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   37.440000] ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   39.420000] br-lan: port 1(eth0) entered forwarding state
root@OpenWrt:/etc/init.d#  dmesg | grep sda
[    9.830000] sd 0:0:0:0: [sda] 60481536 512-byte logical blocks: (30.9 GB/28.8 Gicool smiley
[    9.840000] sd 0:0:0:0: [sda] Write Protect is off
[    9.840000] sd 0:0:0:0: [sda] Mode Sense: 45 00 00 00
[    9.840000] sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[   10.060000]  sda: sda1
[   10.060000] sd 0:0:0:0: [sda] Attached SCSI removable disk
root@OpenWrt:/etc/init.d#  ls /dev/sd*
/dev/sda   /dev/sda1
root@OpenWrt:/etc/init.d#  ps
  PID USER       VSZ STAT COMMAND
    1 root      1504 S    init
    2 root         0 SW   [kthreadd]
    3 root         0 SW   [ksoftirqd/0]
    5 root         0 SW   [kworker/u:0]
    6 root         0 SW<  [khelper]
   63 root         0 SW   [sync_supers]
   65 root         0 SW   [bdi-default]
   67 root         0 SW<  [kblockd]
   96 root         0 SW   [kswapd0]
  144 root         0 SW   [fsnotify_mark]
  173 root         0 SW<  [ath79-spi]
  184 root         0 SW   [mtdblock0]
  189 root         0 SW   [mtdblock1]
  194 root         0 SW   [mtdblock2]
  199 root         0 SW   [mtdblock3]
  204 root         0 SW   [mtdblock4]
  209 root         0 SW   [mtdblock5]
  250 root         0 RW   [kworker/0:1]
  442 root         0 SWN  [jffs2_gcd_mtd3]
  472 root         0 SW   [khubd]
  481 root         0 SW   [scsi_eh_0]
  482 root         0 SW   [usb-storage]
  483 root         0 SW   [kworker/0:2]
  484 root         0 SW   [kworker/u:2]
  511 root      1504 S    init
  542 root         0 SW<  [cfg80211]
  622 root         0 SW<  [bat_events]
  649 root      1508 S    /sbin/syslogd -C16
  651 root      1488 S    /sbin/klogd
  653 root       872 S    /sbin/hotplug2 --override --persistent --set-rules-file /etc/hotplug2.rules --set-coldplug-cmd /sbin
  662 root       872 S    /sbin/ubusd
  725 root      1468 S    /sbin/netifd
 1130 root      1152 S    /usr/sbin/dropbear -P /var/run/dropbear.1.pid -p 22
 1310 root      1220 S    /usr/sbin/dropbear -P /var/run/dropbear.1.pid -p 22
 1314 root      1500 S    /sbin/watchdog -t 5 /dev/watchdog
 1366 nobody     956 S    /usr/sbin/dnsmasq -C /var/etc/dnsmasq.conf
 1391 root      1500 S    /usr/sbin/ntpd -n -p 0.openwrt.pool.ntp.org -p 1.openwrt.pool.ntp.org -p 2.openwrt.pool.ntp.org -p 3
 1392 root      1524 S    -ash
 1427 root      1496 R    ps
root@OpenWrt:/etc/init.d#  cat /mnt/usb/install.log
cat: can't open '/mnt/usb/install.log': No such file or directory
root@OpenWrt:/etc/init.d#
Re: USB memory needs to be recreate / reinstalled
December 20, 2016 06:13PM
Hi,
the easiest option for your installed image is:

Power off the box,
Remove the install folder and place a new copy there
Optional: Remove the complete Piratebox folder (at least the content folder to get UI updates)
create a folder called "auto_flash"
Place a copy of the openwrt....bin file inside auto_flash
savely unmount the usb stick
Plugin the USB stick to your piratebox
power it online and grap a cup of coffee

After that system reflashes itself and the box is reinstalled after around 45 minutes

best regards
Matthias
Re: USB memory needs to be recreate / reinstalled
December 23, 2016 02:09PM
Thank you, it worked perfectly!