LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-13-2009, 01:08 PM   #1
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Rep: Reputation: 69
I need some help understanding modules...


I'm running Slackware 12.2 with Xfce 4.4.3 on kernel 2.6.27.7-smp. I have taken a good look at all the rc scripts in /etc/rc.d. However, I'm trying to find the script that loads up the ethernet adapter, wireless card, graphics card, etc. Usually those modules would be loaded in the /etc/rc.d/rc.modules script, but all the modules are commented out except a part about updating the modules with depmod. Anyhow, I've read that if /etc/rc.d/rc.modules is mostly commented out, then my os should be using kmod. So I checked /usr/src/linux/Documentation/kmod.txt to learn about kmod. I have /usr/src/linux/Documentation (so I have the kernel source), but there's no kmod.txt. So should I assume that my os isn't using kmod? Also, I've checked /etc/init.d (empty except for function) and the same for /etc/rc.d/init.d. I also checked /etc/rc.d/rc4.d/ (empty).

I know that all the drivers I'm looking for are found in /lib/modules/$(uname -r), but I want to see the actual script that loads these modules. I've been running tests to find out which script is responsible. I commented out all the lines that would load up acpid in the /etc/rc.d scripts, yet acpid still loads at bootup, so I know there's another script elsewhere on my filesystem that loads up acpid. Would Slackware 12.2 or Xfce itself have a script that would load some of these modules?

What do you guys think?

Last edited by trist007; 03-13-2009 at 01:11 PM.
 
Old 03-13-2009, 01:17 PM   #2
samac
Senior Member
 
Registered: Mar 2004
Location: Westray, Orkney
Distribution: Linux Mint 17.1
Posts: 1,424

Rep: Reputation: 137Reputation: 137
Look in /etc/rc.d the first script run is rc.S, rc.M is the multiuser script and rc.local is if you wish to add anything. This should get you started but it is not a detailed breakdown of the rc.d/ directory.

samac
 
Old 03-13-2009, 01:17 PM   #3
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Most modules are loaded automatically as needed by the kernel, as for acpid, that's not a module that's a daemon and it's started in '/etc/rc.d/rc.acpid'.
 
Old 03-13-2009, 02:53 PM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,781

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Hi There.

Have you discovered /etc/modprobe.d/ ??

The trick is: You tall the kernel; what modules to load, and it loads them when you want them. My ethernet card uses the sis900.ko module. So a line like this

alias eth0 sis900

in any file in /etc/modprobe.d will tell the kernel to load that module when it wants the nic. Don't start trying to grok the rc scripts if you want my advice - you will only end up in a home for the bewildered. So then you don't load the modules - you just start dhcpcd or dhclient, and the kernel drops the module in and things come alive automagically.
 
Old 03-14-2009, 03:12 AM   #5
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Original Poster
Rep: Reputation: 69
Seems all the modules for the ethernet adapter, wireless card, etc are in the /proc/modules. However, editing the /proc/modules file is rather funny. It has 444 permissions so I changed it to 644 so I can edit as root, commenting out the ones I don't want, but even then it gives me a weird warning message about saving it. I know the proper way to remove or add modules in this file would be to modprobe or modprobe -r the module. I just wanted to see where the script or in this case the list of what 3rd party modules get loaded at boot.

You know, I'm still confused. I've gone through all the /etc/rc.d scripts and commented out the lines that load the rc.acpid daemon, I've even removed all the x permissions for the /etc/rc.d/rc.acpid file, and for some reason acpid still gets loaded at bootup. Where is this script that I'm not seeing that loads up acpid?

I do know that in the /proc/modules file there exists the ac, battery, etc modules which a apart of the acpid daemon. Would loading these modules automatically start the acpid daemon? Is this why the acpid still gets loaded on bootup?
 
Old 03-14-2009, 03:56 AM   #6
samac
Senior Member
 
Registered: Mar 2004
Location: Westray, Orkney
Distribution: Linux Mint 17.1
Posts: 1,424

Rep: Reputation: 137Reputation: 137
/proc is a non-persistent directory that gets created each time the machine is booted, it should not and probably cannot be edited.
Code:
chmod -x /etc/rc.d/rc.acpid
should stop acpi from loading, but if you want belt and braces
Code:
removepkg acpid
as root will completely remove any trace of acpi.

samac
 
Old 03-14-2009, 06:38 AM   #7
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,917
Blog Entries: 28

Rep: Reputation: 2208Reputation: 2208Reputation: 2208Reputation: 2208Reputation: 2208Reputation: 2208Reputation: 2208Reputation: 2208Reputation: 2208Reputation: 2208Reputation: 2208
Hi,

Look at 'Slackware's init' to get a understanding generally by a tour of the rc scripts. The document is dated but applicable to give you a guide and background.

This link and others are available from 'Slackware-Links'. More than just SlackwareŽ links!
 
Old 03-14-2009, 09:40 AM   #8
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 231Reputation: 231Reputation: 231
Quote:
Seems all the modules for the ethernet adapter, wireless card, etc are in the /proc/modules.
As said - this is just where the kernel stores information. It generally should not be written to. To see what modules are loaded run
Code:
lsmod
As H_TeXMeX_H says - most modules are automatically loaded by the kernel. Additional modules may be loaded via /etc/rc.d/rc.modules. Running
Code:
chmod -x /etc/rc.d/rc.acpid
should stop the acpi daemon from running - why do you think it's still running after doing this ?
 
Old 03-14-2009, 12:36 PM   #9
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Original Poster
Rep: Reputation: 69
business_kid, yeah I've found /etc/modprobe.d. I read the /etc/modprobe.d/modprobe.conf and it says that it's deprecated. It says to place files in the /etc/modprobe.d for stuff to load. The only files in there are blacklist, isapnp, psmouse, and usb-controller. I know that blacklist does just that of the modules listed inside the file. As for the other files, those do get loaded at bootup. However, the ethernet adapter, wireless adapter, and video card modules aren't in the /etc/modprobe.d dir.

I have already chmod -x /etc/rc.d/rc.acpid , plus I commented out the rc.acpid line in the rc.M. I think any one of these two ways would disable acpid. However, the reason I think that acpid still gets loaded is because I see these lines at bootup,


ACPI: Power Button (FF) [PWRF]
input: Power Button (CM) as /devices/LNXSYSTM:00/device:00/PNP0C0C:00/input/input3
ACPI: Power Button (CM) [PWRB]
input: Lid Switch as /devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4
ACPI: Lid Switch [LID]
ACPI: AC Adapter [ACAD] (off-line)
ACPI: WMI: Mapper loaded
ACPI: Battery Slot [BAT1] (battery absent)
processor ACPI0007:00: registered as cooling_device0
ACPI: Processor [CPU0] (supports 8 throttling states)
processor ACPI0007:01: registered as cooling_device1
acpi device:20: registered as cooling_device2
input: Video Bus as /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1e/device:1f/input/input5
sd 2:0:0:0: Attached scsi generic sg0 type 0
ACPI: Video Device [VGA] (multi-head: yes rom: no post: no)
thermal LNXTHERM:01: registered as thermal_zone0
ACPI: Thermal Zone [THRM] (53 C)



I guess button, ac, battery, etc modules even though they say that they are apart of ACPI like in the lines above, they do not need the rc.acpid daemon to be running for them to be loaded into memory. Also, there is still a /proc/acpi directory. The ac_adapter from ac modules works perfectly fine.

I'm slowly getting a better understanding of modules, but I still want to learn more. Could you guys explain why these modules do not need the acpid daemon to be running.

Also, another thing. I've been trying to get the xfce battery plugin version 0.5.1 to work. It is rather odd, but the first time I installed it, and added the plugin to the panel, it worked. Then I rebooted and it stopped working. I've been trying to troubleshoot that as well.

I noticed that in /proc/acpi/battery/BAT1, I cat each of the three files, state, info, and alarm and each say that the battery is not present even though it really is attached to my laptop. Should I just try and look for another battery module online? I mean it worked earlier. I was thinking that maybe there's another battery module on my filesystem and that I'm using the one that is not compatible. Is there any way to see which battery module is the one listed in lsmod and /proc/modules? To clarify, let's say I had two different battery modules, yet with the same name. How can I tell, which one is the one listed in lsmod or /proc/modules. Like is there a query I can make on the module listed in lsmod or /proc/module to see where that specific module is located on the filesystem?

Thanks in advance.

Also, is there an easier way to find out which /dev my flash drive is on when I insert a flash drive to a usb? For instance, everytime I insert a flash drive I have to try all these different possilibities

mount /dev/sdb1 /mnt/sdb1
mount /dev/sdc1 /mnt/sdc1
mount /dev/sdd1 /mnt/sdd1
mount /dev/sde1 /mnt/sde1

until I find the one that matches my usb flash drive. Is there an easier way to see which /dev my flash drive is linked to?

Last edited by trist007; 03-14-2009 at 03:27 PM.
 
Old 03-16-2009, 05:13 PM   #10
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Original Poster
Rep: Reputation: 69
After several hours of research, I'm convinced that my acpi battery not present problem is a kernel related problem. I've tried a different battery, reinstalling the whole OS and still, /proc/acpi/battery/BAT1/state says that my battery is not present even though it is. I currently have kernel 2.6.27.7-smp installed. How would I go about trying an older kernel module? Could you guys give me a guide on how to try another kernel version? Or should I perhaps rebuild the kernel with apm instead of acpi(my kernel is not currently supported apm)? Maybe apm will work? What do you guys think? It's weird, I could've sworn the battery monitor plugin was working, maybe I was just imagining things hehe.

Last edited by trist007; 03-16-2009 at 05:14 PM.
 
Old 03-16-2009, 09:17 PM   #11
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,623

Rep: Reputation: Disabled
I'm no expert, but acpi <> acpid

There are two components to ACPI, the kernel part, which is delivering the messages you see on boot, (and supporting the battery and ac modules, etc.) and the daemon which listens for power events and executes appropriate actions. So disabling the daemon does not disable the kernel part. You should be able to do that by appending "acpi=off", or perhaps "noacpi", to your kernel. Of course you could always rebuild the kernel without acpi support.

Brian
 
Old 03-16-2009, 09:29 PM   #12
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Original Poster
Rep: Reputation: 69
Do you think I should try rebuilding the kernel without acpi support or should I try rebuilding the kernel with apm support instead of acpi?

Which would you try first if you encountered a problem with a missing laptop battery (even though it's physically connected) in /proc/acpi/battery/BAT1/state ?
 
Old 03-17-2009, 01:08 AM   #13
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Original Poster
Rep: Reputation: 69
W00t, I finally got it working. What I did was rebuild the kernel with better support for /sys instead of deprecated /proc/acpi. I also added support for li-ion laptop battery and toshiba modules. Well, I never thought to look in the /sys for battery info. It was probably working in the previous kernel. So this might have been all for nothing. Either way I'm glad I did it, learned so much and it was a lot easier than I thought it was going to be.

So now I can see my battery charge by

cat /sys/class/power_supply/BAT1/charge_now

However, the xfce4-battery-plugin version 0.5.1 still does not work. It always reports 50% as the charge remaining. I'm thinking that this plugin tries to contact /proc/acpi and I do know from past experience that if the battery and ac modules weren't loaded that the plugin would output 50% like it does now. I downloaded the xfce4-battery-plugin from slackbuilds. I checked out the slackbuild script to see if maybe there was a setting that would change were the plugin would get its data.

Anyhow, if there's no solution, I'm thinking about just writing a script that would cat /sys/class/power_supply/BAT1/charge_now. Is there any way that I could make my own xfce4 panel plugin that would show the output of cat /sys/class/power_supply/BAT1/charge_now?

How would I write a script for that?

Also, when I rebuild my kernel, do I have to reinstall all the packages that I installed, like plugins, wireless adapter modules, compiz, etc? When I rebuilt my kernel, in the /usr/src/linux/Makefile in the extraversion I put 1.0, so now when I build source it always says kernel-2.6.271.0, looks wierd hehe. It bugs me. Can I just recompile?

edit the Makefile, run a make xconfig, import the current config

make bzImage && make modules && make modules_install
cp the bzImage of my cpu arch to the /boot as well as the System.map

Would I then have to reinstall all the stuff I mentioned earlier? wireless adapter module, compiz, fglrx module, virtualbox, openoffice, etc?

Last edited by trist007; 03-17-2009 at 03:25 AM.
 
Old 03-18-2009, 02:40 PM   #14
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,033

Original Poster
Rep: Reputation: 69
Well guys, after rebuilding the kernel 6 times, I finally learned how it all works. At the beginning of this post I was wondering where the script that loaded up all the other modules like wireless adapter, ethernet adapter, etc. I finally understand that the kernel was loading them up automatically (the ones defined in the xconfig), or how some of the kernel had modules available (like having a dot in the circle instead of a check in xconfig).

I also finally fine tuned my laptop to use low-latency, high memory support, and a 1000 Hz timer. Everything runs significantly faster than my last kernel build. I'm fully satisfied and feel alot more confortable with linux.
 
Old 03-18-2009, 03:07 PM   #15
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Well good job, that's the way to hack it
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
understanding oss modules geletine Slackware 3 07-03-2005 05:58 PM
Kernel Modules Understanding druisgod Linux - Software 1 08-13-2004 11:17 AM
Slack9 - no PPP (can't open dependencies file /lib/modules/2.4.18/modules.dep) bluehz Slackware 1 05-04-2003 03:32 PM
Re: modprobe: Note: /etc/modules.conf is more recent than lib/modules/2.4.9/modules.d Andy.M Linux - General 1 01-24-2002 02:50 AM
Re: modprobe: Note: /etc/modules.conf is more recent than lib/modules/2.4.9/modules.d Andy.M Linux - Newbie 2 01-24-2002 02:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration