Installing xtables-addons-common on Debian Jessie (8.2)


#1

On Debian Jessie, the command apt-get install xtables-addons-common returns the error

First Installation: checking all kernels...
dpkg: warning: version '*-*' has bad syntax: version number does not start with digit
It is likely that 4.5.1-std-1 belongs to a chroot's host
Module build for the currently running kernel was skipped since the
kernel source for this kernel does not seem to be installed.

This topic explains how to fix this error.

identifying desired kernel version & switch to it

xtables-addons-common requires kernel 4.3.3 (as seen on source commit)

kernel 4.3.3 is not present in the console bootscript tab (all kernels versions cannot be listed)
we create a ticket and scaleway will return the bootscript_id if the kernel exists in their scaleway database.

The bootscript id for 4.3.3 is f642c6b9-f538-4459-b772-46d43d478bce

Also replace SERVERID and TOKENID below.

curl 'https://api.scaleway.com/servers/SERVERID' -X PATCH -H 'x-auth-token: TOKENID' -H 'Content-Type: application/json' -d '{"bootscript":"<debian jessie bootscript>"}'

then hard-reboot with the console.

The output of uname -r should be is 4.3.3

linux-4.3.3 source installation:

apt-get update
apt-get upgrade

install some package to build the module xtables-addons (depends of the package to be installed) :

apt-get install build-essential  libtool  bison flex  libnftnl-dev  libmnl-dev  libssl-dev autoconf -y

prepare 4.3.3 sources files & clean 4.5.1

rm -fr /lib/modules/4.5.*
zcat /proc/config.gz > /boot/config-4.3.3
cd /tmp
wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.3.3.tar.xz
tar xf linux-4.3.3.tar.xz
cp -r /tmp/linux-4.3.3 /lib/modules/4.3.3-std-1/build
cd  /lib/modules/4.3.3-std-1/build/
cp /boot/config-4.3.3 .config
make oldconfig
make prepare
make prepare scripts

this step is dependent of the use case, may be skipped

install iptables-1.6.0

cd /tmp
wget http://fossies.org/linux/misc/iptables-1.6.0.tar.gz
tar xzf iptables-1.6.0.tar.gz
cd iptables-1.6.0/
./configure
make -j4
make install

this step is dependent of the use case, may be skipped

install xtables-addons
cd /usr/src
download https://sourceforge.net/projects/xtables-addons/files/Xtables-addons/xtables-addons-2.9.tar.xz/download
under /usr/src

tar xf xtables-addons-2.9.tar.xz
cd xtables-addons-2.9
./autogen.sh
./configure
make -j4

prepare package installation

this step is also dependent of the nature of the error you first encounter while installing the package before downgrading the linux kernel.
we indentified that /usr/lib/dkms/common.postinst failed.
first we install the package that sets up properly some directories

apt-get remove  xtables-addons-common
apt-get install  xtables-addons-common

apt-get install SHOULD FAIL with error:
Error! Build of xt_ACCOUNT.ko failed for: 4.3.3-std-1 (x86_64)

mkdir /var/lib/dkms/xtables-addons/2.9
ln -s  /usr/src/xtables-addons-2.9 /var/lib/dkms/xtables-addons/2.9/source
cp /usr/src/xtables-addons-2.6/dkms.conf /usr/src/xtables-addons-2.9/
sed  -i "s/2\.6/2\.9/g" /usr/src/xtables-addons-2.9/dkms.conf
/usr/lib/dkms/common.postinst xtables-addons 2.9 /usr/share/xtables-addons-dkms

you should see

DKMS: install completed.
xtables-addons is now installed