LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 12-02-2010, 09:00 AM   #1
burdi01
Member
 
Registered: Dec 2010
Location: The Netherlands
Distribution: Slackware Current64, PartedMagic, Xubuntu
Posts: 465

Rep: Reputation: 114Reputation: 114
Slackware-current: mkinitrd -c -m ahci:ext3 -k 2.6.36.1 failure


root@riposo:/boot# mkinitrd -c -m ahci:ext3 -k 2.6.36.1
OK: /lib/modules/2.6.36.1/kernel/drivers/ata/libahci.ko added.
OK: /lib/modules/2.6.36.1/kernel/drivers/ata/ahci.ko added.
OK: /lib/modules/2.6.36.1/kernel/fs/mbcache.ko added.
OK: /lib/modules/2.6.36.1/kernel/fs/jbd/jbd.ko added.
OK: /lib/modules/2.6.36.1/kernel/fs/ext3/ext3.ko added.
6355 blocks
/boot/initrd.gz created.
Be sure to run lilo again if you use it.

root@riposo:/boot# ls -R initrd-tree/lib/modules/2.6.36.1/kernel/
initrd-tree/lib/modules/2.6.36.1/kernel/:
drivers/ fs/

initrd-tree/lib/modules/2.6.36.1/kernel/drivers:
ata/

initrd-tree/lib/modules/2.6.36.1/kernel/drivers/ata:
ahci.ko libahci.ko

initrd-tree/lib/modules/2.6.36.1/kernel/fs:
ext3/ jbd/ mbcache.ko

initrd-tree/lib/modules/2.6.36.1/kernel/fs/ext3:
ext3.ko

initrd-tree/lib/modules/2.6.36.1/kernel/fs/jbd:
jbd.ko

root@riposo:/boot# cat initrd-tree/load_kernel_modules
# This is a script used to load the kernel modules.
# To use it, chmod it 755, and then add the insmod
# lines needed to load your modules, like this:

modprobe -v libahci
modprobe -v mbcache
modprobe -v jbd
modprobe -v ext3

root@riposo:/boot#

NOTE that the "modprobe -v ahci" line is missing.
 
Old 12-02-2010, 09:11 AM   #2
rfernandez
Member
 
Registered: Mar 2010
Location: Brazil
Distribution: Slackware64
Posts: 264

Rep: Reputation: 41
What is the output of "/sbin/modinfo libahci" ?
 
Old 12-02-2010, 09:16 AM   #3
burdi01
Member
 
Registered: Dec 2010
Location: The Netherlands
Distribution: Slackware Current64, PartedMagic, Xubuntu
Posts: 465

Original Poster
Rep: Reputation: 114Reputation: 114
I have a trace, but I am not allowed to upload attachments
Here is the relevant part:

+ FULL_MOD=ahci
++ echo ahci
++ cut -d ' ' -f 1
+ MODULE=ahci
+ echo ahci
+ grep ' '
+ unset ARGS
+ /sbin/modprobe --set-version 2.6.36.1 --show-depends --ignore-install ahci
+ cut -f 2 -d ' '
+ read SRCMOD
+ grep '^insmod '
++ basename /lib/modules/2.6.36.1/kernel/drivers/ata/libahci.ko .ko
+ grep -q libahci /boot/initrd-tree/load_kernel_modules
+++ basename /lib/modules/2.6.36.1/kernel/drivers/ata/libahci.ko .ko
++ echo 'modprobe -v libahci'
+ LINE='modprobe -v libahci'

++ basename /lib/modules/2.6.36.1/kernel/drivers/ata/libahci.ko .ko
+ '[' libahci = ahci ']'
+ grep -qx 'modprobe -v libahci' /boot/initrd-tree/load_kernel_modules
+ echo 'modprobe -v libahci'
+ '[' '!' -f /boot/initrd-tree/lib/modules/2.6.36.1/kernel/drivers/ata/libahci.ko ']'
+ cp -a --parents /lib/modules/2.6.36.1/kernel/drivers/ata/libahci.ko /boot/initrd-tree
+ echo 'OK: /lib/modules/2.6.36.1/kernel/drivers/ata/libahci.ko added.'
OK: /lib/modules/2.6.36.1/kernel/drivers/ata/libahci.ko added.
+ read SRCMOD
++ basename /lib/modules/2.6.36.1/kernel/drivers/ata/ahci.ko .ko
+ grep -q ahci /boot/initrd-tree/load_kernel_modules
+ grep -qx 'modprobe -v libahci' /boot/initrd-tree/load_kernel_modules
+ '[' '!' -f /boot/initrd-tree/lib/modules/2.6.36.1/kernel/drivers/ata/ahci.ko ']'
+ cp -a --parents /lib/modules/2.6.36.1/kernel/drivers/ata/ahci.ko /boot/initrd-tree
+ echo 'OK: /lib/modules/2.6.36.1/kernel/drivers/ata/ahci.ko added.'
OK: /lib/modules/2.6.36.1/kernel/drivers/ata/ahci.ko added.
+ read SRCMOD
 
Old 12-02-2010, 09:22 AM   #4
burdi01
Member
 
Registered: Dec 2010
Location: The Netherlands
Distribution: Slackware Current64, PartedMagic, Xubuntu
Posts: 465

Original Poster
Rep: Reputation: 114Reputation: 114
This the relevant part of /sbin/mkinitrd:

# Get MODULE deps and prepare modprobe lines
/sbin/modprobe --set-version $KERNEL_VERSION --show-depends --ignore-install $MODULE 2>/dev/null \
| grep "^insmod " | cut -f 2 -d ' ' | while read SRCMOD; do

if ! grep -q "$(basename $SRCMOD .ko)" $SOURCE_TREE/load_kernel_modules 2>/dev/null ; then
LINE="$(echo "modprobe -v $(basename $SRCMOD .ko)" )"


# Test to see if arguments should be passed
# Over-ride the previously defined LINE variable if so
if [ "$(basename $SRCMOD .ko)" = "$MODULE" ]; then
# SRCMOD and MODULE are same, ARGS can be passed
LINE="$LINE$ARGS"
fi

fi

if ! grep -qx "$LINE" $SOURCE_TREE/load_kernel_modules ; then
echo "$LINE" >> $SOURCE_TREE/load_kernel_modules
fi

if [ ! -f ${SOURCE_TREE}${SRCMOD} ]; then
# We did not yet copy this module into the initrd-tree
if cp -a --parents $SRCMOD $SOURCE_TREE 2>/dev/null; then
echo "OK: $SRCMOD added."
else
echo "WARNING: Could not find module \"$SRCMOD\""
fi
fi
 
Old 12-02-2010, 09:24 AM   #5
burdi01
Member
 
Registered: Dec 2010
Location: The Netherlands
Distribution: Slackware Current64, PartedMagic, Xubuntu
Posts: 465

Original Poster
Rep: Reputation: 114Reputation: 114
In other words: the grep for "ahci" succeeds when there is already an "libahci" in the load_kernel_modules file

I think the grep should be:

if ! grep -Eq " $(basename $SRCMOD .ko) | $(basename $SRCMOD .ko)$" \
$SOURCE_TREE/load_kernel_modules 2>/dev/null ; then

Last edited by burdi01; 12-02-2010 at 11:12 AM. Reason: Adding solution
 
Old 12-02-2010, 11:13 AM   #6
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,504

Rep: Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461
Maybe this would help?

-if ! grep -q "$(basename $SRCMOD .ko)" $SOURCE_TREE/load_kernel_modules 2>/dev/null ; then
+if ! grep -q "$(basename $SRCMOD)" $SOURCE_TREE/load_kernel_modules 2>/dev/null ; then
 
Old 12-02-2010, 11:22 AM   #7
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,504

Rep: Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461Reputation: 8461
That would have fixed this same bug in the insmod based previous mkinitrd... let's try this again.

-if ! grep -q "$(basename $SRCMOD .ko)" $SOURCE_TREE/load_kernel_modules 2>/dev/null ; then
+if ! grep -Ewq "$(basename $SRCMOD)" | $(basename $SRCMOD .ko) $SOURCE_TREE/load_kernel_modules 2>/dev/null ; then
 
Old 12-02-2010, 06:23 PM   #8
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
Watch out for the -w option on grep. '-' is included in the characters that make up a word boundary so it could potentially cause an incorrect match for any modules that contain one in their names (and there are quite a few).

My regex skills are a bit dubious, but I think something along the lines of the following might do the job:
Code:
grep -E "^modprobe -v $(basename $SRCMOD .ko)(\.ko)?( .*)*$"
Match lines starting with "modprobe -v "
followed by basename $SRCMOD with stripped-off .ko extension (if exists)
followed by zero or one match of ".ko" (*)
followed by zero or many matches of ( a space followed by zero or many matches of any character)
followed by end of line.

(*) I'm not sure why the zero or one match of .ko is needed as the echo into the load_kernel_modules file appears to strip it off but Pat's example above appears to be checking for both with and without a ".ko" so I kept it in.


I only looked at the code from the previous posts in this thread. Didn't go digging inside mkinitrd so it's quite possible I've missed something. So no warranty on this one.

Last edited by GazL; 12-02-2010 at 06:38 PM. Reason: spelling
 
Old 12-02-2010, 11:18 PM   #9
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
Quote:
Originally Posted by volkerdi View Post
That would have fixed this same bug in the insmod based previous mkinitrd...
I sit here wondering if you know just how relieved I was to read that ;-)
 
Old 12-27-2010, 02:21 PM   #10
burdi01
Member
 
Registered: Dec 2010
Location: The Netherlands
Distribution: Slackware Current64, PartedMagic, Xubuntu
Posts: 465

Original Poster
Rep: Reputation: 114Reputation: 114
On Fri Dec 24, 2010 mkinitrd-1.4.6-i486-2.txz was released.
The "-m ahci:ext3" problem this thread is about was not addressed however.

Last edited by burdi01; 12-27-2010 at 02:22 PM.
 
Old 12-28-2010, 02:22 PM   #11
burdi01
Member
 
Registered: Dec 2010
Location: The Netherlands
Distribution: Slackware Current64, PartedMagic, Xubuntu
Posts: 465

Original Poster
Rep: Reputation: 114Reputation: 114
Taking Patrick's and GazL's remarks into account I found that the following statement comes closest to Patrick's (deliberately ?) non-foolproof (what about an ugly module named "modprobe", "insmod" etc. or an "unlucky comment?) solution:

567c567
< if ! grep -q "$(basename $SRCMOD .ko)" $SOURCE_TREE/load_kernel_modules 2>/dev/null ; then
---
> if ! grep -Eq " $(basename $SRCMOD .ko)(\.| |$)" $SOURCE_TREE/load_kernel_modules 2>/dev/null ; then


Last edited by burdi01; 12-28-2010 at 02:27 PM.
 
  


Reply



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
script error in mkinitrd with -current bonaire Slackware 7 05-09-2010 06:23 AM
Slackware-current and mkinitrd-1.3.2 prontxo Slackware 4 04-11-2008 11:18 AM
Slackware-current and mkinitrd-1.3.1 prontxo Slackware 8 03-30-2008 06:43 AM
mkinitrd script with slackware deb75 Slackware 1 04-20-2004 10:56 AM

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

All times are GMT -5. The time now is 06:12 AM.

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
Open Source Consulting | Domain Registration