Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Because I experiment with btrfs in my 12.04 server, I use recent 3.6.3-030603-generic kernel found in the kernel-ppa/mainline - Kernel Ubuntu (intended for 12.10 Quantal). I also use the LXC, which works better when the kernel is compiled with CONFIG_MEMCG and CONFIG_MEMCG_SWAP flags compiled (which are absent in the mentioned kernel).

I'd like to try to recompile the kernel with those flags in the way as Ubuntu-compatible as possible. How to do it? How to get the sources from 12.04 (Or should I install 12.10 just for this process?)

(All the tutorials I found on the Net eighter assume I use the newest kernel, or some specific version (different from mine) or that the kernel source is taken from apt-source)

share|improve this question
Have you seen this ? – NikTh Oct 27 '12 at 9:48
@NikTh Yes. But as I replied to Colins, I am not sure whether it is safe. I believe Ubuntu adds more than just custom config to the kernel, but some custom code too. I just don't know if it is relevant with headless server and its stability. – Adam Ryczkowski Oct 27 '12 at 9:58
up vote 1 down vote accepted

If you want to just use linus' tree and to tweak the config to your own perferences then here is a method I use:

git clone git://

checkout the version you require, e.g.

git checkout -b v3.6 v3.6

grab a copy of an existing Ubuntu config

cp /boot/config-3.5.0-17-generic .config

..and modify it to if you want to add or remove various config options. You probably need to interactively answer some config option questions too.

and build:

make oldconfig
make deb-pkg INSTALL_MOD_STRIP=1

Note you won't be getting any of the Ubuntu kernel team fixes, CVE updates and SAUCE patches this way, so you are pretty well on your own to maintain this yourself.

share|improve this answer
Thank you. But that would install the vanilla kernel with Ubuntu config. AFAIK the mainline Ubuntu kernel differs from the vanilla not only with the config, but also the with some custom code. Would it be safe to run in the headless server environment? – Adam Ryczkowski Oct 27 '12 at 9:39
Depends what you mean by safe. The value-added part of the Ubuntu kernel is that it gets regular updates (security fixes and bug fixes), where as if you roll your own kernel you need to do that work yourself, or chose a stable kernel and run with the regular updates that land in that. The Ubuntu kernel also contains a bunch of patches to enable hardware, fix specific issues, and also some patches that haven't landed upstream yet. – Colin Ian King Oct 27 '12 at 12:01
Is there any way to get the sources of that Ubuntu-rolled kernel? – Adam Ryczkowski Oct 29 '12 at 10:02
By using your recipe I've got 3.6.0 kernel. Does it mean it is older than the 3.6.3 kernel, which is available from kernel-ppa? – Adam Ryczkowski Oct 29 '12 at 10:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.