# [SOLVED] Can't run make menuconfig. Do I upgrade the kernel?

## mojosam

My problem is similar to this one. The Pastebins have expired, so I'm not sure.

I did this:

```
# cd /usr/src/linux

# make menuconfig

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

Apparently the necessary file got deleted by depclean.

So I figured I would just boot up the Minimal Install CD and run it from in there. I might have outsmarted myself, though. My copy was a month old, so I downloaded the latest version and ran that.

When I got to the part of the install that has me run make menuconfig, I once again got:

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

Investigating, this is what I figured out.

• My original installation is sitting in /usr/src/linux-4.19.57-gentoo

• This new journey through the new Install CD put stuff into /usr/src/linux-4.19.66-gentoo

• The /usr/src/linux symbolic link is still pointing to /usr/src/linux-4.19.57-gentoo

All I want to do is run make menuconfig with the lowest chance of messing up my system. What is my best course of action?

• Should I copy the Makefile from 4.19.66 to 4.19.57?

• Should I copy my .config file from 4.19.57 to 4.19.66 then change the symbolic link to 4.19.66?

• Should I do a formal kernel upgrade?

• Have I misdiagnosed my problem, and I should do something else?Last edited by mojosam on Mon Sep 02, 2019 1:15 am; edited 1 time in total

----------

## Jaglover

You have a full copy of kernel sources under 4.19.66? Then do the upgrade. That's the easiest way. Nothing you do in kernel sources directory affects your running system, until you actually install the new kernel and reboot.

----------

## hedmo

 *mojosam wrote:*   

> 
> 
> • Should I copy my .config file from 4.19.57 to 4.19.66 then change the symbolic link to 4.19.66?
> 
> • Should I do a formal kernel upgrade?
> ...

 

mojosam if you are missing your .config in the new kernel.... do not just copy your old one to the new.it is a bad thing.if there is new FEATURES in 

the new kernel you wont know of you just copy the old one .follow the  :

kernel upgrade

and use: 

```

make oldconfig

```

to update your new kernel from the old one.

regards hedmo

----------

## luna80

did you read this gentoo wiki page? https://wiki.gentoo.org/wiki/Kernel/Upgrade

it's very usefulll

----------

## NeddySeagoon

mojosam,

If you did a world update, you may have got a new kernel.

The recommended --depclean would then have removed all the files provided by the kernel tarball from the old kernel.

Your old .config will still be there but the Makefile will be gone, hence 

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

Its a design feature. 

The --exclude option to emereg can be useful for preventing things like this.

You can either update the kernel or emerge the old kernel again.

You can do something similar with gcc too. That's scary but harmless.

----------

## Jaglover

Use -a option with depclean, this allows you to review the list of packages to be removed before committing.

```
emerge -ac
```

-a is short for --ask, -c is --depclean.

Then, following NeddySeagoon advice if you want to keep your old kernel sources, you can do

```
emerge -ac --exclude gentoo-sources
```

----------

## axl

Could it be possible that he doesn't have USE=symlink and although the new kernel has Makefile maybe /usr/src/linux doesn't point to the actual new kernel, but to the old version that was depcleaned?

----------

## mojosam

A lot of helpful people chiming in! Remember that I did not set out originally to upgrade the kernel. I got into this bind because depclean apparently wiped out the files I needed to reconfigure the kernel I had. I didn't understand the ramifications of using it. That tool is too powerful in the hands of a neophyte! Then I compounded the problem by using a later Minimal Install CD and ended up with the two kernels.

Taking Jaglover's advice, I decided to upgrade the kernel. I followed the Kernel Upgrade directions.

To do the build, that article directed me to the Kernel Configuration article. That had me do make, make modules_install, and make install. All of that proceeded without incident.

Here's where it gets confusing. It isn't clear when, if ever, I am supposed to leave the Kernel Configuration page and return to the Kernel Upgrade page. So staying with the Kernel Configuration page, I next come to the Bootloader section, which sends me off to the GRUB2 page. I assume that I need to jump directly to the Installing a New Kernel section.

That has me do this:

```
grub-mkconfig -o /boot/grub/grub.cfg
```

That fails with:

```
/usr/sbin/grub-mkconfig: line 243: /boot/grub/grub.cfg.new: No such file or directory
```

The instructions have a note above that command that says:

 *Quote:*   

> Make sure the /boot partition is mounted for this step.

 

OK. Maybe I need to do that first!

```
# mount /boot

mount: /boot: special device boot does not exist.
```

I stupidly assumed that the system would know where that was. Apparently not.

On my system, sda1 is the BIOS boot partition (2 MB). Am I correct in assuming that this is not the partition I'm interested in? (But isn't that where GRUB does its grubbing?)

sda2 is labeled as "Boot" (128 MB). I'm guessing that's what I want. So would I now do:

```
mount /dev/sda2 /boot
```

And why wouldn't that be already mounted?

----------

## Jaglover

```
man fstab
```

This will tell you the purpose of fields in /etc/fstab. By default automounting is disabled for /boot. Since 'mount /boot' failed for you I'd say your fstab is not set up properly at all. Did you edit it? It comes with placeholders which are not functional without your input.

----------

## mojosam

 *Quote:*   

> Since 'mount /boot' failed for you I'd say your fstab is not set up properly at all. Did you edit it?

 

I haven't touched it since I set up the system a few weeks ago. Everything was fine. This is what it currently looks like:

```
# <fs>    <mountpoint>   <type>   <opts>            <dump/pass>

boot      /boot          ext4     defaults,noatime  0 2

swap      none           swap     sw                0 0

rootfs    /              ext4     noatime           0 1
```

That looks like the way I set it up originally.

Something somehow got confused somewhere. Should I reboot? Or is there something I can do to troubleshoot or fix whatever caused the mount /boot to fail?

----------

## NeddySeagoon

mojosam,

The first column should be the /dev entries that hold the filesystems that get attached at <mountpoint>

boot, swap and rootfs are all incorrect.

The lazy form of mount, like 

```
mount /boot
```

causes /etc/fstab to be consulted for the missing information.

The full form, 

```
mount /dev/sda2 /boot
```

assumes you want read/write and guesses the filesystem type.

You can give other options to mount if you want to.

----------

## mojosam

I fixed my fstab. This is how it looks now:

```
# <fs>         <mountpoint>   <type>   <opts>            <dump/pass>

/dev/sda2      /boot          ext4     defaults,noatime  0 2

/dev/sda3      none           swap     sw                0 0

/dev/sda4      /              ext4     noatime           0 1
```

I got through the last couple of steps, rebooted, and I'm now in the new kernel.

The only problem is GRUB doesn't give me a choice of the two kernels. One entry says "Gentoo GNU/Linux". The other entry is advanced options. Isn't it supposed to now list 4.19.57 and 4.19.66?

----------

## Jaglover

mojosam,

I do not use Grub myself, for me it looks too complicated for such a simple job as loading the kernel. But I believe there is a configuration file somewhere in /etc you are supposed to edit to make Grub2 work the way you want. Or you can write the grub.conf (or is it grub.cnf) file which is in /boot by hand, it can be very simple, just a few lines will do, there is an example somewhere in Gentoo Wiki.

----------

## wpkzz

mojosam:

That is the "new" (for some years now) standard in Grub2 and Gentoo. It only list per default the newer kernel. If you select the "advanced" options, there should be the other kernels listed.

----------

## mojosam

 *Quote:*   

> I do not use Grub myself, for me it looks too complicated for such a simple job as loading the kernel.

 

No kidding! I thought it would be fun to re-emerge grub. That took a long time! I can't imagine why that needs to be so complicated. Maybe when I know this stuff better, I'll switch to a lean and mean bootloader.

 *Quote:*   

> If you select the "advanced" options, there should be the other kernels listed.

 

Oh. Now you tell me! Well anyway, everything (in this thread) is working now. Thank you to all of the folks who chimed in. Gentoo is a bottomless pit, isn't it? You'll never learn it all.

----------

## Jaglover

I let my UEFI firmware to boot my kernel, no extra bootloader, no middleman.

```
# efibootmgr

BootCurrent: 0001

Timeout: 1 seconds

BootOrder: 0001,0000

Boot0000* Gentoo Backup

Boot0001* UEFI OS
```

Boot0001 was created automatically, I added Boot0000, it is my backup kernel. Since the names of my kernels never change there is never need to update boot entries.

----------

## Ant P.

 *mojosam wrote:*   

> No kidding! I thought it would be fun to re-emerge grub. That took a long time! I can't imagine why that needs to be so complicated.

 

GRUB2 is an entire OS unto itself, complete with graphics mode drivers, filesystem/RAID/CDROM drivers, decompression libraries, a command line with editing support, and basic scripting. It's an order of magnitude more code than the UEFI bootloader on most systems, and far more than something like LILO (which fits into the MBR).

----------

## mojosam

 *Quote:*   

> GRUB2 is an entire OS unto itself

 

My computer uses BIOS. Should I switch to LILO? I followed the installation instructions in the Handbook. I think it suggested GRUB2.

----------

## Jaglover

It is up to you, I have several computers with Lilo. It has one drawback, it does not load kernels by name, thus I cannot upgrade by replacing the kernel image with new upgraded one. You may try Syslinux.

----------

## cboldt

What do you mean by "not loading kernels by name?"  I have used lilo only for a long time, upgrade kernel on some machines a few times a year, and change both the kernel filename (it includes the linux kernel version) and the nickname as it appears on the boot menu at bootup.

/etc/lilo.conf has multiple "image,label" entries.

```

[intro stuff omitted]

image=/boot/kernel-4.19.66-gentoo

  label=Gentoo

  [stuff omitted]

#image=/boot/kernel-4.19.57-gentoo

#  label=4.19.57

# [stuff omitted - before commented out, this entry was to boot from known working kernel until 4.19.66 was proved]

image=/public/syscd-5.3.2/rescue64

  label=SysRescCd-5.3.2

  [stuff omitted]

other=/dev/sda1

  label=Windows-7

```

----------

## Tony0945

 *mojosam wrote:*   

> My computer uses BIOS. Should I switch to LILO? I followed the installation instructions in the Handbook. I think it suggested GRUB2.

   Grub legacy is still around and has an easy to edit menu. I still use on BIOS systems. I have no need for the complexity of Grub2. It;s true that bug fixes are no longer  available, but I've never had a bug. All it does it boot a kernel (or a partition as a chainloader). On one partition I have Ubuntu installed with it's version of grub2 in the partition. I just edited the grub legacy menu with nano to create the Title "Ubuntu" on a boot selection that  chainloads the partition. So grub legacy boots grub2 that boots Ubuntu. (Ubuntu really sucks too.) The portage attic should have an ebuild. If not, I can pastebin one.   On UEFI systems I boot reFind which is in the current tree. If you google for reFind and tony0945 you can find my posts that describe how to do it. My first install followed the wiki that left several things out. Like you have to boot from a UEFI CD or USB stick.

https://github.com/jezze/grub-legacy

LILO has to be reinstalled every time you change the kernel. Grub legacy only needs the menu edited with nano.

SYSLINUX has a menu that I believe is editable but I've never used it.

IMHO Grub2 is a prime example of software bloat and mission creep. The developers would have done better to develop a suite of applications that interacted and complemented each other rather than evolve the Grand Reunifed Bootloader into a monolithic mess reminiscent of Windoze and a Linux system that shall not be mentioned.

----------

## NeddySeagoon

cboldt,

That magic happens when you run /sbin/lilo

At boot time, lilo reads a block list to load whatever occupies those blocks, into RAM. 

All other bootloaders I know of navigate the filesystem to load the kernel by file name.

If you want to test, delete an old kernel from the filesystem.

Reboot and select the kernel you just deleted. It will load from the now free space ... unless its an SSD.

This continues to work until the free space is reused, then anything can happen, except booting.

----------

## Jaglover

cboldt,

with other bootloaders I can boot the kernel from /usr/src/linux/arch/x86_64/boot/ without needing to update anything, just set the /usr/src/linux symlink, build kernel and reboot. This won't work with Lilo.

----------

## cboldt

Thanks guys, now I understand what you meant.

I've burned myself on lilo a few times, years ago, and learned the hard way that even replacing a same name kernel needs to be followed by running the lilo command  :Wink:   I think that's what also got me to keeping the old kernel around until the new one was proved.

----------

