Welcome! Log In Create A New Profile

Advanced

debian kernel module install fails

Posted by BuckNaked 
debian kernel module install fails
January 24, 2015 10:24PM
I'm having trouble installing the xtables-addons-common loadable kernel module on my Pogoplug E02.

In the past I've always built a custom kernel for my servers and included the iptables support in the kernel, including the necessary extensions (geoip and TARPIT). However, in this case ... due to the patches necessary to make debian run on the Pogoplug ... I'm a bit hesitant to build a custom kernel.

I suspect that this problem is not difficult, but it is not one I have run into before. Any insights will be much appreciated.

root@debian:~# apt-get install module-assistant
(module-assistant installs correctly)

root@debian:~# apt-get install iptables
(iptables installs correctly)

root@debian:~# apt-get install xtables-addons-common
(xtables-addons-common installs correctly)

root@debian:~# module-assistant --verbose --text-mode auto-install xtables-addons
Updating info about xtables-addons-source
Updated infos about 1 packages
Getting source for kernel version: 3.17.0-kirkwood-tld-1
apt-get install linux-headers-3.17.0-kirkwood-tld-1 

Reading package lists... Done 
Building dependency tree... Done    
Reading state information... Done
E: Unable to locate package linux-headers-3.17.0-kirkwood-tld-1
E: Couldn't find any package by regex 'linux-headers-3.17.0-kirkwood-tld-1'

(Install continues, but fails)
root@debian:~# 
Re: debian kernel module install fails
January 24, 2015 11:36PM
BuckNaked,

Try cleaning up your dpkg and then execute module-assistant again:
apt-get clean
dpkg --clear-avail
rm /var/lib/apt/lists/* --force
dpkg --configure -a

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: debian kernel module install fails
January 24, 2015 11:52PM
Bodhi, thanks for your quick reply. This is what occurred:

root@debian:~# apt-get clean
root@debian:~# dpkg --clear-avail
root@debian:~# rm /var/lib/apt/lists/* --force
rm: cannot remove `/var/lib/apt/lists/partial': Is a directory
root@debian:~# dpkg --configure -a
root@debian:~# module-assistant --verbose --text-mode auto-install xtables-addons-common
Updating info about xtables-addons-common
Updated infos about 1 packages
Getting source for kernel version: 3.17.0-kirkwood-tld-1

apt-get install linux-headers-3.17.0-kirkwood-tld-1 
Reading package lists... 0%
Reading package lists... 100%
Reading package lists... Done 
Building dependency tree... 0%
Building dependency tree... 100%
Building dependency tree... Done
Reading state information... 0%
Reading state information... 100%
Reading state information... Done
E: Unable to locate package linux-headers-3.17.0-kirkwood-tld-1
E: Couldn't find any package by regex 'linux-headers-3.17.0-kirkwood-tld-1'

apt-get install build-essential 
Reading package lists... 0%
Reading package lists... 100%
Reading package lists... Done 
Building dependency tree... 0%
Building dependency tree... 100%
Building dependency tree... Done
Reading state information... 0%
Reading state information... 100%
Reading state information... Done
Reading state information... Done
Package build-essential is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'build-essential' has no installation candidate
Done!

Bad luck, the kernel headers for the target kernel version could not be found 
and you did not specify other valid kernel headers to use.

If the running kernel has been shipped with the Debian distribution, please 
install the package linux-headers-3.17.0-kirkwood-tld-1. If your kernel source 
tree (or headers) is located in some non-usual location, please set the 
KERNELDIRS environment variable to the path of this directory, or 
(alternatively) specify the source directory we build for with the --kernel-dir
option in module-assistant calls.
root@debian:~# 
Re: debian kernel module install fails
January 25, 2015 12:20AM
I've noticed you are not at /boot. Have you tried to install linux headers first?

cd /boot
apt-get install linux-headers-3.17.0-kirkwood-tld-1

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: debian kernel module install fails
January 25, 2015 12:29AM
The linux headers don't appear to be present and don't appear to be available. Results:

root@debian:/etc/apt# cd /boot
root@debian:/boot#
root@debian:/boot# apt-get install linux-headers-3.17.0-kirkwood-tld-1
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package linux-headers-3.17.0-kirkwood-tld-1
E: Couldn't find any package by regex 'linux-headers-3.17.0-kirkwood-tld-1'

The sources.list contents:

root@debian:/etc# cat /etc/apt/sources.list
deb http://ftp.us.debian.org/debian wheezy main
deb http://security.debian.org/ wheezy/updates main contrib non-free

Further information: The target system was installed on a clean, freshly initialized USB drive using the rootfs from the procedure at http://forum.doozan.com/read.php?2,12096

wget --no-check-certificate https://bitly.com/1rXpFol
mv 1rXpFol Debian-3.17.0-kirkwood-tld-1-rootfs-bodhi.tar.bz2
mount /dev/sdb1 /mnt/sdb1
cd /mnt/sdb1
rm -r *
tar -xjf /usr/src/Debian-3.17.0-kirkwood-tld-1-rootfs-bodhi.tar.bz2
Re: debian kernel module install fails
January 25, 2015 01:40AM
BuckNaked Wrote:
-------------------------------------------------------
> The linux headers don't appear to be present and
> don't appear to be available. Results:
>
>
> root@debian:/etc/apt# cd /boot
> root@debian:/boot#
> root@debian:/boot# apt-get install
> linux-headers-3.17.0-kirkwood-tld-1
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> E: Unable to locate package
> linux-headers-3.17.0-kirkwood-tld-1
> E: Couldn't find any package by regex
> 'linux-headers-3.17.0-kirkwood-tld-1'
>
>
> The sources.list contents:
>
>
> root@debian:/etc# cat /etc/apt/sources.list
> deb http://ftp.us.debian.org/debian wheezy main
> deb http://security.debian.org/ wheezy/updates
> main contrib non-free
>
>
> Further information: The target system was
> installed on a clean, freshly initialized USB
> drive using the rootfs from the procedure at
> http://forum.doozan.com/read.php?2,12096
>
>
> wget --no-check-certificate
> https://bitly.com/1rXpFol
> mv 1rXpFol
> Debian-3.17.0-kirkwood-tld-1-rootfs-bodhi.tar.bz2
> mount /dev/sdb1 /mnt/sdb1
> cd /mnt/sdb1
> rm -r *
> tar -xjf
> /usr/src/Debian-3.17.0-kirkwood-tld-1-rootfs-bodhi
> .tar.bz2
>

Check to see the headers was untarred:

cd /mnt/sdb1/boot
ls -l

Boot with this rootfs

cd /boot
apt-get install ....

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 2 time(s). Last edit at 01/25/2015 01:48AM by bodhi.
Re: debian kernel module install fails
January 25, 2015 01:45AM
root@debian:~# cd /boot
root@debian:/boot# ls -l
total 27848
drwxr-xr-x  3 root root    4096 Jan 23 17:23 .
drwxr-xr-x 22 root root    4096 Jan 23 17:36 ..
-rw-r--r--  1 root root 1991026 Oct 22 01:51 System.map-3.17.0-kirkwood-tld-1
-rw-r--r--  1 root root  129088 Oct 22 01:51 config-3.17.0-kirkwood-tld-1
drwxr-xr-x  2 root root    4096 Oct 17 19:01 dts
-rw-r--r--  1 root root 6114271 Oct 24 20:28 initrd.img-3.17.0-kirkwood-tld-1
-rw-r--r--  1 root root 2832460 Jan 23 17:23 uImage
-rw-r--r--  1 root root 2822232 Oct 24 20:29 uImage.orig
-rw-r--r--  1 root root 6114335 Oct 24 20:29 uInitrd
-rwxr-xr-x  1 root root 2822168 Oct 22 01:51 vmlinuz-3.17.0-kirkwood-tld-1
-rwxr-xr-x  1 root root 2822168 Oct 22 01:50 zImage-3.17.0-kirkwood-tld-1
-rwxr-xr-x  1 root root 2832396 Jan 23 17:22 zImage.fdt
root@debian:/boot#
Re: debian kernel module install fails
January 25, 2015 01:56AM
Buck,

Dowload the 3.17 kernel tarbal (same thread). Extract the headers from it. Copy it to rootfs /boot and install it from there while system is running.

Sorry I forgot, basic rootfs doesnot have headers file on it! I make a note to do that.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 01/25/2015 02:01AM by bodhi.
Re: debian kernel module install fails
January 25, 2015 02:32AM
Bless me if I can figure this out. The kernel headers were installed, module-assistant appears to see them early on, but later complains that they are not available.

The install also complains of package build-essential which is listed as a package on packages.debian.org, but can not be installed either manually or by module-assistant.

I am going to investigate this business with build-essential tomorrow and see if I can find out what is going on, then try again.

root@debian:/boot# cd /boot
root@debian:/boot# wget --no-check-certificate https://bitly.com/1zrgVzP
root@debian:/boot# mv 1zrgVzP linux-3.17.0-kirkwood-tld-1-bodhi.tar.bz2
root@debian:/boot# bzip2 -d linux-3.17.0-kirkwood-tld-1-bodhi.tar.bz2
root@debian:/boot# tar -xf linux-3.17.0-kirkwood-tld-1-bodhi.tar
root@debian:/boot# dpkg -i linux-headers-3.17.0-kirkwood-tld-1_1_armel.deb
(Reading database ... 27724 files and directories currently installed.)
Preparing to replace linux-headers-3.17.0-kirkwood-tld-1 1 (using linux-headers-3.17.0-kirkwood-tld-1_1_armel.deb) ...
Unpacking replacement linux-headers-3.17.0-kirkwood-tld-1 ...
Setting up linux-headers-3.17.0-kirkwood-tld-1 (1) ...
root@debian:/boot# module-assistant prepare
root@debian:/boot# module-assistant --verbose --text-mode auto-install xtables-addons-common
Updating info about xtables-addons-common
Updated infos about 1 packages
Getting source for kernel version: 3.17.0-kirkwood-tld-1
apt-get install linux-headers-3.17.0-kirkwood-tld-1
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-headers-3.17.0-kirkwood-tld-1 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
apt-get install build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package build-essential is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'build-essential' has no installation candidate

Done!

Bad luck, the kernel headers for the target kernel version could not be found
and you did not specify other valid kernel headers to use.

However, you can install the header files for your kernel which are provided by
the linux-headers-3.17.0-kirkwood-tld-1 package. For most modules packages,
these files are perfectly sufficient without having the original kernel source.

To install the package, run:

module-assistant prepare

or

apt-get install linux-headers-3.17.0-kirkwood-tld-1



Edited 1 time(s). Last edit at 01/25/2015 02:41AM by BuckNaked.
Re: debian kernel module install fails
January 25, 2015 04:13AM
I'm not sure I get what you're trying to do! Why module-assistant is needed? Can't you just install this manually:

apt-cache show xtables-addons-common

And then install whatever is on the required list
apt-get install xtables-addons-common ..........

PS.

nvm, I understood what you trying to do.

Food for thought: even though kernel-package is obsolete, you could try to install it so all the build essentials stuff are brought in conveniently.
apt-get install kernel-package

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 2 time(s). Last edit at 01/25/2015 04:20AM by bodhi.
Re: debian kernel module install fails
January 25, 2015 10:07PM
Bodhi, thanks for the suggestion. The situation improved somewhat after installing kernel-package. I had hacked up the system so much by that point that I started again from scratch with a clean install of the rootfs. I reduced the commands to:

** Install the kernel headers from the install kit **
  cd /usr/src
  wget --no-check-certificate https://bitly.com/1zrgVzP
  mv 1zrgVzP linux-3.17.0-kirkwood-tld-1-bodhi.tar.bz2
  bzip2 -d linux-3.17.0-kirkwood-tld-1-bodhi.tar.bz2
  tar -xf linux-3.17.0-kirkwood-tld-1-bodhi.tar
  dpkg -i linux-headers-3.17.0-kirkwood-tld-1_1_armel.deb

** Update /etc/apt/sources.list to include contrib and non-free **
  apt-get update
  apt-get install kernel-package
  apt-get update
  apt-get upgrade

** Get the iptables extensions **
  apt-get install module-assistant
  module-assistant update
  module-assistant prepare
  module-assistant --verbose --text-mode \
> -k /usr/src/linux-headers-3.17.0-kirkwood-tld-1 \
> auto-install xtables-addons-common

Which resulted in the following:

Updating info about xtables-addons-common
Updated infos about 1 packages
Bad kernel version specification at /usr/bin/module-assistant line 568, <$apt> line 6.
root@debian:/usr/src# uname -r
3.17.0-kirkwood-tld-1

So far as I can see, the kernel in use and the kernel headers match. Googling for similar problems turned some up, but none appear to apply to this case.

Attempting to manually prepare module-assistant by forcing the kernel directory using the --kernel-dir option also failed:

root@debian:/usr/src# module-assistant prepare \
> --kernel-dir /usr/src/linux-headers-3.17.0-kirkwood-tld-1
Bad kernel version specification at /usr/bin/module-assistant line 568.

Module-assistant describes the -k, --kernel-dir option as:

--kernel-dir
              The  kernel  source  directories  to be used for builds. You can
              specify multiple directories with multiple options or  separated
              by   commas   or   line   separators   (e.g   using   -k  "`echo
              /usr/src/linux-headers-*`" ).  The kernel versions  detected  in
              this  directories  are automatically added to the list of target
              kernel versions (see --kvers-list for details).

It looks to me like the kernel in use, and the kernel header, should match. At this point I'm thinking either (a) module-assistant wants a full source kit, not just the headers, or (b) there's something wrong with the module-assistant command line.

Bodhi, do you think I should assume the problem is in module-assistant and seek help at one of the debian forums?
Re: debian kernel module install fails
January 25, 2015 11:47PM
BuckNaked,

> Bad kernel version specification at
> /usr/bin/module-assistant line 568, <$apt> line
> 6.

> Bodhi, do you think I should assume the problem is
> in module-assistant and seek help at one of the
> debian forums?

From the looks of this, my guess is that module-asistant can't deal with a version number that does not match the formal convention. Our naming convention has a postfix -kirkwood-tld-x, if it were the mainline kernel version then it would be just -kirkwood. But this is just an educated guess, I don't have access to my build environment so can't confirm it.

Yes, I think you probably should consult with others in Debian forum. Or if you can find the module-assistant source code, we can take a look at that parsing code to see if it is true.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: debian kernel module install fails
January 26, 2015 12:48AM
So far:

module-assistant is a Perl script
the problem occurs in the "prep" subroutine
turning on the -d debug option didn't produce illumination of the issue
and here is what I have seen so far after inserting some debugging trace prints near the problem area:

561 sub prep {
562   print "chdir $usrc\n" if $opt_debug;
563   %envbackup=%ENV;
564   $ENV{ROOT_CMD}=$sudo if ($sudo && !$ENV{ROOT_CMD});
565   print "Debug: \$opt_kverslist[0] = <$opt_kverslist[0]>\n";
566   for $todo ($opt_kverslist[0]) {
567      print "Debug: \$todo = <$todo>\n";
568      my $kheaders = get_kpackage($todo)."-headers";
569      print STDERR "Debug: \$kheaders = <$kheaders>\n";
570      $source=$kerneldirs{$todo};
571      print STDERR "Debug: \$source = <$source>\n";
572      die "Bad kernel version specification" if ! $todo;

The resulting printout of the debugging trace:

Debug: $opt_kverslist[0] = <>
Debug: $todo = <>
Debug: $kheaders = <kernel-headers>
Debug: $source = <>
Bad kernel version specification at ./module-assistant line 572.

I see that it expects something in $todo and it's not getting it, but I'm afraid that's as far as my insight goes. I suspect this will have to go to a debian forum where someone conversant with the internals of module-assistant can deal with it.

It seems like someone would have run into this before. Is it possible nobody ever tried to build a loadable kernel module for a prebuilt kirkwood system using module-assistant? Looking at the manual build procedure it is "a bit complicated."

Bodhi, thanks for your help and insight on this. I will post back if/when I come up with a solution.
Re: debian kernel module install fails
January 26, 2015 06:18AM
@Buck,

Looks like my hunch about kermel version is probably correct. It is an old bug, but don't know it has been fixed:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=437466

In any case, good luck and let us know.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: debian kernel module install fails
January 26, 2015 07:07PM
Have posted the problem to the debian forums at http://forums.debian.net/viewtopic.php?f=5&t=120128&sid=d05c351d5e802d3d46459ba14e407b59. I will post back here if anything develops.

I believe you are correct about the problem being in module-assistant. The maintainer's comment "I've long ago switched from module-assistant to DKMS, so I don't really care what happens of this bug report anymore." is disappointing. Particularly so, as I just finished fighting with DKMS for two hours without results.
Re: debian kernel module install fails
January 31, 2015 03:17AM
Bodhi, thanks for your assistance through this issue. It appears that there is no interest in the problem at the debian forums. Submitting it as a module-assistant bug might produce results later this year ... which is too speculative and too far out to be a solution.

DKMS does not appear to be a solution. I think I will need to build a custom kernel.

(a) Is there a tarball for the 3.17 distribution which includes the patched kernel sources?
(b) Can I rebuild just the kernel, or will I need to rebuild the accessory items such as zImage and dtb as well?
Re: debian kernel module install fails
January 31, 2015 03:30AM
BuckNaked,

A. The 3.17kernel tarball is in the 1st post of the kernel and rootfs thread. The config and patch are included. Download the mainline kernel source tree, apply the patch, and build with the config file.

B. You will need to rebuild the zimage, redo the uImage and uInitrd. Dtb doesnot need to be rebuilt, but should do that anyway.

And let me know if you rather want me to include what's needed in the next release.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 01/31/2015 03:35AM by bodhi.
tlschroe
Re: debian kernel module install fails
February 24, 2015 05:10PM
It appears that this bug was fixed in the version of module-assistant just newer than the Wheezy/stable version. I grabbed a newer one from wheezy-backports and that problem disappeared.

In my case, I ran into another problem where the source code in Wheezy for the kernel module that I needed was too old for the 3.17 kernel.

I'm currently trying the Jessie rootfs.

-tlschroe
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: