5

I using Debian (Wheezy) with the 3.2.0-4 amd64 kernel version and want to upgrade my kernel to newest version, like 3.13.3 stable, but I have no internet connection to my Debian OS. I have installed both of "usb-modeswitch" and "usb-modeswitch-data" packages but Debian doesn't detect my 3g-modem-usb dongle.

I've downloaded the 3.13.3 tar.xz kernel source from kernel.org. How can I compile and upgrade from 3.2 to 3.13.3 without an internet connection?

4 Answers 4

10

The easy way: backports

I assume you need the new kernel to get your modem to work. If you can live with 3.12 instead of 3.13, at least for now, then instead of recompiling the kernel from source, you can just use Debian Backports. [update: Now backports is up to 3.14]

You can manually grab the package from packages.debian.org (update: now 3.14) on a computer with an Internet connection. Also grab initramfs-tools (there will be a link on the page). Put both on a USB stick, and install with dpkg -i.

You can also look at the linux-image-amd64 package, or the similar one for your architecture, to find out the most-recent version.

Once you have an Internet connection on the computer, the backports webpage has full instructions on how to set it up so you get updates, but in short:

  1. Edit /etc/apt/sources.list and add deb http://YOURMIRROR.debian.org/debian wheezy-backports main
  2. To install a package from backports, use -t wheezy-backports, e.g., aptitude -t wheezy-backports install linux-image-amd64

The hard way: upstream kernel sources

Note that you'll lose Debian patches this way, unless you hand-apply them.

Configure the kernel as in Configuring, compiling and installing a custom Linux kernel but do not install it. (You could also swipe the Debian configuration file, but beware it builds almost everything, so will take a very long time to compile). Instead, run make deb-pkg. This will generate several Debian packages. You'll want to install the linux-image- and possibly linux-headers- and linux-firmware-image- ones. You don't need to install the (absolutely huge) linux-image-*-dbg package.

4
  • 1
    +1 for the backport, this is a better idea than using testing/unstable packages. If you need to upgrade initramsfs-tools though, you will still need to uninstall the current kernel and I don't think dpkg will do this automatically.
    – Graeme
    Feb 19, 2014 at 16:51
  • @Graeme I'm pretty sure the new initramfs-tools is backwards-compatible, so you won't need to uninstall the old kernel.
    – derobert
    Feb 19, 2014 at 16:53
  • Yeah, your right
    – Graeme
    Feb 19, 2014 at 16:58
  • I didn't think of backports. That's probably the most painless way of accomplishing this, assuming, of course, that the backport exists. :-) Feb 19, 2014 at 17:06
3

As Graeme points out, 3.13 is currently in experimental. My suggestion is to download that, and then apply the procedure given in Section 4.2 of the Debian Kernel Handbook: Rebuilding official Debian kernel packages. if all goes well, this will create a custom Debian package for wheezy.

I haven't actually used this procedure myself, but I'm interested in knowing how to do it. If you run into trouble, ask here. I'd like to add an answer to goldilock's question which describes how to build a Debian package from Debian kernel sources.

NOTE: I may give this procedure a whirl myself if I get a chance. The probability of this would be greatly increased by someone giving it a try first, and reporting problems. :-)

NOTE 2: See also Section 1.2 of the Debian Kernel Handbook: Authors and Contributors. The current maintainer is Ben Hutchings. who is also a kernel developer, and does respond to questions and comments. So, I encourage everyone to submit improvements to the handbook.

NOTE 3: A preliminary run at this procedure reveals that the 3.13 package is listing gcc 4.8 as a dependency. It is hard to believe that 4.8 is actually required as a dependency, but in any case, if the build dependencies need to be changed, that makes the procedure that much harder.

NOTE 4: Thanks to some detective work by derobert, we figured out that changing the compiler version in debian/config/defines was probably the way to go. For completeness, the patch I'm currently using against the Debian sources is below.

I use the following commands to try to build:

fakeroot debian/rules source

followed by

fakeroot make -f debian/rules.gen binary-arch_amd64_none_amd64

However, this still looks for 4.8 and crashes, though the first command has clearly done some rewriting for 4.7.

UPDATE: I take it back. This works as long as the patched files are new enough (newer than other source files in the build). I noticed this worked when I popped and pushed my patch (using Mercurial Queues), which automatically updated the time stamp on the files. Yes, this is as weird as it sounds, but I can reproduce the problem.

I've posted to the debian-kernel mailing list, and the kernel-handbook mailing list. See bug in Debian kernel build scripts. I've not posted a formal bug report, because I'm not sure what package to file the bug against.

UPDATE 2: It looks like this may have been a form of user error. As can be seen from the message I wrote, the problem is with timestamps. Make uses timestamps, and my use of version control confused it, also taking into account with the fact that make is rebuilding some of the source files in this case.

# HG changeset patch
# Parent 81a16b960a67fa08c9a298bc03c5acfd3d6f7437

diff -r 81a16b960a67 debian/config/amd64/defines
--- a/debian/config/amd64/defines
+++ b/debian/config/amd64/defines
@@ -5,7 +5,7 @@
 kernel-arch: x86

 [build]
-debug-info: true
+debug-info: false

 [image]
 bootloaders: grub-pc extlinux lilo
diff -r 81a16b960a67 debian/config/defines
--- a/debian/config/defines
+++ b/debian/config/defines
@@ -23,7 +23,7 @@
  sparc
  sparc64
  x32
-compiler: gcc-4.8
+compiler: gcc-4.7
 featuresets:
  none
  rt
@@ -50,4 +50,4 @@

 # initramfs-generators
 initramfs-fallback: linux-initramfs-tool
-initramfs-tools: initramfs-tools (>= 0.110~)
+initramfs-tools: initramfs-tools (>= 0.109.1)
diff -r 81a16b960a67 debian/config/i386/defines
--- a/debian/config/i386/defines
+++ b/debian/config/i386/defines
@@ -28,7 +28,7 @@
  i386/config.486

 [686-pae_build]
-debug-info: true
+debug-info: false

 [686-pae_description]
 hardware: modern PCs
3
  • Does editing debian/control and maybe debian/rules to use 4.6 work? The 3.12 backport changelog mentions using 4.6.
    – derobert
    Feb 19, 2014 at 17:17
  • @derobert I tried doing a replace 4.8-> 4.7 on debian/control. It didn't work. debian/rules doesn't mention any specific version of gcc. I've now written to the kernel team and the handbook mailing lists. Let's see if I get a reply. Feb 19, 2014 at 17:22
  • @Faheem Mitha,Your proposal is so interesting , I'll try to do that ;) Thank you!
    – Sensor
    Feb 19, 2014 at 20:47
2

Compiling a kernel from the upstream source is a very complex task, I wouldn't recommend that unless you already have experience or a lot of time to learn. What is probably a better idea is to download a Debian .deb for an recent kernel, transfer it and then install with dpkg.

The 3.12 kernel currently used in Debian testing/unstable can be downloaded here

http://ftp.uk.debian.org/debian/pool/main/l/linux/linux-image-3.12-1-amd64_3.12.9-1_amd64.deb

The 3.13 kernel currently in the Debian experimental repositories can be found here:

http://ftp.uk.debian.org/debian/pool/main/l/linux/linux-image-3.13-trunk-amd64_3.13-1~exp1_amd64.deb

As @Faheem pointed out, the kernel binary above depends on a different version initramfs-tools than is currently available in stable. It is possible to download an install this along with the kernel, the package can be downloaded from:

http://ftp.uk.debian.org/debian/pool/main/i/initramfs-tools/initramfs-tools_0.115_all.deb

To install, place both downloaded package files in the same directory (say dir) and run:

sudo dpkg -Ri dir

This process is currently doable. As Debian Jessie (testing) and Wheezy grow further apart, more dependencies may be required making less feasible and eventually impossible. The links above will of course expire, however direct links to download newer versions of these packages can always be found by browsing http://ftp.uk.debian.org/debian/pool/main/

Update

As @derobert suggested, it is a better idea to use a backport kernel, rather than a testing/unstable/experimental one. Currently the backport for Wheezy is 3.12.9, the same as for testing and unstable. A direct download link is here:

http://ftp.uk.debian.org/debian/pool/main/l/linux/linux-image-3.12-0.bpo.1-amd64_3.12.9-1~bpo70+1_amd64.deb

The initramfs-tools package required is still the same, as are the installation instructions.

Also, what I didn't realise (other than the now removed rubbish about uninstalling the current kernel), is that download links for packages can be found at the bottom of package pages on https://packages.debian.org which is easier to browse. It also has download links to all mirrors and not just the UK one I have used.


If you have to compile from source, it is a better idea to start with a Debian source package. Here are a couple of links on working with Debian source packages:

https://wiki.debian.org/SourcePackage

https://www.debian.org/doc/manuals/apt-howto/ch-sourcehandling.en.html

You can download the three necessary file for the above 3.12 directly via the links on the right hand side of the following page:

https://packages.debian.org/testing/linux-image-3.12-1-amd64

And the experimental kernel here:

https://packages.debian.org/experimental/kernel/linux-image-3.13-trunk-amd64

@Faheem has actually tried this out though, so his answer is better for this.

3
  • Compiling for general tasks is not "very complex"! Feb 19, 2014 at 14:03
  • If you want to compile a kernel that doesn't work properly with your system, you are right. The complexity is in making sure that it does.
    – Graeme
    Feb 19, 2014 at 14:49
  • Graeme, installing these kernel packages on wheezy will not work directly. Check out the dependencies. For example, linux-image-3.12-1-amd64 requires initramfs-tools (>= 0.110~). But wheezy has initramfs-tools 0.109.1. Regardless, +1 for effort. Downvoting without explanation is a little aggressive. Feb 19, 2014 at 15:19
0

There is already a lot of information on the site so I'll just repeat what is common knowledge:

There are several advantages to do it with kpkg:

  • any kernel will do, if all requirements are fulfilled
  • you are able to fast install and also fast deinstall your kernel with dpkg
8
  • My impression is kernel-package is now obsolete. It is clearly not supported any longer - the developer appears to have left the project, or at any rate is very inactive. Feb 19, 2014 at 14:52
  • ok, so what do you suggest to take instead?
    – user55518
    Feb 19, 2014 at 14:54
  • Well, that's a good question, bersch. I don't exactly know. Note I'm not saying don't use kernel-package. Maybe it will work fine for you. I haven't used it for a long time. However, since kernel-package is not supported, it will develop problems eventually. Also, it is not clear from your answer whether you want to build a Debian package for your new kernel, or if that is not a requirement. The former is a good idea in my opinion. You can take a look at kernel-handbook.alioth.debian.org/ch-common-tasks.html. Feb 19, 2014 at 15:01
  • The instructions for kernel-handbook.alioth.debian.org/…, which is what your requirement corresponds to, are not completely clear. Will this build a Debian package or not? I haven't tried the instructions myself, so I can't say. Feb 19, 2014 at 15:02
  • Rebuilding the testing or unstable Debian kernel sources probably makes more sense. That is what I would recommend. Feb 19, 2014 at 15:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .