Reply
 
Thread Tools Display Modes
  #1  
Old 10-10-2008, 01:52 PM
thenrie thenrie is offline
Senior Member
 
Join Date: Jan 2008
Posts: 169
Thanks: 0
Thanked 0 Times in 0 Posts
Default question: relationship btwn loader.conf, rc.conf, kernel
I am trying to understand the relationship between kernel, /boot/defaults/loader.conf, /boot/loader.conf, /etc/defaults/rc.conf, and /etc/rc.conf.

If a module loads from kernel, but the setting for that module in /boot/defaults/loader.conf is set to "NO", is the module loaded at boot or not? Is it necessary to overide /boot/defaults/loader.conf by setting it to "YES" in /boot/loader.conf in order to load the module? What about /etc/rc.conf? Do I need to enable a module if it is loaded from the kernel?

For example, NFSCLIENT is loaded from kernel, yet it is set to nfssclient_load="NO" in /boot/defaults/loader.conf. Is it necessary to set fnsclient_load="YES" in /boot/loader.conf to keep the kernel module loaded?

After that, do I then need to enable it in /etc/rc.conf? Does a module need to be loaded AND enabled?

So then, which of the following would be correct to load and enable nfsclient:

kernel:
options NFSCLIENT

/boot/defaults/loader.conf
nfsclient_load="NO"

/boot/loader.conf
nothing

/etc/defaults/rc.conf
nfs_client_enable="NO"

(notice the difference in the name of the module in /etc/defaults/rc.conf as opposed to the module name in /boot/defaults/loader.conf)

/etc/rc.conf
nfs_client_enable="YES"

I understand that /boot/loader.conf and /etc/rc.conf override settings in /boot/defaults/loader.conf and /boot/defaults/rc.conf (respectively).

My questions are these:

1) Does /boot/defaults/loader.conf override kernel settings?
2) Must a module be loaded from kernel or /boot/loader.conf AND enabled in /etc/defaults/rc.conf or /etc/rc.conf?
3) If a module is not loaded from kernel or loader.conf, will simply enabling it in rc.conf load and enable it?

A side question: Why is the nfsclient module named "nfsclient" in kernel and boot/defaults/loader.conf and "nfs_client" in /etc/defaults/rc.conf?

Keep in mind the above questions are not specific to the nfsclient module. I am trying to understand the relationship between the various conf files and the modules.

Thanks in advance for taking time.
Tony
Reply With Quote
  #2  
Old 10-10-2008, 08:03 PM
TerryP TerryP is offline
Senior Member
 
Join Date: Nov 2005
Location: Ga. USofA
Posts: 7,906
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to TerryP Send a message via AIM to TerryP Send a message via Yahoo to TerryP
Default Re: question: relationship btwn loader.conf, rc.conf, kernel
/boot/loader.conf -- configuration file for /boot/loader (e.g. that thing that says press 1 to boot pc-bsd, 2 to boot pcbsd with acpi disabled, and so on), settings placed here will override their values in /boot/defaults/loader.conf

/boot/defaults/loader.conf -- default values for /boot/loader.conf options

/etc/rc.conf -- configuration file for the resource configuration system. Settings here will override[ any corrisponding setting in /etc/defaults/rc.conf

/etc/defaults/rc.conf -- default values for /etc/rc.conf options

/etc/rc.conf.local -- site local version of /etc/rc.conf, will override values of /etc/rc.conf; usually unused on FreeBSD but very wise to use it under PC-BSD.


Use loader when you need a kernel module loaded before boot, use rc.conf for enabling services through the rc.d directories. If a program says to add a line (or lines) to /etc/rc.conf, doing that should be *enough* unless documented over wish.



For NFS, see the handbook, essentially you only have to edit rc.conf (or rc.conf.local) for an NFS client.




And also (just for the warning, since some people try it!), it's generally unwise to edit things under an /etc/defaults, /boot/defaults, or comparable directory.
Reply With Quote
  #3  
Old 10-14-2008, 12:07 AM
thenrie thenrie is offline
Senior Member
 
Join Date: Jan 2008
Posts: 169
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: question: relationship btwn loader.conf, rc.conf, kernel
Now the followup question.

If I have, say,

options NFSCLIENT

set in the kernel, and

nfsclient_load="NO"

is set in /boot/defaults/loader.conf, is the module loaded once the os is booted up or not? If yes, then setting

nfsclient_load="YES"

in boot/loader.conf would be unnecessary. Right?

All I would need to do is set

nfsclient="YES"

in /etc/rc.conf to enable the module. Yes?

On the other hand, if /boot/defaults/loader.conf overrides the kernel setting, then I have to reload the module by setting "YES" in /boot/loader.conf (to override "defaults" which overrode "kernel") and then enable it in /etc/rc.conf. So the question is whether /boot/defaults/loader.conf overrides the options settings in the kernel. This makes my head hurt. :twisted:

??

Tony
Reply With Quote
  #4  
Old 10-17-2008, 12:04 AM
TerryP TerryP is offline
Senior Member
 
Join Date: Nov 2005
Location: Ga. USofA
Posts: 7,906
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to TerryP Send a message via AIM to TerryP Send a message via Yahoo to TerryP
Default Re: question: relationship btwn loader.conf, rc.conf, kernel
if you have the option in your kernel configuration, the code should be a part of any kernel built with that configuration, unless it only supports being used as a module.

But yes, in general, recompiling your kernel with the necessary options (as outlined in the man page, e.g. man 4 ath for the ath wireless driver) removes the need to load it via /boot/loader.conf


Which would free you to add nfs_client_enable="YES" to /etc/rc.conf.


Under FreeBSD 7.0-Release, the only thing that was necessary for basic NFS capabilities on my machines was enabling nfs_client_enable="YES" in rc.conf
Reply With Quote
  #5  
Old 10-24-2008, 08:47 PM
thenrie thenrie is offline
Senior Member
 
Join Date: Jan 2008
Posts: 169
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: question: relationship btwn loader.conf, rc.conf, kernel
I think I am getting this. Little by little. My line of questioning was not specific to nfs, I was just using that as an example. My confusion came after reviewing my kernel and comparing that to /boot/DEFAULTS/loader.conf. It seemed a lot of things were loaded as options in the kernel, but set to "NO" in DEFAULTS/loader.conf. I didn't know whether the module would be loaded or not. It seemed like conflicting commands telling the kernel to load it, but then telling the boot loader not to load it, so then, who wins? Is it loaded at boot?

If it is loaded, then all I should need to do is enable it in rc.conf. If not, then I need to change the setting in /boot/loader.conf to [modulename]_load="YES" to load it, then enable it in rc.conf.

It appears from my experimentation that the kernel wins and all I need to do is enable the module in rc.conf if it is in the kernel, despite the "NO" setting in /boot/DEFAULTS/loader.conf. If I change the setting in /boot/loader.conf to "YES" I get an error message during boot indicating the module is already loaded.

It's coming.

TH
Reply With Quote
  #6  
Old 10-25-2008, 07:29 PM
TerryP TerryP is offline
Senior Member
 
Join Date: Nov 2005
Location: Ga. USofA
Posts: 7,906
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to TerryP Send a message via AIM to TerryP Send a message via Yahoo to TerryP
Default Re: question: relationship btwn loader.conf, rc.conf, kernel
the relationship of kernel / modules is more or less something a C/C++ programmer would deal with, the FreeBSD kernel is mostly in C and some assembly.


Essentially, a program is made up of 'parts' of information. Often some of these parts are used by many other programs, if you've ever used Windows this is what a .dll file is; commonly called a 'shared library' under unix systems and else wheres. When you run the program, the operating system 'sees' that part of the program is missing, and then links the programs executable with the necessary part (shared library files) in order for it to run properly.


So simply put, either the parts are inside the program (options in the kernel) or need to be found and added into it later (lines in loader.conf). What I've said is not 100% accurate to how loadable kernel modules work, but conceptually, it is from a users point of view.



So when you have a line in loader.conf that says to load a module, you are telling the system that a required part of the kernel is missing from /boot/kernel/kernel, and must be loaded in order for the system to work correctly. When you place an option or device entry in your kernel configuration and 'make' a new kernel, you are telling the make program to include those parts in /boot/kernel/kernel, so the module is not needed, because it's no longer 'missing' from the kernels program file, having been inserted into the kernel when it was made.
Reply With Quote
  #7  
Old 10-29-2008, 03:40 PM
thenrie thenrie is offline
Senior Member
 
Join Date: Jan 2008
Posts: 169
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: question: relationship btwn loader.conf, rc.conf, kernel
Ok. That helped. Just to make sure I understand correctly, if a module is included in the kernel build, a setting of [modulename]_load="NO" in /boot/DEFAULTS/loader.conf or /boot/loader.conf will not unload it. Correct? If I want to unload a module, either after it is loaded as part of the kernel build or after loading it via /boot/loader.conf, I must kldunload it. Right?

This has been a very helpful thread for me. Thanks for taking the time.

Tony
Reply With Quote
  #8  
Old 11-01-2008, 09:55 PM
TerryP TerryP is offline
Senior Member
 
Join Date: Nov 2005
Location: Ga. USofA
Posts: 7,906
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to TerryP Send a message via AIM to TerryP Send a message via Yahoo to TerryP
Default Re: question: relationship btwn loader.conf, rc.conf, kernel
Right

Except if it is built into the kernel, I don't think you can't unload it. So say, your kernel has 'device ath' in the configuration, kldunload ath would likely fail, because 'device ath' in the kernel configuration built it directly into the kernel itself, rather then as a module to be loaded via /boot/loader.conf /or kldload.
Reply With Quote
  #9  
Old 11-02-2008, 11:08 PM
thenrie thenrie is offline
Senior Member
 
Join Date: Jan 2008
Posts: 169
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: question: relationship btwn loader.conf, rc.conf, kernel
OK, that makes sense. Thanks again.

Tony :idea:
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
installCD gets to loader.conf followed by endless scrolling originalsurfmex Installing PC-BSD 1 08-14-2009 12:42 AM
xorg.conf question putu FreeBSD Help 3 01-13-2008 05:37 PM
/boot/loader.conf question gammaray General Questions 6 08-01-2007 03:23 AM
Default to ACPI in loader.conf? Ph0eniX General Questions 6 02-17-2007 06:44 AM
edit loader.conf graphically Rom Raptor General Questions 8 09-16-2005 02:13 PM


All times are GMT. The time now is 09:24 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

Copyright 2005-2010, The PC-BSD Project. PC-BSD and the PC-BSD logo are registered trademarks of iXsystems.
All other content is freely available for sharing under the terms of the Creative Commons Attribution License.