LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 10-27-2006, 03:28 PM   #1
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Possible Bug in 11.0 rc.S Script?


In my testing of 11.0 I have run into issues with hotplug that I never experienced before with Slackware. I think I have discovered the cause of my problems and I think the problem is a bug in the rc.S script. I would appreciate some of you more knowledgeable Slackers responding.

Background: I always have run the 2.4 kernel and never have tried or tested the 2.6 kernel. I use old hardware and although I have two 1.1 USB ports on my boxes, I do not use any USB devices. Even my mice and keyboard are PS2 or AT. Thus, I never had any need for hotplug and I always have disabled the rc.hotplug script (not executable). I experienced no issues or problems with this configuration until updating to 11.0. Since then dhcpcd has driven me nuts. I discovered that the only way to stop the nonsense was to pass the nohotplug parameter to the kernel at boot-up. This work-around sufficed but bothered me. What changed from 10.2 to 11.0?

I believe the problem is the rc.S script. Many of you are running 2.6 kernels and as written the script's hotplug test will not affect you. Similarly, of the remaining Slackers running 2.4, I suspect many have rc.hotplug enabled (executable). And again, the new 11.0 rc.S script will not affect you. I imagine only a few Slackers are like me who simply do not run hotplug and never have. Therefore I think this new bug passed unnoticed by just about everybody. But us folks running 2.4 who previously always ignored hotplug experience the 11.0 rc.S differently.

Unlike the 10.2 script, the 11.0 rc.S script uses a kernel version test in deciding whether to run hotplug. In 10.2, if rc.hotplug was not executable then that was the final test and the rc.S script disabled hotplug. But in the 11.0 rc.S, the script now additionally checks the kernel version before deciding what to do with a non-executable rc.hotplug. Based upon the comments embedded within the hotplug section of the 11.0 rc.S script, I believe the intent is that with 2.4 kernels, hotplug should be disabled if rc.hotplug is not executable but the executable status of rc.hotplug should be ignored with 2.6 kernels. Yet the script test does not honor the executable status of rc.hotplug with 2.4 kernels because of a single ! negation parameter.

The stock 11.0 rc.S hotplug test looks this:

Code:
if [ -w /proc/sys/kernel/hotplug ]; then
  # Kernel command line option 'nohotplug' given, so we will shut off
  # hotplugging even if it is not a good idea. Sometimes it *is* a
  # good idea, especially when you're trying to figure out which
  # kernel module is crashing the machine and needs to be added to
  # your /etc/modprobe.d/blacklist (2.6+ kernels) and/or your
  # /etc/hotplug/blacklist (2.4.x kernels).
  if grep -wq nohotplug /proc/cmdline ; then
    echo "/dev/null" > /proc/sys/kernel/hotplug
  elif [ ! -x /etc/rc.d/rc.hotplug ]; then
    # Ignore /etc/rc.d/rc.hotplug on kernels newer than 2.4.x:
    if [ ! "$(uname -r | cut -f 1,2 -d .)" = "2.4" ]; then
      # We must be running a 2.4.x kernel, so turn off hotplug:
      echo "/dev/null" > /proc/sys/kernel/hotplug
    fi
  fi
fi
That uname -r test with the ! negation is the problem. The ! negation should not be there. By removing that negation parameter the script now runs correctly on my box and honors the executable condition of my rc.hotplug.

With this modification I also no longer have to pass the nohotplug parameter to the kernel at boot-up and dhcpcd now behaves itself.

Comments please and should PV be notified?

P.S. I'm not interested in discussions about the philosophy of hotplug, etc. I just want to fix this awful problem with hotplug and dhcpcd, which I believe is caused by the rc.S script. Thanks.
 
Old 10-27-2006, 05:19 PM   #2
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
I'm kind of sorry for being loaded with Trappist beer at the moment, but I think Woodsman you've found a bug in rc.S.
You can email your story to volkerdi at slackware dot com - sure, don't hesitate.

Eric
 
Old 10-27-2006, 05:31 PM   #3
Franklin
Senior Member
 
Registered: Oct 2002
Distribution: Slackware
Posts: 1,348

Rep: Reputation: 217Reputation: 217Reputation: 217
Quote:
Originally Posted by Alien Bob
I'm kind of sorry for being loaded with Trappist beer at the moment.

<snip>

Eric
Never apologize for good taste.
 
Old 10-28-2006, 02:13 AM   #4
danieldk
Member
 
Registered: Aug 2002
Posts: 150

Rep: Reputation: 15
This check

Code:
if [ ! "$(uname -r | cut -f 1,2 -d .)" = "2.4" ]; then
# We must be running a 2.4.x kernel, so turn off hotplug:
  echo "/dev/null" > /proc/sys/kernel/hotplug
fi
is OK, because the condition is true on 2.6 kernels, and it will echo /dev/null to /proc/sys/kernel/hotplug. Removing the exclamation mark may solve your problem, but will skip echo-ing null to that file on 2.6 kernels, which is wrong.

From my quick view it seems that another condition needs to be added that checks the executable permissions on rc.hotplug. Something like:

Code:
if [ (! "$(uname -r | cut -f 1,2 -d .)" = "2.4") || (! -x /etc/rc.d/rc.hotplug) ]; then
# We must be running a 2.4.x kernel, so turn off hotplug:
  echo "/dev/null" > /proc/sys/kernel/hotplug
fi
This makes more sense, because it will empty /proc/sys/kernel/hotplug when you have 1. a 2.6 kernel, or 2. no executable bit set for rc.hotplug.
 
Old 10-28-2006, 02:26 AM   #5
acummings
Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 615

Rep: Reputation: 50
You said "updated to 11."

In so doing, did you do anything to bring rc.hotplug.new

It's a long shot and I don't know that much about it.

But I went on the www to the Slackware-current changelog. And in my web browser I searched for rc.hotplug which turned up 5 hits.

--
Alan.
 
Old 10-28-2006, 10:37 AM   #6
stabu
Member
 
Registered: Mar 2004
Location: dublin IRL
Distribution: Slackv12.1, Slamd64v12.1,Xubuntu v8.10_64, FC8_64
Posts: 438
Blog Entries: 5

Rep: Reputation: 32
Quote:
I discovered that the only way to stop the nonsense was to pass the nohotplug parameter to the kernel at boot-up. This work-around sufficed but bothered me. What changed from 10.2 to 11.0?
It would appear to be a change in policy, i.e.
Code:
# Kernel command line option 'nohotplug' given, so we will shut off
# hotplugging even if it is not a good idea. Sometimes it *is* a
# good idea
It may be bothering because kernel command line options do seem a bit brute-force-ish, but are they really? The way they are global in their scope maybe. Anyhow, PV is pretty close to condoning them here.

It's more or less the comment that has me:
Code:
# We must be running a 2.4.x kernel, so turn off hotplug:
Because the ifstatement tests for the absence of a 2.4, so it would read better if it said "We must be running a 2.6.X kernel ...". That is, IF the comment is directly related to the ifstatement above it. It's a nested "if", so it may not be.

Earlier on in the nested if, the exectuability of rc.hotplug is already tested for, so this line would not have been reached if that script was executable: it seems superfluous to test it a second time.

Overall, it seems to me that this part of the rc.S is really only concerned about the hotplug and 2.6 kernel. Woodsman's requirement to not run it while on a 2.4 kernel would appear to be a special requirement, not a general one, so it may have no place in a conformist, admittedly new, rc.S. I also ran hotplug for ages while on 2.4., though I also dropped it later.
 
Old 10-29-2006, 05:32 AM   #7
danieldk
Member
 
Registered: Aug 2002
Posts: 150

Rep: Reputation: 15
Yeah, sorry, I didn't really read anything else than the context. The whole check seems a bit strange to me, because it seems to me that you'll always want to erase the value of /proc/sys/kernel/hotplug if rc.hotplug is not executable, or when it is executable, still erase it when running a 2.6 kernel. So, something like this seems more logical to me:

Code:
if [ -w /proc/sys/kernel/hotplug ]; then
  # Kernel command line option 'nohotplug' given, so we will shut off
  # hotplugging even if it is not a good idea.  Sometimes it *is* a
  # good idea, especially when you're trying to figure out which
  # kernel module is crashing the machine and needs to be added to
  # your /etc/modprobe.d/blacklist (2.6+ kernels) and/or your
  # /etc/hotplug/blacklist (2.4.x kernels).
  if grep -wq nohotplug /proc/cmdline ; then
    echo "/dev/null" > /proc/sys/kernel/hotplug
  elif [ (! -x /etc/rc.d/rc.hotplug) || (! "$(uname -r | cut -f 1,2 -d .)" = "2.4")]; then
    echo "/dev/null" > /proc/sys/kernel/hotplug
  fi
fi
Of course this may be incorrect. I don't have Slack 11 on any machine, so I haven't looked how hotplug/udev works in 11.
 
  


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
network init script bug? ardya Slackware 8 05-11-2006 01:08 AM
It's a bug. But whose? jiml8 Linux - Software 9 04-18-2006 01:57 PM
An old bug.... setlec_seta Mandriva 2 05-19-2005 10:57 PM
Free86 bug or nVidia bug?? ProtoformX Linux - Software 2 05-12-2004 02:38 AM
help with bug in script joesbox Programming 7 09-26-2003 06:02 PM

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

All times are GMT -5. The time now is 04:23 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
Open Source Consulting | Domain Registration