Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
hotplug/coldplug modules frmly in /etc/modules.autoload.d
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
jeffk
l33t
l33t


Joined: 13 Sep 2003
Posts: 671

PostPosted: Fri Jan 13, 2006 4:06 pm    Post subject: hotplug/coldplug modules frmly in /etc/modules.autoload.d Reply with quote

Based on the etc-update of the most recent baselayout (~x86), I removed entries from my /etc/modules.autoload.d/kernel-2.6 file. The location of equivalent config files for hotplug and coldplug are not clear to me. How do I get hotplug and coldplug to take care of these modules, ensuring their availability?
Code:
powernow-k7
cpufreq_ondemand
cpufreq_powersave
uhci-hcd
usbhid
via_rhine
ndiswrapper
mii
snd-via82xx
via

Code:
[ebuild   R   ] sys-apps/hotplug-20040923-r1  0 kB
[ebuild   R   ] sys-apps/coldplug-20040920  0 kB
Back to top
View user's profile Send private message
immudium
Guru
Guru


Joined: 12 Oct 2004
Posts: 332
Location: Utah

PostPosted: Fri Jan 13, 2006 7:37 pm    Post subject: Reply with quote

I would like to know as well. Is it simply a matter of ensuring that coldplug is started in the rc boot runlevel and hotplug in the default? Most of the installation documentation I've seen in the past seemed to indicate to put coldplug in default, but that didn't seem to detect and load the network driver in time to ensure that network services such as sshd were started correctly.
Back to top
View user's profile Send private message
glowworm
Tux's lil' helper
Tux's lil' helper


Joined: 28 Jun 2005
Posts: 85

PostPosted: Fri Jan 13, 2006 11:04 pm    Post subject: Reply with quote

Agreed, for me it was:

nvidia
bc
subfs

I 'spose as long as I don't reboot until someone tries I'll be ok ;)

If I do reboot and it doesn't work I will have to modprobe them I 'spose. But just in case I'll let someone else be the guinea-pig.
_________________
2.6.18-gentoo-r1 x86
Core2Duo E6300 on an Intel DG965WH M/B
NVidia 7600GT / AIGLX / KDE / Beryl CVS
Back to top
View user's profile Send private message
dgaffuri
Advocate
Advocate


Joined: 05 Jun 2005
Posts: 2078
Location: Italy

PostPosted: Sat Jan 14, 2006 12:07 am    Post subject: Reply with quote

It refers only to network modules, so don't remove other stuff from autoload; add coldplug to boot level, hotplug init script is not needed and you may remove it from any level.
_________________
Adopt an unanswered post
If you feel that your problem has been solved please edit the top post and add [solved] to the subject
Back to top
View user's profile Send private message
glowworm
Tux's lil' helper
Tux's lil' helper


Joined: 28 Jun 2005
Posts: 85

PostPosted: Sat Jan 14, 2006 12:42 am    Post subject: Reply with quote

dgaffuri wrote:
It refers only to network modules, so don't remove other stuff from autoload; add coldplug to boot level, hotplug init script is not needed and you may remove it from any level.


Then why does the header say:

Code:
# This file should only be used to load modules that are essential to the
# mounting of local partitions, such as RAID controllers.
# Coldplug or similar should be used to load the rest of the modules


In my case nvidia, subfs and bc are not essential to load partitions.

If Coldplug is meant to load the rest of the modules which conf file do we specify the modules in?
_________________
2.6.18-gentoo-r1 x86
Core2Duo E6300 on an Intel DG965WH M/B
NVidia 7600GT / AIGLX / KDE / Beryl CVS


Last edited by glowworm on Sat Jan 14, 2006 1:13 am; edited 1 time in total
Back to top
View user's profile Send private message
dgaffuri
Advocate
Advocate


Joined: 05 Jun 2005
Posts: 2078
Location: Italy

PostPosted: Sat Jan 14, 2006 12:55 am    Post subject: Reply with quote

glowworm wrote:
If Coldplug is meant to load the rest of the modules which conf file do we specify the modules in?

None, coldplug will load modules based on the hardware it detects by scanning buses. Just add the init script to boot runlevel. Anyway modules like ppp_mppe, which are not directly related to hardware, must still go in autoload. AFAIK the only modules that trigger a service satrt are the network ones, but I may be wrong.
Code:
# WARNING: It is dangerous to put modules here which will cause hotplug to
# start services, for example network driver modules.

_________________
Adopt an unanswered post
If you feel that your problem has been solved please edit the top post and add [solved] to the subject
Back to top
View user's profile Send private message
glowworm
Tux's lil' helper
Tux's lil' helper


Joined: 28 Jun 2005
Posts: 85

PostPosted: Sat Jan 14, 2006 1:01 am    Post subject: Reply with quote

dgaffuri wrote:
coldplug will load modules based on the hardware it detects by scanning buses.


Thanks for the clarification. I think the header should be modified to be a little more clear on this. As it currently reads; all modules except for disk controllers should be removed. This is clearly not the case.

Just did a reboot and my three modules are *not* reloaded. While subfs and bc are understandably not linked to hardware nvidia is. In this case nvidia was not loaded by coldplug.

Keeping in mind:
Code:
# WARNING: It is dangerous to put modules here which will cause hotplug to
# start services, for example network driver modules.

As none of these three modules start hotplug services I have put the modules back in autoload and after rebooting again everything has returned to normal.

Edit: Looks like this could be the bug: https://bugs.gentoo.org/show_bug.cgi?id=118419
_________________
2.6.18-gentoo-r1 x86
Core2Duo E6300 on an Intel DG965WH M/B
NVidia 7600GT / AIGLX / KDE / Beryl CVS
Back to top
View user's profile Send private message
immudium
Guru
Guru


Joined: 12 Oct 2004
Posts: 332
Location: Utah

PostPosted: Sat Jan 14, 2006 1:27 am    Post subject: Reply with quote

glowworm wrote:
I think the header should be modified to be a little more clear on this. As it currently reads; all modules except for disk controllers should be removed. This is clearly not the case


Agreed.


dgaffuri wrote:
hotplug init script is not needed and you may remove it from any level


dgaffuri, could you expand on hotplug just a little? Do you mean that hotplug is not need specifically in the instance of loading modules? Or do you mean that it's not needed in general, under most circumstances, at all? I thought hotplug was responsible for loading drivers such as usb mice, for example, plugged in after the system is already completely up and running?

Anyways, thanks very much for clearing things up for me on coldplug/modules.autoload!
Back to top
View user's profile Send private message
dgaffuri
Advocate
Advocate


Joined: 05 Jun 2005
Posts: 2078
Location: Italy

PostPosted: Sat Jan 14, 2006 2:07 pm    Post subject: Reply with quote

@glowworm
Strange, my nvidia module is loaded fine during boot.

@immudium
I meant that the hotplug init script, /etc/init.d/hotplug, is empty and is not needed in any runlevel
Code:
....
#
# nothing here anymore. Please use the coldplug package if you really want to
# load modules for devices that are discovered by your kernel before init runs.
#
# However, please realize that if you have any problems, the developers
# recommend just using the modules.autoload functionality to handle this in a
# much simpler manner.
#
# Comments, flames, and fine beer should be directed at gregkh@gentoo.org
#
....
start () {
        # just verify that people build their kernel with hotplug support.
        if [ ! -f /proc/sys/kernel/hotplug ] ; then
                eerror "CONFIG_HOTPLUG not enabled for this kernel!"
                return 1
        fi
        # This unpacks any firmware tarballs.  Used for LiveCD.
        if [ -e /lib/firmware.tar.bz2 ]
        then
                ebegin "Unpacking hotplug firmware"
                tar xjf /lib/firmware.tar.bz2 -C /lib/firmware
                eend 0
        fi
}

The way hotplug works is a little tricky, and depends on your system configuration. First, you need hotplug to use coldplug. The /sbin/hotplug script (and some of the scripts and conf files in /etc/hotplug directory) is invoked by the coldplug init scripts (/etc/hotplug/*.rc) for devices discovered while scanning buses. In turn /sbin/hotplug run the .hotplug scripts found in /etc/hotplug.d
Code:
# ls -l /etc/hotplug.d/default/
total 4
lrwxrwxrwx  1 root root   22 Dec 23 17:56 10-udev.hotplug -> ../../../sbin/udevsend
lrwxrwxrwx  1 root root   24 Jan  4 01:18 20-hal.hotplug -> /usr/libexec/hal.hotplug
-rwxr-xr-x  1 root root 2931 Nov 27 22:44 default.hotplug

# equery b /etc/hotplug.d/default/*
[ Searching for file(s) ... ]
sys-fs/udev-079 (/etc/hotplug.d/default/10-udev.hotplug -> ../../../sbin/udevsend)
sys-apps/hal-0.5.5.1-r3 (/etc/hotplug.d/default/20-hal.hotplug -> /usr/libexec/hal.hotplug)
sys-apps/hotplug-20040923-r1 (/etc/hotplug.d/default/default.hotplug)

The default.hotplug script also uses configuration files and scripts in /etc/hotplug to perform actions.

Hotplug setup happens in /lib/rcscripts/addons/udev-start.sh, which in turn is invoked by /sbin/rc
Code:
        # Setup hotplugging (if possible)
        ebegin "Setting up proper hotplug agent"
        if [[ -e /proc/sys/kernel/hotplug ]] ; then
                if [ "$(get_KV)" -gt "$(KV_to_int '2.6.14')" ] ; then
                        einfo "  Using netlink for hotplug events..."
                        echo "" > /proc/sys/kernel/hotplug
                elif [[ $(udev_version) -ge "48" ]] ; then
                        einfo "  Setting /sbin/udevsend as hotplug agent ..."
                        echo "/sbin/udevsend" > /proc/sys/kernel/hotplug
                elif [[ -x /sbin/hotplug ]] ; then
                        einfo "  Using /sbin/hotplug as hotplug agent ..."
                else
                        einfo "  Setting /sbin/udev as hotplug agent ..."
                        echo "/sbin/udev" > /proc/sys/kernel/hotplug
                fi
        fi
        eend 0

As you see the way hotplug works depend on kernel, baselayout and udev versions (I have 2.6.15 kernel, baselayout-1.12.0_pre14 and udev-079). With udev >= 48 udevsend is used as hotplug agent (except for 2.6.15 which uses the new direct netlink mechanism), and in turn invoke hotplug actions. This is from /etc/udev/rules.d/50-udev.rules
Code:
# be backward compatible for a while with the /etc/dev.d and /etc/hotplug.d/ systems
# run /etc/hotplug.d/ stuff only if we came from a hotplug event, not for udevstart
ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd"

# always run /etc/dev.d/ stuff for now.
RUN+="/sbin/udev_run_devd"

Hope this may help to clarify a little (I don't pretend to be completely accurate, but just to give an idea).
_________________
Adopt an unanswered post
If you feel that your problem has been solved please edit the top post and add [solved] to the subject
Back to top
View user's profile Send private message
immudium
Guru
Guru


Joined: 12 Oct 2004
Posts: 332
Location: Utah

PostPosted: Sat Jan 14, 2006 8:25 pm    Post subject: Reply with quote

dgaffuri:

Oh wow! What a terrific explanation. Thank You. I never realised that hotplug was so interdependent among so many various components. I always had such a basic, naive understanding of it all. I really appreciate the effort. This thread is definitely going in my favorites list. I'm sure I'll be referring to it quite often in the future.
Back to top
View user's profile Send private message
ScRaTcHi
n00b
n00b


Joined: 21 Dec 2004
Posts: 62

PostPosted: Mon Jan 16, 2006 1:59 pm    Post subject: Reply with quote

If Gentoo is about choices, how do I choose what modules are loaded at boot???
I mean, I have 3 NICs in my PC each one with different IP/MASK/ROUTE.
I really don't want all of them to start at boot because my networking is then
screwed up. I use certain NICs depending wheter I'm at home doing NAT,
at work or at the customers office. Is it possible to use any other (or my own)
init script to modprobe modules I want and disable coldplug to do that?
_________________
ScRaTcHi

-----------------------------------------------------------

Never trust an operating system you don't have sources for.
Back to top
View user's profile Send private message
daff
Apprentice
Apprentice


Joined: 02 Jul 2003
Posts: 232
Location: Vienna, Austria

PostPosted: Wed Jan 18, 2006 3:47 pm    Post subject: Reply with quote

ScRaTcHi wrote:
If Gentoo is about choices, how do I choose what modules are loaded at boot???
I mean, I have 3 NICs in my PC each one with different IP/MASK/ROUTE.
I really don't want all of them to start at boot because my networking is then
screwed up. I use certain NICs depending wheter I'm at home doing NAT,
at work or at the customers office. Is it possible to use any other (or my own)
init script to modprobe modules I want and disable coldplug to do that?

That's what I'd like to know, too.

I just have a wireless and a wired interface and I do not want coldplug to automatically load the modules for the wireless interface. I want to explicitly tell the system when I want it to create a wireless connection (by means of ACPI and Fn-F5 on my laptop) and certainly don't want it to drain battery power when there is no intention (or possibility) to connect wirelessly. I don't care about the wired interface; its module (the e1000) may be loaded by coldplug, no problems with that (although ideally the module would only get loaded if I put a cable in the wired connector, but that the Chicken-and-Egg thing again, right?).

But coldplug autoloading anything wireless without knowing if I even want to use the wireless interface seems stupid to me.

Is there any way to accomplish this, other than dropping the use of coldplug again and going back to using /etc/modules.autoload.d/kernel-2.6?
_________________
Instead of asking why a piece of software is using 1970s technology,
start asking why software is ignoring 30 years of accumulated wisdom.
Back to top
View user's profile Send private message
dj_farid
l33t
l33t


Joined: 14 Jun 2004
Posts: 613

PostPosted: Wed Jan 18, 2006 9:55 pm    Post subject: Reply with quote

So today I emerged the new baselayout. I did an etc-update after that, which in turn did something automatically. The rest of the files which it did not do automatically were checked by me one by one. So I rebooted and my USB mouse did not work.
After reading the dmesg, I checked /etc/modules.autoload.d. It was empty!

So I did modprobe ohci-hcd and ehci-hcd. Now the mouse works again.
I had these two modules amongst others loaded in the /etc/modules.autoload.d before. Is there an other way more preferred way of loading these modules?
Why was the file overwritten?
Back to top
View user's profile Send private message
dgaffuri
Advocate
Advocate


Joined: 05 Jun 2005
Posts: 2078
Location: Italy

PostPosted: Wed Jan 18, 2006 10:29 pm    Post subject: Reply with quote

ScRaTcHi wrote:
I have 3 NICs in my PC each one with different IP/MASK/ROUTE. I really don't want all of them to start at boot because my networking is then screwed up. I use certain NICs depending wheter I'm at home doing NAT, at work or at the customers office. Is it possible to use any other (or my own) init script to modprobe modules I want and disable coldplug to do that?

daff wrote:
I just have a wireless and a wired interface and I do not want coldplug to automatically load the modules for the wireless interface. I want to explicitly tell the system when I want it to create a wireless connection (by means of ACPI and Fn-F5 on my laptop) and certainly don't want it to drain battery power when there is no intention (or possibility) to connect wirelessly.

If you don't want to load your NIC modules at boot then surely they're not in modules.autoload.d, and you already have an alternative way to load them when needed. Nobody is forcing you to use coldplug in this case, just go on with your current scripts. If on the other hand you've modules in autoload then you should remove them and either use coldplug, which will load them at safe time, later during boot, or again use an alternative method.

With baselayout 1.12 (don't know if hotplugging is enabled in 1.11) if you use cold/hotplug and don't want NICs autostart on module loading you may set
Code:
hotplug_<iface>="no"

in /etc/conf.d/net.

Personally (for completely different reasons, I use coldplug but my laptop won't reboot with the ipw2200 module loaded) I have this in /etc/conf.d/net
Code:
preup() {
        if [[ "${IFACE}" == "eth1" ]] && ! interface_exists "${IFACE}" ; then
                /sbin/modprobe ipw2200
        fi
        return 0
}

postdown() {
        if [[ "${IFACE}" == "eth1" ]] ; then
                /sbin/modprobe -r ipw2200
        fi
        return 0
}

so that module loading and unloading is accomplished by /etc/init.d/net.eth1 start or stop. Of course it works because my wired eth0 is always loaded, so that I'm sure that eth1 is the wireless one, and you may need to elaborate on this to handle different NICs.

BTW, our devs are working on the "autoload is too early with hotplug" issue, see updated status of the already pointed to bug.
_________________
Adopt an unanswered post
If you feel that your problem has been solved please edit the top post and add [solved] to the subject
Back to top
View user's profile Send private message
daff
Apprentice
Apprentice


Joined: 02 Jul 2003
Posts: 232
Location: Vienna, Austria

PostPosted: Wed Jan 18, 2006 11:58 pm    Post subject: Reply with quote

dgaffuri wrote:
ScRaTcHi wrote:
I have 3 NICs in my PC each one with different IP/MASK/ROUTE. I really don't want all of them to start at boot because my networking is then screwed up. I use certain NICs depending wheter I'm at home doing NAT, at work or at the customers office. Is it possible to use any other (or my own) init script to modprobe modules I want and disable coldplug to do that?

daff wrote:
I just have a wireless and a wired interface and I do not want coldplug to automatically load the modules for the wireless interface. I want to explicitly tell the system when I want it to create a wireless connection (by means of ACPI and Fn-F5 on my laptop) and certainly don't want it to drain battery power when there is no intention (or possibility) to connect wirelessly.

If you don't want to load your NIC modules at boot then surely they're not in modules.autoload.d, and you already have an alternative way to load them when needed. Nobody is forcing you to use coldplug in this case, just go on with your current scripts. If on the other hand you've modules in autoload then you should remove them and either use coldplug, which will load them at safe time, later during boot, or again use an alternative method.

Thanks for your ansewr! Of course, you are right, but ...

Using modules.autoload.d I can make sure the module for the wired ethernet adapter is loaded every time when booting, but the module for the wireless link is loaded only when I do it manually (Fn-F5). This seems not possible with coldplug as far as I understand because it will load the modules for every possible NIC.
dgaffuri wrote:

With baselayout 1.12 (don't know if hotplugging is enabled in 1.11) if you use cold/hotplug and don't want NICs autostart on module loading you may set
Code:
hotplug_<iface>="no"

in /etc/conf.d/net.

This seems to work fine, however it is also not what I need. The interface is not started (i.e. it does not try to associate with any wireless LAN) but the modules are still loaded, which means the wireless card is still swichted on and broadcasting, thus draining power until I unload the module manually.

Apart from preup and predown/postdown functions (which I am not sure would really help in such a situation) there is no way to tell hotplug to not load a specific module?
_________________
Instead of asking why a piece of software is using 1970s technology,
start asking why software is ignoring 30 years of accumulated wisdom.
Back to top
View user's profile Send private message
dgaffuri
Advocate
Advocate


Joined: 05 Jun 2005
Posts: 2078
Location: Italy

PostPosted: Thu Jan 19, 2006 1:28 am    Post subject: Reply with quote

daff wrote:
Using modules.autoload.d I can make sure the module for the wired ethernet adapter is loaded every time when booting, but the module for the wireless link is loaded only when I do it manually (Fn-F5). This seems not possible with coldplug as far as I understand because it will load the modules for every possible NIC.

What I was suggesting is to put your wired NIC module in autoload and set hotplug="no" in /etc/conf.d/net, without using coldplug.

daff wrote:
This seems to work fine, however it is also not what I need. The interface is not started (i.e. it does not try to associate with any wireless LAN) but the modules are still loaded, which means the wireless card is still swichted on and broadcasting, thus draining power until I unload the module manually.

Don't put module in autoload.d and load it in your scripts, the preup stuff make scripts easier, module is loaded when you run /etc/init.d/net.<iface> start.

I've not tried this, so I may be wrong.
_________________
Adopt an unanswered post
If you feel that your problem has been solved please edit the top post and add [solved] to the subject
Back to top
View user's profile Send private message
drphibes
Guru
Guru


Joined: 30 Nov 2004
Posts: 432

PostPosted: Fri Jan 20, 2006 4:48 pm    Post subject: Reply with quote

modules i found don't get loaded unless i explicitly put them in kernel-2.6 include:

ide_cd
ide_scsi
psmouse
lp
sg

all others i used to load explicitly (below) i have now commented out as per the recommendations. they all get loaded at boot:

ehci_hcd
uhci_hcd
nvidia
bcm4400
bttv

i used to include fuse in kernel-2.6, but now i will simply let explicit fuse mount requests load it as needed.

udev-079
baselayout-1.11.14-r2
Back to top
View user's profile Send private message
dj_farid
l33t
l33t


Joined: 14 Jun 2004
Posts: 613

PostPosted: Fri Jan 20, 2006 10:37 pm    Post subject: Reply with quote

Weird that your finds the ehci_hcd and uhci_hcd modules since mine did not. I have to load them from kernel-2.6.

Also I have snd-emu10k1 loaded in kernel-2.6. If I don't have it there alsa loads it after my usb phone. I have the snd-emu10k1 defined as card0 (default device) in alsa, but for some reason the usb phone takes it's place.
Back to top
View user's profile Send private message
drphibes
Guru
Guru


Joined: 30 Nov 2004
Posts: 432

PostPosted: Sat Jan 21, 2006 1:00 am    Post subject: Reply with quote

I think since I now have a usb device that is always powered on hanging off the usb bus when
I boot, the ehci_hcd and uhci_hcd entries get loaded automatically. I am fairy sure that, were I to
turn off that device and reboot, those guys wouldn't get loaded (that's why I put them in kernel-2.6
in the first place). I also had to put the bttv entry back in kernel-2.6 because otherwise bttv loads
without the card= and tuner= parameters and the tv card isn't set properly. That kernel-2.6 file is
still important for me.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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