No rule to make target `menuconfig`

If you receive the following error when trying to configure your kernel…

bpc linux # make menuconfig
make: *** No rule to make target `menuconfig'.  Stop.

…then you could have accidentally removed your kernel sources when you cleaned the package dependencies (via emerge --depclean).

There are a few ways to recover from this problem, depending on whether portage still contains your specific kernel version or not.

Find out your current kernel version

You can do this by checking where /usr/src/linux points:

me@pc ~ $ ls -l /usr/src/linux
lrwxrwxrwx 1 root root 22 Mar 10 17:01 /usr/src/linux -> linux-2.6.39-gentoo-r3

This should be mirrored by the output of eselect kernel list:

me@pc ~ $ eselect kernel list
Available kernel symlink targets:
  [1]   linux-2.6.28-gentoo-r5
  [2]   linux-2.6.29-gentoo-r5
  [3]   linux-2.6.30-gentoo-r4
  [4]   linux-2.6.30-gentoo-r5
  [5]   linux-2.6.39-gentoo-r3 *
  [6]   linux-3.2.1-gentoo-r2

Re-install the specific kernel version

emerge -av sys-kernel/gentoo-sources:2.6.39-r3

You should now be able to make menuconfig without error.

No luck? You have a few options

If portage no longer contains the particular version you need, then you have four choices:

  1. Upgrade your kernel to the most recent available in portage. Follow the kernel upgrade guide. If you decide to do this I recommend you make a copy of your current kernel and its config, and still use one of the following methods to get hold of your current kernel’s source, just in case something goes wrong with the upgrade.

  2. Create a local overlay and use an archived copy of the package’s ebuild. This is the method I’ll describe below.

  3. Get the package via an existing overlay, which obviously requires finding an overlay that has the package. There are a couple of search engines for overlays listed on the wiki here: External Links section of Overlay - Gentoo Linux Wiki. At the time of writing no overlays were found that contained the kernel source I needed.

  4. Last resort is to download the source from the original distributer and create your own ebuild. If you’re after the gentoo sources / patches but gentoo no longer has them then you may have to find the vanilla sources / patches from elsewhere. I won’t describe how to do this because I’ve not done it myself yet!

Using a local overlay to restore old kernel sources

Create a local overlay as described in the Local Overlays section of Overlay - Gentoo Linux Wiki. For the purpose of this example I’ll assume you created it at /usr/local/portage, as follows:

mkdir -p /usr/local/portage/profiles
echo "my_local_overlay" >> /usr/local/portage/profiles/repo_name
echo "PORTDIR_OVERLAY=\"/usr/local/portage/\"" >> /etc/make.conf

Download the sources ebuild from “the attic”, place it in /usr/local/portage/sys-kernel/gentoo-sources/ and create a manifest, as follows:

cd /usr/local/portage
mkdir -p sys-kernel/gentoo-sources
cd sys-kernel/gentoo-sources
ebuild gentoo-sources-2.6.39-r3.ebuild manifest

Emerge the sources:

emerge sys-kernel/gentoo-sources:2.6.39-r3

You should now have the kernel source back and make menuconfig should work again:

cd /usr/src/linux
make menuconfig


Last modified: 10/03/2012 Tags: , , ,

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top