Bobuscho
Posts: 5
Joined: Wed Jan 15, 2014 10:05 am

xtables on Raspbian - module assistant and headers

Sat Mar 28, 2015 2:01 pm

Hello,

i would like to install the xtables addon on my Rpi 2 running Raspbian. Therefore, a kernel module needs to be compiled.

Installation via apt-get install fails due to a lack of kernel headers and even the "manual" way via module-assistant fails, because i cannot specify a working directory for the kernel headers.

What i have tried so far:

1. Used the various guides here on the forum (git clone linux and firmware and simlink them to the /lib/modules etc...) --> this failes. apt-get install still fails and the path with module-assistant just fails stating that there are no valid kernel header directories etc...

How can i compile the xtables addon? I do not want to compile the whole kernel, i just want to use module-assistant or the apt-get way...

I am running the latest raspbian and the latest kernel obtained via "rpi-update".

Output of "uname -a": 3.18.10-v7+ #774 SMP PREEMPT Wed Mar 25 14:10:30 GMT 2015 armv7l GNU/Linux

Any ideas? Thank you in advance,

Bobuscho

magifix
Posts: 17
Joined: Thu Apr 02, 2015 6:42 pm

Re: xtables on Raspbian - module assistant and headers

Thu Apr 02, 2015 6:48 pm

Same problem to me. I even tried to install linux headers for the kernel (dpkg -i linux-headers-3.18.7-v7+_3.18.7-v7+-2_armhf.deb), then it is ending with this message:

Loading new xtables-addons-1.42 DKMS files...
First Installation: checking all kernels...
It is likely that 3.18.7-v7+ belongs to a chroot's host
Building initial module for 3.18.7-v7+
Error! Build of xt_ACCOUNT.ko failed for: 3.18.7-v7+ (armv7l)
Consult the make.log in the build directory
/var/lib/dkms/xtables-addons/1.42/build/ for more information.

any idea to make it working on:

Linux raspberrypi 3.18.7-v7+ #755 SMP PREEMPT Thu Feb 12 17:20:48 GMT 2015 armv7l GNU/Linux

magifix
Posts: 17
Joined: Thu Apr 02, 2015 6:42 pm

Re: xtables on Raspbian - module assistant and headers

Fri Apr 03, 2015 6:46 am

Found this topic:

http://www.raspberrypi.org/forums/viewt ... 71&t=17666

but unfortunatly not able to do the wget https://github.com/raspberrypi/linux/tarball/rpi-3-18-7.

Do you have better guess?

butaca
Posts: 1
Joined: Sat Dec 20, 2014 11:29 pm

Re: xtables on Raspbian - module assistant and headers

Sat Apr 04, 2015 7:59 pm

I succeeded by building from source (http://xtables-addons.sourceforge.net) against the headers downloaded by rpi-source (https://github.com/notro/rpi-source).

Note that you need gcc 4.8.3+ (follow the instructions carefully at https://github.com/notro/rpi-source/wiki).

Install libncurses5-dev before running rpi-source:

Code: Select all

sudo apt-get install libncurses5-dev
Install and run rpi-source:

Code: Select all

sudo wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -O /usr/bin/rpi-source && sudo chmod +x /usr/bin/rpi-source && /usr/bin/rpi-source -q --tag-update
sudo rpi-source
Install the xtables-addons build dependencies:

Code: Select all

sudo apt-get install git autoconf automake libtool xutils-dev
And the actual build:

Code: Select all

git clone git://git.code.sf.net/p/xtables-addons/xtables-addons
cd xtables-addons
libtoolize --force
aclocal
autoheader
autoconf
./configure
sudo make install
sudo depmod
Hope it helps.

Bobuscho
Posts: 5
Joined: Wed Jan 15, 2014 10:05 am

Re: xtables on Raspbian - module assistant and headers

Sun Apr 05, 2015 8:24 pm

Thank you, butaca, that worked!

Only difference: I had to run autogen.sh in the xtables directory to get ./configure to work. Otherwise it complained about a missing install.sh in build-aux.

However, i got xtables working. thank you again!

magifix
Posts: 17
Joined: Thu Apr 02, 2015 6:42 pm

Re: xtables on Raspbian - module assistant and headers

Mon Apr 06, 2015 8:23 am

Many thanks to both of you, this also worked for me by adding autogen.sh to the procedure.

Bobuscho
Posts: 5
Joined: Wed Jan 15, 2014 10:05 am

Re: xtables on Raspbian - module assistant and headers

Mon Apr 06, 2015 11:32 am

I just forgot:

Many thanks to notro & PeterOGB, who are currently maintaining the rpi-source script. I never managed to compile my kernel source but this script makes it really easy. For anyone else who wants to compile the source or the headers:

https://github.com/notro/rpi-source/wiki

magifix
Posts: 17
Joined: Thu Apr 02, 2015 6:42 pm

Re: xtables on Raspbian - module assistant and headers

Sun Apr 26, 2015 4:52 pm

Hi all,

I wonder if someone of you is using the Raspberry as a Firewall with masquerading? Since I used this command:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

with the setup described above in this post, my OS is crashing (skb_over_panic):

kernel BUG at /net/core/skbuf.c:100!
Internal error: Oops - BUG: 0 [#1] PREEMPT SM ARM
Modules linked in: ipt_MASQUERADE nt_nat_masquerade_ipv4 iptble_mangle iptable_nat ...

It would be nice to know if my OS is corrupt or buggy.

Thanks in avance for any hints

User avatar
mattrix
Posts: 133
Joined: Mon Mar 02, 2015 6:20 am
Location: Christchurch, New Zealand
Contact: Website

Re: xtables on Raspbian - module assistant and headers

Sun Oct 02, 2016 9:41 pm

I also needed bc installed (for rpi-source) and iptables-dev for building xtables

Code: Select all

sudo apt-get install libncurses5-dev bc

Code: Select all

sudo apt-get install git autoconf automake libtool xutils-dev iptables-dev

Code: Select all

git clone git://git.code.sf.net/p/xtables-addons/xtables-addons
cd xtables-addons
libtoolize --force
aclocal
autoheader
autoconf
./autogen.sh
./configure
sudo make install
sudo depmod
www.matthuisman.nz

Return to “Raspbian”