Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Monolithic kernel attempting to insert modules *LONG*
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
wulfin
n00b
n00b


Joined: 20 Jan 2003
Posts: 2
Location: Virginia

PostPosted: Tue Aug 12, 2003 9:10 pm    Post subject: Monolithic kernel attempting to insert modules *LONG* Reply with quote

I am building a system, with the latest sources, to use a fully monolithic kernel, i.e. completely without loadable module support in the kernel. The kernel compilation is golden, boots just fine. However I have run into two problem with the boot scripts failing to properly detect the lack of module support (i.e. no /proc/modules). I managed to track down and work around the first issue with /etc/init.d/modules but the second issue appears to come from /etc/init.d/clock.

Problem 1:
On boot, /etc/init.d/modules has a check within the start stanza that reads:
Code:
 [ -f /proc/modules ] || return 0

For some strange reason, this check failed to return properly when no /proc/modules was present, and would then happily run modules-update and fail atrociously when it blindly forces its way through
Code:
load_modules /etc/modules.autoload.d/kernel-2.4

The work around here was to replace the above check with
Code:
if [ ! -f /proc/modules]; then
     return 0
fi       
reversing the logic of the test. I still am not sure why this negated version works, however, it does provide the desired result of not attempting to load any modules. It would seem that somehow a /proc/modules is present at boot time yet not once the kernel is available for user logins. If the test is run slightly modified by hand after boot the result is
Code:
 aello root# [ -f /proc/modules ] || echo TRUE
TRUE
aello root#
indicating the original test is proper yet failing.

Problem 2:
After the workaround is applied, a new series of errors with modprobe arise during boot. This block shows the error in particular:
Code:
* Setting system clock to hardware clock [UTC] ...
modprobe: Can't open dependencies file /lib/modules/2.4.20-gentoo-r5/modules.dep
 (No such file or directory)
modprobe: Can't open dependencies file /lib/modules/2.4.20-gentoo-r5/modules.dep
 (No such file or directory)
modprobe: Can't open dependencies file /lib/modules/2.4.20-gentoo-r5/modules.dep
 (No such file or directory)
modprobe: Can't open dependencies file /lib/modules/2.4.20-gentoo-r5/modules.dep
 (No such file or directory)                                                  [ok]

This message appears in /etc/init.d/clock which depends on /etc/init.d/localmount which has the following check in it for usbcore support:
Code:
if [ -f /proc/modules]
then
    modprobe usbcore &>/dev/null
fi
This check should be silent about errors given the redirect, even if the test was failing here as well. Large amounts of experimentation did nothing to change the result of the test or the error message. So, I moved on to drastic measures and removed everything from /etc/init.d/localmount that had anything to do with USB. The resulting start stanza looks like:
Code:
        # Mount local filesystems in /etc/fstab.
        ebegin "Mounting local filesystems"
        mount -at nocoda,nonfs,noproc,noncpfs,nosmbfs,noshm >/dev/null
        eend $? "Some local filesystem failed to mount"

        #swap on loopback devices, and other weirdnesses
        ebegin "Activating (possibly) more swap"
        /sbin/swapon -a &>/dev/null
        eend 0

This did nothing to change the error block. So I got even more drastic and started to attack the /etc/modules* files. After renaming modules.conf to modules.conf.NONE, the error block changed, complaining about the lack of /etc/modules.conf. I commented out
Code:
include /etc/modules.conf
in /etc/modules.devfs and lo and behold, the error message returned to the block listed above.

I am now fully at a loss. I can't find a reference to modules.devfs in the man pages, in any of the runlevel scripts, in any file in /etc, nor can I find anything similar in the forums. How can I clear up this final reference to modprobe and determine what is attempting to use or require loadable modules to run?

Also, is there a better thought on how to fix the test in Problem 1? Reversing what appears to be good logic "because it works" is not my favorite way to fix things! Any thoughts would be most appreciated!
Back to top
View user's profile Send private message
Peaceable Frood
Guru
Guru


Joined: 06 Apr 2003
Posts: 338
Location: New Jersey, USA

PostPosted: Tue Aug 12, 2003 10:23 pm    Post subject: Reply with quote

Why do you want/need a monolithic kernel in the first place? I know we all want to follow Linus the god that he is. However a monolithic is big and slows down boot time.
_________________
"Our enemies are innovative and resourceful, and so are we, they never stop thinking about new ways to harm our country and our people, and neither do we." George W. Bush
Back to top
View user's profile Send private message
Cicero
Apprentice
Apprentice


Joined: 21 Jul 2003
Posts: 220

PostPosted: Wed Aug 13, 2003 1:43 am    Post subject: Reply with quote

That's besides the point. The rc-scripts were obviously designed to deal with a monolithic kernel, and they aren't doing their job properly. Having not ever dealt with a monolithic kernel, I can't confirm anything, neither do I have enough scripting knowledge to be able to help. My only suggestion would be to try the masked version of baselayout. Several issues have been fixed in it, and it works fine on my vmware install. Better than the stable version I'm really running, anyway.
Back to top
View user's profile Send private message
Sapienter
n00b
n00b


Joined: 16 Jul 2003
Posts: 22
Location: Columbus, OH

PostPosted: Tue Sep 30, 2003 11:53 pm    Post subject: Reasons for a monolithic kernel Reply with quote

1) The gentoo security doc suggests it as an added level of defense, making a number of rootkits/hacks more difficult to apply.

2) If you are compiling a server kernel (as I am) good security policy (as well as speed, efficiency, etc) is to remove kernel features not needed. Since the server provides the same services, with the same hardware ALL THE TIME, modularity is one such service.

3) If you compile with modules, you thin have to keep all those modules around and herd them to and fro, annoying when you are working on making boot disks and trimmed down images.

BTW, I ran into EXACTLY the same trouble with the current Gentoo. I have searched the forums and not found anyone with a solution yet (although many commented on the various issues with it the module detection code, such as the /dev/rtc warning)
_________________
"The spirit of the law is the least of the things we are prepared to violate."
--from http://www.schlockmercenary.com/
Back to top
View user's profile Send private message
Baldzius
Apprentice
Apprentice


Joined: 17 Mar 2003
Posts: 154
Location: Lithuania

PostPosted: Wed Oct 01, 2003 8:38 am    Post subject: Re: Monolithic kernel attempting to insert modules *LONG* Reply with quote

wulfin wrote:


Problem 2:
After the workaround is applied, a new series of errors with modprobe arise during boot. This block shows the error in particular:
Code:
* Setting system clock to hardware clock [UTC] ...
modprobe: Can't open dependencies file /lib/modules/2.4.20-gentoo-r5/modules.dep
 (No such file or directory)
modprobe: Can't open dependencies file /lib/modules/2.4.20-gentoo-r5/modules.dep
 (No such file or directory)
modprobe: Can't open dependencies file /lib/modules/2.4.20-gentoo-r5/modules.dep
 (No such file or directory)
modprobe: Can't open dependencies file /lib/modules/2.4.20-gentoo-r5/modules.dep
 (No such file or directory)                                                  [ok]



CONFIG_RTC=y ?
Back to top
View user's profile Send private message
Sapienter
n00b
n00b


Joined: 16 Jul 2003
Posts: 22
Location: Columbus, OH

PostPosted: Wed Oct 01, 2003 6:28 pm    Post subject: Reply with quote

Mmm, nope. See, we WANT the RTC feature, but it certainly doesn't need to modprobe anything. Monolithic kernels have no modules (or rather their modules are permanently embedded in the kernel). The RTC feature is working perfectly, and should remain that way. MODPROBE is complaining because it cannot INSERT the modules (it can't insert anything in fact, and doesn't need to).

The real issue is simply that the boot scripts are failing to detect that our kernels neither need nor support module insertion. The only way I was able to stop the error was by replacing my modprobe binary with a do nothing program.
_________________
"The spirit of the law is the least of the things we are prepared to violate."
--from http://www.schlockmercenary.com/
Back to top
View user's profile Send private message
curtis119
Bodhisattva
Bodhisattva


Joined: 10 Mar 2003
Posts: 2160
Location: Toledo, Ohio,USA, North America, Earth, SOL System, Milky Way, The Universe, The Cosmos, and Beyond.

PostPosted: Wed Mar 24, 2004 5:20 pm    Post subject: Reply with quote

I am having the same problem. I have a box that boots from the network with pxegrub. I have no modules.dep or anything else module related. This interferes with devfs (somehow) because when I try to do a cfdisk on the internel ide harddirve (which is used for /home) it says it is able to writethe partition info but not re-read it. After a reboot there is no hda1. This box has no floppy and no cdrom. The internal hd is only 500MB so installing locally is not an option.

HELP!!!!!!!!!
_________________
Gentoo: it's like wiping your ass with silk.
Back to top
View user's profile Send private message
Markus_T
n00b
n00b


Joined: 09 Feb 2004
Posts: 49
Location: Berlin

PostPosted: Tue Apr 06, 2004 10:37 am    Post subject: Reply with quote

The most simple solution is to create a dummy file:
/lib/modules/2.6.5/modules.dep
(Where 2.6.5 should be changed to reflect your kernel version)
that contains nothing.
Works for me on my monolithic kernel.
Back to top
View user's profile Send private message
curtis119
Bodhisattva
Bodhisattva


Joined: 10 Mar 2003
Posts: 2160
Location: Toledo, Ohio,USA, North America, Earth, SOL System, Milky Way, The Universe, The Cosmos, and Beyond.

PostPosted: Tue Apr 06, 2004 4:35 pm    Post subject: Reply with quote

dummy modules.dep worked great. Good idea, Thanks.
_________________
Gentoo: it's like wiping your ass with silk.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum