View previous topic :: View next topic |
Author |
Message |
Daniel_2 n00b
Joined: 11 Sep 2004 Posts: 55
|
Posted: Thu Jan 20, 2005 6:33 am Post subject: /etc/init.d/modules fails to start |
|
|
* wasn't sure about the forum, hope this one is correct.
When I boot It says in the init process that it couldn't start /etc/init.d/modules:
Code: |
/var/lib/init.d/modules-3881: line 90: syntax error near unexpected token `fi'
/var/lib/init.d/modules-3881: line 90: ` fi'
* ERROR: "/etc/init.d/modules" has syntax errors in it; not executing...
|
and I think this is why I get many other problems such x complaining about failing to initialize nvidia, sound module not found, etc...
what's the problem with my modules script? |
|
Back to top |
|
|
norb n00b
Joined: 22 Feb 2003 Posts: 28 Location: Cambridge, UK
|
Posted: Thu Jan 20, 2005 10:14 am Post subject: |
|
|
Sounds like that would cause those problems.
Can you post the file so we can have a look at it?
Cheers,
-Nige |
|
Back to top |
|
|
Daniel_2 n00b
Joined: 11 Sep 2004 Posts: 55
|
|
Back to top |
|
|
norb n00b
Joined: 22 Feb 2003 Posts: 28 Location: Cambridge, UK
|
Posted: Thu Jan 20, 2005 10:35 am Post subject: |
|
|
Sorry. What I meant was, could you cut and paste your /etc/init.d/modules script into the forum so we can see it?
In a shell do:
Code: | cat /etc/init.d/modules
|
then cut and paste into a reply.
If you can't cut and paste (if you are not in X for instance), you could include a link to the file as you did with the kernel log.
Cheers,
-Nige |
|
Back to top |
|
|
Daniel_2 n00b
Joined: 11 Sep 2004 Posts: 55
|
Posted: Thu Jan 20, 2005 10:51 am Post subject: |
|
|
Code: | #!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-src/rc-scripts/init.d/modules,v 1.32 2004/10/19 04:20:27 vapier Exp $
depend() {
need checkroot hostname
use isapnp
}
load_modules() {
local x=
local i=0
local retval=0
local modules=
local modargs=
local modcount=0
local config="$1"
[ -z "${config}" ] && return 0
[ ! -r "${config}" ] && return 0
# Loop over every line in $config
eval $(awk '
BEGIN {
COUNT = 0 # Make sure COUNT is set
}
$0 !~ /(^[[:space:]]*(#|$))/ {
if (MODULES == "")
MODULES = $1
else
MODULES = MODULES " " $1
# Not the greatest method to remove $1 from $0, but it works
sub(/^[[:space:]]*[^[:space:]]*[[:space:]]*/, "")
ARGS[COUNT] = $0
COUNT++
}
END {
# 'eval' will make sure these are set to proper bash variables
print "modcount=" COUNT
print "modules=\"" MODULES "\""
for (x = 0;x < COUNT;x++)
print "modargs[" x "]=\"" ARGS[x] "\""
}
' "${config}")
if [ "${modcount}" -gt 0 ]
then
einfo "Using ${config} as config:"
for x in ${modules}
do
ebegin " Loading module ${x}"
modprobe -q ${x} ${modargs[${i}]} &>/dev/null
retval=$?
eend ${retval} " Failed to load ${x}"
i=$((i+1))
[ "${retval}" -eq 0 ] || modcount=$((modcount-1))
done
einfo "Autoloaded ${modcount} module(s)"
fi
return 0
}
start() {
# Should not fail if kernel do not have module
# support compiled in ...
[ -f /proc/modules ] || return 0
# Here we should fail, as a modular kernel do need
# depmod command ...
if [ ! -x /sbin/depmod ]
then
eerror "ERROR: system is missing /sbin/depmod !"
return 1
fi
if [ -z "${CDBOOT}" ] && touch /etc/modules.conf 2> /dev/null
then
# ebegin "Calculating module dependencies"
# /sbin/modules-update &>/dev/null
# eend $? "Failed to calculate module dependencies"
fi
if [ -f /etc/modules.autoload -a ! -L /etc/modules.autoload ]
then
# Loop over every line in /etc/modules.autoload.
load_modules /etc/modules.autoload
else
local KV="$(uname -r)"
local KV_MAJOR="`KV_major "${KV}"`"
local KV_MINOR="`KV_minor "${KV}"`"
# New support for /etc/modules.autoload/kernel-$KV
if [ "$(get_KV)" -ge "$(KV_to_int '2.5.48')" ] && \
[ -f /etc/modules.autoload.d/kernel-"${KV_MAJOR}.${KV_MINOR}" ]
then
load_modules /etc/modules.autoload.d/kernel-"${KV_MAJOR}.${KV_MINOR}"
elif [ ! -f /etc/modules.autoload.d/kernel-"${KV_MAJOR}.${KV_MINOR}" ]
then
ewarn "Missing /etc/modules.autoload.d/kernel-${KV_MAJOR}.${KV_MINOR}"
load_modules /etc/modules.autoload.d/kernel-2.4
else
load_modules /etc/modules.autoload.d/kernel-2.4
fi
fi
#
# Just in case a sysadmin prefers generic symbolic links in
# /lib/modules/boot for boot time modules we will load these modules
#
if [ -n "$(modprobe -l -t boot)" ]
then
modprobe -a -t boot \* &>/dev/null
fi
}
# vim:ts=4
|
|
|
Back to top |
|
|
norb n00b
Joined: 22 Feb 2003 Posts: 28 Location: Cambridge, UK
|
Posted: Thu Jan 20, 2005 11:14 am Post subject: |
|
|
I think the problem is that commented out section ( lines 86 - 88 ), basically you cannot have an if statement which doesn't do anything inside the then .. fi (or where relevant the else .. fi section).
A possible solution is to have some statement which does nothing useful inside the if block along with the comments. eg:
Code: | if [ -z "${CDBOOT}" ] && touch /etc/modules.conf 2> /dev/null
then
true
# ebegin "Calculating module dependencies"
# /sbin/modules-update &>/dev/null
# eend $? "Failed to calculate module dependencies"
fi
|
Another option is to comment out the entire block ( lines 84 - 89 ) but this won't have the side effect of touching /etc/modules.conf if the first bit of the if would have evaluated to true.
Alternatively, you might consider uncommenting those lines instead (I'd advocate this option unless you have a good reason for commenting out those lines).
Hope this helps,
-Nige |
|
Back to top |
|
|
Daniel_2 n00b
Joined: 11 Sep 2004 Posts: 55
|
Posted: Thu Jan 20, 2005 11:52 am Post subject: |
|
|
thanks much, i added a line says true and it worked |
|
Back to top |
|
|
norb n00b
Joined: 22 Feb 2003 Posts: 28 Location: Cambridge, UK
|
Posted: Thu Jan 20, 2005 12:51 pm Post subject: |
|
|
Cool. Glad that sorted it out.
It turns out that a colon is the no-op command in bash so I should have suggested that instead of 'true':
Code: | if [ -z "${CDBOOT}" ] && touch /etc/modules.conf 2> /dev/null
then
:
# ebegin "Calculating module dependencies"
# /sbin/modules-update &>/dev/null
# eend $? "Failed to calculate module dependencies"
fi |
It won't really make any difference but is probably better style so I thought I should mention it.
Cheers,
-Nige |
|
Back to top |
|
|
|