• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: How do I get iptables to work? How do I upgrade the kernel?  (Read 3866 times)
iffypug
Newbie
*

Karma: 0
Posts: 1


View Profile
« on: July 31, 2010, 12:25:15 PM »

I started to post to ask how to get iptables working on my Sheeva plug.  And in documenting my process for the post, got it to work.  So instead of asking a question, I'm posting a solution.

== What I've got ==
Sheeva Plug Model 003-SP1001

plug # uname -a
Linux debian 2.6.22.18 #1 Thu Mar 19 14:46:22 IST 2009 armv5tejl GNU/Linux

Computer # uname -a
Linux Clouseau 2.6.32-21-generic #32-Ubuntu SMP Fri Apr 16 08:10:02 UTC 2010 i686 GNU/Linux
Ubuntu 10.4

== My goal ==
I'd like to get iptables working on my Sheeva Plug.
Code:
# iptables -L -n
iptables v1.4.1.1: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

The wiki, the forum and google searches indicate to me that I need to upgrade my kernel.  

== How I finally got it working ==
Code:
# plug is not powered
# serial cable is connected between plug and lappy

# LAPPY
# download the tar file
$ md5sum sheevaplug-installer-v1.0.tar.gz
2ab9f45091232f7d998f0278bef2b751  sheevaplug-installer-v1.0.tar.gz

$ mv sheevaplug-installer-v1.0.tar.gz ~/lib/
$ cd ~/lib/
$ tar xf sheevaplug-installer-v1.0.tar.gz
$ cd sheevaplug-installer-v1.0

# insert usb stick into lappy
$ pushd /media/thumb
$ rm -rf *
$ popd
$ cd installer
$ cp -R * /media/thumb/
$ ls -al /media/thumb/
total 143108
drwx------ 4 matt matt     16384 2010-07-31 12:13 .
drwxr-xr-x 5 root root      4096 2010-07-31 12:10 ..
-rwxr-xr-x 1 matt matt   3331626 2010-07-31 12:12 initrd
-rwxr-xr-x 1 matt matt   3561533 2010-07-31 12:12 modules.tar.gz
-rwxr-xr-x 1 matt matt      1853 2010-07-31 12:12 README.txt
-rwxr-xr-x 1 matt matt 136517388 2010-07-31 12:13 rootfs.tar.gz
drwx------ 3 matt matt     65536 2009-10-23 17:45 .Spotlight-V100
drwx------ 3 matt matt     65536 2009-10-23 17:45 .Trashes
-rwxr-xr-x 1 matt matt      4096 2009-10-23 17:45 ._.Trashes
-rwxr-xr-x 1 matt matt      2671 2010-07-31 12:13 ubuntu-sheevaplug.sh
-rwxr-xr-x 1 matt matt   2620504 2010-07-31 12:13 uImage

# remove usb stick from lappy and put in plug
# power plug

# LAPPY
$ cd ..
$ sudo php runme.php nand
[sudo] password for matt:
PHP Notice:  Undefined index: OS in /home/matt/lib/sheevaplug-installer-v1.0/runme.php on line 7
PHP Notice:  Undefined index: USER in /home/matt/lib/sheevaplug-installer-v1.0/runme.php on line 43
You must run this as root

# arg!

$ sudo -s
$ php runme.php nand
PHP Notice:  Undefined index: OS in /home/matt/lib/sheevaplug-installer-v1.0/runme.php on line 7
PHP Notice:  Undefined index: USER in /home/matt/lib/sheevaplug-installer-v1.0/runme.php on line 43
You must run this as root

# ????
$ echo $USER
root

$ php --version
PHP 5.3.2-1ubuntu4.2 with Suhosin-Patch (cli) (built: May 13 2010 20:01:00)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

# edit runme
$ cp runme.php runme.php.orig
$ vi runme.php
$ diff -u runme.php.orig runme.php
--- runme.php.orig 2010-07-31 12:22:45.000000000 -0600
+++ runme.php 2010-07-31 12:23:16.000000000 -0600
@@ -40,8 +40,8 @@
 }
 else
 {
-    if ($_ENV["USER"] != 'root')
-        die("You must run this as root\n");
+    #if ($_ENV["USER"] != 'root')
+    #    die("You must run this as root\n");
 
     echo "\n **** exec(modprobe ftdi_sio vendor=0x9e88 product=0x9e8f)";
     exec("modprobe ftdi_sio vendor=0x9e88 product=0x9e8f", $out, $rc);


$ php runme.php nand
PHP Notice:  Undefined index: OS in /home/matt/lib/sheevaplug-installer-v1.0/runme.php on line 7

 **** exec(modprobe ftdi_sio vendor=0x9e88 product=0x9e8f)
 **** Preparing environment variables file ...
...
 **** Burning uboot and environment variables ... This will take few minutes ...
openocd/openocd: error while loading shared libraries: libftdi.so.1: cannot open shared object file: No such file or directory
 **** openocd FAILED
 **** Is the mini USB cable connected?
 **** Try powering down, then replugging the Sheevaplug

$ sudo apt-get install libftdi1
# success

$ php runme.php nand
PHP Notice:  Undefined index: OS in /home/matt/lib/sheevaplug-installer-v1.0/runme.php on line 7

 **** exec(modprobe ftdi_sio vendor=0x9e88 product=0x9e8f)
 **** Preparing environment variables file ...
...
 **** Burning uboot and environment variables ... This will take few minutes ...
Open On-Chip Debugger 0.2.0 (2009-07-26-14:56) Release
$URL: http://svn.berlios.de/svnroot/repos/openocd/tags/openocd-0.2.0/src/openocd.c $
For bug reports, read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS
2000 kHz
jtag_nsrst_delay: 200
jtag_ntrst_delay: 200
dcc downloads are enabled
Error: JTAG communication failure: check connection, JTAG interface, target power etc.
Error: trying to validate configured JTAG chain anyway...
Error: Could not validate JTAG scan chain, IR mismatch, scan returned 0x00. tap=feroceon.cpu pos=0 expected 0x1 got 0
Warn : Could not validate JTAG chain, continuing anyway...
Error: unexpected Feroceon EICE version signature
Error: unexpected Feroceon EICE version signature
Error: timed out while waiting for target halted
Runtime error, file "openocd/config/board/sheevaplug.cfg", line 21:
    Segmentation fault
 **** openocd FAILED
 **** Is the mini USB cable connected?
 **** Try powering down, then replugging the Sheevaplug


# unplugged serial cable and replugged it
$ php runme.php nand
PHP Notice:  Undefined index: OS in /home/matt/lib/sheevaplug-installer-v1.0/runme.php on line 7

 **** exec(modprobe ftdi_sio vendor=0x9e88 product=0x9e8f)
 **** Preparing environment variables file ...
...
wrote file uboot.bin to NAND flash 0 up to offset 0x00074000 in 72.714035s
Segmentation fault
 **** openocd FAILED
 **** Is the mini USB cable connected?
 **** Try powering down, then replugging the Sheevaplug


# unplugged serial
# unplugged power
# plugged in power
# 1, 2, 3, 4, .... 118, 119, 120
# plugged in serial

$ php runme.php nand
PHP Notice:  Undefined index: OS in /home/matt/lib/sheevaplug-installer-v1.0/runme.php on line 7

 **** exec(modprobe ftdi_sio vendor=0x9e88 product=0x9e8f)
 **** Preparing environment variables file ...
...
wrote file uboot.bin to NAND flash 0 up to offset 0x00074000 in 71.810753s
Segmentation fault
 **** openocd FAILED
 **** Is the mini USB cable connected?
 **** Try powering down, then replugging the Sheevaplug

# unplugged serial
$ apt-get install openocd
$ cd uboot/openocd
$ mv openocd openocd.bak
$ ln -s /usr/bin/openocd openocd
$ cd ../..

# plug in serial
$ php runme.php nand
PHP Notice:  Undefined index: OS in /home/matt/lib/sheevaplug-installer-v1.0/runme.php on line 7

 **** exec(modprobe ftdi_sio vendor=0x9e88 product=0x9e8f)
 **** Preparing environment variables file ...
...
wrote file uboot.bin to NAND flash 0 up to offset 0x00074000 in 67.121033s

 **** U-boot should be up and running now. Open your console ...
PHP Notice:  Undefined variable: string_beeps in /home/matt/lib/sheevaplug-installer-v1.0/runme.php on line 86

# did it work?
$ screen /dev/ttyUSB0 115200

# on Plug
$ run recover1
...
(Re)start USB...
USB:   scanning bus for devices... 1 USB Device(s) found
       scanning bus for storage devices... 0 Storage Device(s) found
** Can't read from device 0 **

** Unable to use usb 0:1 for fatload **
** Can't read from device 0 **

** Unable to use usb 0:1 for fatload **

NAND erase: device 0 offset 0x100000, size 0x400000
Erasing at 0x4e0000 -- 100% complete. Cleanmarker written at 0x4e0000.
OK

NAND write: device 0 offset 0x100000, size 0x400000

Writing data at 0x4ff800 -- 100% complete.
 4194304 bytes written: OK
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done
## Booting image at 00800000 ...
Bad Magic Number

# hmm... not FAT32?
# Nope, it's a super skinny USB that doesn't contact well
# Pressing the USB stick in and trying again:

# it works!
$ uname -a
Linux ubuntu 2.6.30.2 #11 PREEMPT Wed Jul 22 19:53:31 MDT 2009 armv5tel GNU/Linux

# connected plug to internet
# performed updates as decribed http://plugcomputer.org/plugwiki/index.php/New_Plugger_How_To
$ apt-get install iptables
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following NEW packages will be installed:
  iptables
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 550kB of archives.
After this operation, 1864kB of additional disk space will be used.
Get:1 http://ports.ubuntu.com jaunty/main iptables 1.4.1.1-4ubuntu3 [550kB]
Fetched 550kB in 2s (261kB/s)    
Selecting previously deselected package iptables.
(Reading database ... 11723 files and directories currently installed.)
Unpacking iptables (from .../iptables_1.4.1.1-4ubuntu3_armel.deb) ...
Setting up iptables (1.4.1.1-4ubuntu3) ...

$ iptables -L -n
Chain INPUT (policy ACCEPT)
target     prot opt source               destination        

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination        

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

It works!!!!
Logged

Doug Grove
Newbie
*

Karma: 1
Posts: 19


View Profile
« Reply #1 on: August 01, 2010, 02:39:02 PM »

I use UFW on my plug...

https://help.ubuntu.com/community/UFW

I highly recommend it.  (presuming your linux disto kernel and all).

Hope that helps,

Doug
Logged

Yapapa
Newbie
*

Karma: 0
Posts: 6


View Profile
« Reply #2 on: August 05, 2011, 07:28:14 AM »

@ iffypug: just to let you know, that I ran in the same php problem and after loosing my last hairs the last 2 days I found your message here - thanks! Editing the runme.php made it run under Debian Squeeze.
Logged

Pages: [1]
Print
Jump to: