# disabled module loading = modprobe errors

## morphal

I've just installed a hardened 2.4 kernel and I'm booting the system to play around for the first time.

I assume I must be unique in this desire because I can find no mentions of this being done.

I would like to completely disable the ability to load modules.

The idea is that I keep the kernel (relatively) small and include exactly what I need, no more. I don't need to load any modules. If I don't need to load modules on this system, neither does anyone else.

On all of my previous builds, I went with a standard 2.6 kernel and just disabled module loading in the kernel. End of story.

This time around, it hasn't been so simple. At first, I just got this error message randomly spamming through almost any prolonged series of output:

```
Failed to open config file /etc/modprobe.devfs
```

I created the file but got some other error. I rmed it and went back to the drawing board.

I tried removing module-init-tools. That generated a bunch of errors on boot/shutdown because, by default, the system tries to load/unload modules during those times.

No problem, I can just remove "modules" from the boot runlevel. Except, I can't. I remove it and it immediately gets added back and we return to the same errors.

Hm, OK, I found some oddball documentation that suggested the modutils package has the proper tools for a 2.4 kernel. I'll install that, maybe that will handle my lack of modules.

No dice. I just get a different set of errors. I could post the exact messages but the specifics are irrelevant.

The real issue seems to be that I can't get the modules script to stay out of the boot runlevel. As soon as I reboot the machine, it adds it back, claiming it's "critical." It's not critical. I just don't know how to tell it to STFU. =)

----------

## gr0x0rd

Hey man... I had a similar problem, and fixed it by recompiling the kernel by using 

make clean 

details in this thread...

https://forums.gentoo.org/viewtopic-t-613820-highlight-.html

hope this helps. happy module purging!

----------

## morphal

Unfortunately, that's not really what I'm asking. I've already got all the modules removed. Not only did I remove them, I also removed the kernel's ability to load them at all.

However, there's a modules script that, by default, loads at boot. It's primary purpose is to run modprobe and load the modules that are configured to load automatically. However, I don't need modprobe, nor do I want it. I don't have modules. I tried removing the modules script  from the boot runlevel but the system considers it a "critical" script and adds it back during shutdown. The whole time the machine is running, modprobe is attempting to load settings from various files and check for modules which generates intermittent error messages. It's a little annoying.

It would be critical if I had modules to load. It's not. I don't. How can I stop these errors?

----------

## morphal

I recently put a hardened Gentoo install on an old machine. I'm running a 2.4 kernel. My uses are very, very simple: LAMP server, SSH, that's about it.

I disabled the option in the kernel to allow the loading of modules. I compile the bare minimum into the kernel and ditch the rest. For example, I don't need USB support, sound, graphics, parallel ports, ISA ports ... really, I don't need much. I don't have any modules. Regardless, modprobe is complaining mightily.

Depending on exactly what I attempt to fix the problem, the errors change. First, I got this error:

```
Failed to open config file /etc/modprobe.devfs
```

I thought I'd be clever and uninstall modprobe. I tried switching between module-init-tools and modutils. I even tried removing the modules script (it calls modprobe) from all of the run levels. None of these things have stopped the errors.

I think removing modules from the run levels would work if I could just convince the system that it wasn't critical. As of now, it displays a message along the lines of "adding a critical <something>" and adds modules back to the boot run level. I can't actually make it stay gone.

However, that's probably not the best way to solve this particular problem. What's the "correct" way to make my system unable to load modules?

----------

## eyoung100

Your system will always load modules.  When your kernel boots, it automatically pulls in pieces, unless you disable Automatic module loading.  I would bet this is compiled in your kernel now, and this is the reason your receiving errors.  I also believe the modules sections are part of base-layout.  Try re-emerging base-layout, then recompile your kernel.

----------

## morphal

Yes, I disabled automatic module loading, that's exactly what I'm talking about. I'll try the base-layout solution though, just to see how it turns out.

----------

## nixnut

merged above three posts here.

Crossposting is not allowed. Please don't do it again. It can get you banned.

----------

## eyoung100

 *nixnut wrote:*   

> merged above three posts here.
> 
> Crossposting is not allowed. Please don't do it again. It can get you banned.

 

Thank you, for the simple reason that I had no idea that he had done so  :Shocked: 

----------

## morphal

I was unaware it was a problem. I wasn't sure what category it really belonged in. One seemed to be generating no results, so I assumed I picked the wrong category.

----------

## morphal

I'll try to summarize/explain in another way (without posting a new thread!)

I'm running a 2.4.33.4 hardened-grsec kernel. After running make menuconfig, one of the first menu options is "Loadable module support." I elected to disable this particular feature.

I've compiled a number of Gentoo systems using this exact setting in the past, but never with a hardened kernel. The hardened kernel may, or may not, be part of the problem.

Upon startup, shutdown, emerge, etc., I get the following message:

```
FATAL: Failed to open config file /etc/modprobe.devfs: No such file or directory
```

Some of my initial attempts to fix this are detailed in the preceding posts. Can anyone help?

----------

## eyoung100

 *morphal wrote:*   

> I'm running a 2.4.33.4 hardened-grsec ...

 

If I may point you here:

Gentoo Linux Kernel Guide

Gentoo Hardened Frequently Asked Questions

and quote:

 *Gentoo Linux Kernel Guide wrote:*   

> 
> 
> 4. Previously provided kernel packages
> 
> grsec-sources
> ...

 

May I also suggest:

```
cd /etc

# rm make.profile

# ln -s ../usr/portage/profiles/hardened/x86 make.profile (For 2.4 kernels)

# ln -s ../usr/portage/profiles/hardened/x86/2.6 make.profile (For 2.6 kernels)

emerge -C grsec-sources && emerge hardened-sources
```

This will get you kernel version 2.4.3.44 with the patches all added.  This should solve the file missing problem.  If not, select devfs under Psuedo Filesystems and then:

```
emerge devfsd
```

----------

## morphal

While I'm enthused to get a response, I'm afraid these suggestions don't help me much.

I looked through all of that documentation before I ever decided to build the system.

I already linked to the proper profile. That's part of the install instructions.

I can't emerge grsec-sources because it's no longer in Portage, as it says in the documentation you quoted. I emerged hardened-sources on my first attempt at this. I get all the proper, hardened security options when I begin configuring the kernel. I may have it configured improperly, but it's in there.

I already have support for devfs compiled in, along with the option to allow it to automatically mount at boot. Again, that's part of the install instructions. Trying to emerge -pv devfsd just shows it as a reinstall.

Admittedly, I am still one of those users that keeps the instructions up when starting on a new Gentoo install but I am competent enough and experienced enough that the instructions are really more of a checklist to keep me from forgetting a step and noobing it up. =)

----------

## eyoung100

Try:

```
emerge devfsd && emerge baselayout
```

----------

## morphal

I tried emerging baselayout a couple times when I got desperate and started changing some kernel options and recompiling. Still, I tried again on your advice and it didn't help. I'm really quite stumped.

----------

