LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 01-25-2005, 11:34 AM   #1
systemparadox
Member
 
Registered: Jul 2004
Location: Tavistock, Devon, England
Distribution: Slackware 9.1, Mandrake 9.0/9.1/10.0, LFS 6.0, Knoppix 3.1/3.3
Posts: 73

Rep: Reputation: 15
Unhappy Startup scripts not bothering to execute...


I have Slackware 9.1 installed on two machines: my laptop, which has had heavy use and much software added. It now runs linux kernel 2.6.8.1. The startup scripts have not been significantly altered- YET (when I get round to it I'm gonna clean them all up so it does exactly what i want and nothing else).
I also have a server running a reasonably fresh install of 9.1, i haven't got round to upgrading the kernel yet (so it's still running 2.4.22), and apart from some config files not much has changed.

I am having similar problems on both machines- some of the scripts/services just don't bother to start/run. On the server, it's currently sshd- every few boots (the server has to go down every night at the moment) I find that sshd hasn't started. Currently i have a monitor and keyboard attached, but I will soon be moving it into a cupboard so there will be no local access. As you can imagine, sshd failing to start will be even more annoying in this situation. That's all the info I have- it just doesn't bother starting. If I login locally as root and type 'sshd' it starts fine- no messages at all. The only modifications done to the startup scripts have been to add the following to rc.local:
rm /etc/dhcpc/dhcpcd-eth2.pid
dhcpcd eth2
/root/firewall/iptables.server natonly

this all executes fine.
The rc.sshd file is the default installed with slack 9.1:
Code:
#!/bin/sh
# Start/stop/restart the secure shell server:

sshd_start() {
  # Create host keys if needed.
  if [ ! -r /etc/ssh/ssh_host_key ]; then
    /usr/bin/ssh-keygen -t rsa1 -f /etc/ssh/ssh_host_key -N ''
  fi
  if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then
    /usr/bin/ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
  fi
  if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
    /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
  fi
  /usr/sbin/sshd
}

sshd_stop() {
  killall sshd
}

sshd_restart() {
  if [ -r /var/run/sshd.pid ]; then
    echo "WARNING: killing listener process only.  To kill every sshd process, you must"
    echo "         use 'rc.sshd stop'.  'rc.sshd restart' kills only the parent sshd to"
    echo "         allow an admin logged in through sshd to use 'rc.sshd restart' without"
    echo "         being cut off.  If sshd has been upgraded, new connections will now"
    echo "         use the new version, which should be a safe enough approach."
    kill `cat /var/run/sshd.pid`
  else
    killall sshd
  fi
  sleep 1
  sshd_start
}

case "$1" in
'start')
  sshd_start
  ;;
'stop')
  sshd_stop
  ;;
'restart')
  sshd_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac
On my laptop I have added the following commands to rc.local, but it doesn't bother with any of them:
Code:
echo "Attempting to mount 'm'..."
/sbin/mount /mnt/m
echo Done
echo "Setting up WiFi for Z..."
/etc/rc.d/rc.zwifi start
echo "Adding default route..."
route add default gw 192.168.38.1
I have created my own rc.irda script, this executes fine (i have even added some of the other commands to it so that they get executed! and yes, they work fine here so it's not init rejecting the commands or anything):
Code:
#!/bin/sh
#
# irda
#

IRTTY=/dev/ttyS1
IRDEV=/dev/irnet
PCIP=192.168.40.1
ZIP=192.168.40.2
PPPPARAMS="passive noauth local"

[ -f /usr/sbin/irattach ] || exit 0

case "$1" in
  start)
        echo -n "Starting IrDA... "
        /usr/sbin/irattach $IRTTY -s
        touch /var/lock/subsys/irda
        echo -n "Done"
        echo
        echo -n "Listening for Zaurus... "
        /usr/sbin/pppd $IRDEV $PCIP:$ZIP $PPPPARAMS
        echo -n "Ready"
        echo
        echo "Starting Z WiFi..."
        /etc/rc.d/rc.zwifi start
        ;;
  stop)
        echo -n "Stopping Zaurus Connection... "
        killall -9 pppd
        echo -n "Done"
        echo
        echo -n "Shutting down IrDA... "
        killall irattach
        rm -f /var/lock/subsys/irda
        echo -n "Done"
        echo
        ;;
  restart)
        $0 stop
        $0 start
        ;;
  *)
        echo "Usage: irda {start|stop|restart}"
        exit 1
        ;;
esac

exit 0
This is another custom script, but I didn't hear anything from it until I told the rc.irda script to execute it:
Code:
#!/bin/sh

function wifion()
{
ifconfig wlan0 192.168.40.1
iwconfig wlan0 essid "TPT20"
iwconfig wlan0 mode Ad-Hoc
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 192.168.40.0/24 -d 192.168.38.0/24 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 192.168.40.0/24 -d ! 192.168.40.0/24 -j MASQUERADE
echo "WiFi setup for Zaurus."
}

case "$1" in
  start)
        wifion
        ;;
  stop)
        ;;
  restart)
        ;;
  *)
        echo "Usage: start|stop|restart"
        exit 1
        ;;
esac

exit 0
I have checked that all the above scripts are executable, and I have added bits in rc.M so that the custom scripts get executed (it worked for one anyway). I really can't figure out what's going on here.

Thanks in advance
Simon
 
Old 01-25-2005, 01:11 PM   #2
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 48
if [ ! -r /etc/ssh/ssh_host_key ]; then

The other tests in sshd_start or to see if their not regular files but I've looked up -r and that checks for read permission which is strange.

Have you tried just running the script directly to see what it outputs?

rc.sshd start

Last edited by leonscape; 01-25-2005 at 01:14 PM.
 
Old 01-26-2005, 10:13 AM   #3
systemparadox
Member
 
Registered: Jul 2004
Location: Tavistock, Devon, England
Distribution: Slackware 9.1, Mandrake 9.0/9.1/10.0, LFS 6.0, Knoppix 3.1/3.3
Posts: 73

Original Poster
Rep: Reputation: 15
Quote:
if [ ! -r /etc/ssh/ssh_host_key ]; then

The other tests in sshd_start or to see if their not regular files but I've looked up -r and that checks for read permission which is strange.

Have you tried just running the script directly to see what it outputs?
The script ALWAYS executes '/usr/sbin/sshd' when called with 'start'. Running sshd starts it fine with no messages, running '/etc/rc.d/rc.sshd start' gave a segmentation fault once (HELP! read below), then ran fine every time afterwards.

I think I may have found a major problem- on startup, and when run manually /etc/rc.d/rc.M segfaults!!! It doesn't do this on every boot, but it once it does it it seems to keep doing it. Here is the last 'few' lines of dmesg. I notice that there are messages from other services scattered in between the stack dumps and segfaults...

Code:
Unable to handle kernel paging request at virtual address 08302466
 printing eip:
c01217a6
*pde = 01105067
*pte = 00000000
Oops: 0000
CPU:    0
EIP:    0010:[<c01217a6>]    Not tainted
EFLAGS: 00010206
eax: bffff670   ebx: ffffffea   ecx: bffff66f   edx: 00000018
esi: 00000002   edi: 00000000   ebp: c1113fa8   esp: c1113f90
ds: 0018   es: 0018   ss: 0018
Process rc.M (pid: 41, stackpage=c1113000)
Stack: c1113f94 c1113fa8 bffff670 00000008 00000000 00000000 c1112000 ffff0007
       c1112000 00000008 00000002 bffff658 c0108f13 00000002 bffff670 00000000
       00000008 00000002 bffff658 000000af 0000002b 0000002b 000000af 4004ba3e
Call Trace:    [<c0108f13>]

Code: 10 83 7c 24 30 08 8b 74 24 24 8b 44 24 28 8b 7c 24 2c bb ea
 <6>usb.c: registered new driver usbdevfs
usb.c: registered new driver hub
uhci.c: USB Universal Host Controller Interface driver v1.1
usb-uhci.c: $Revision: 1.275 $ time 18:40:47 Sep  2 2003
usb-uhci.c: High bandwidth mode enabled
usb-uhci.c: v1.275:USB Universal Host Controller Interface driver
invalid operand: 0000
CPU:    0
EIP:    0010:[<c01217e4>]    Not tainted
EFLAGS: 00010287
eax: bfffede0   ebx: ffffffea   ecx: bfffede0   edx: 00000018
esi: 00000002   edi: 00000000   ebp: c28abfa8   esp: c28abf94
ds: 0018   es: 0018   ss: 0018
Process rc.M (pid: 393, stackpage=c28ab000)
Stack: c28abfa8 bfffede0 00000008 00010000 00000000 c28aa000 ffff0007 c28aa000
       00000008 00000002 bfffedc8 c0108f13 00000002 bfffede0 00000000 00000008
       00000002 bfffedc8 000000af 0000002b 0000002b 000000af 4004ba3e 00000023
Call Trace:    [<c0108f13>]

Code: 00 83 c4 0c 85 c0 bb f2 ff ff ff 75 ce 81 64 24 08 ff fe fb
 ip_tables: (C) 2000-2002 Netfilter core team
ip_conntrack version 2.1 (384 buckets, 3072 max) - 292 bytes per conntrack
eth2: Setting 100mbps full-duplex based on auto-negotiated partner ability 41e1.
Unable to handle kernel paging request at virtual address acc10816
 printing eip:
c0121e30
*pde = 00000000
Oops: 0000
CPU:    0
EIP:    0010:[<c0121e30>]    Not tainted
EFLAGS: 00010202
eax: 080765e0   ebx: 00000011   ecx: 00000000   edx: c27cc6f4
esi: c2439fa4   edi: c27cc6f8   ebp: c2439f70   esp: c2439f54
ds: 0018   es: 0018   ss: 0018
Process rc.sshd (pid: 517, stackpage=c2439000)
Stack: c2439f90 bffff690 bffff600 c0122185 00000011 c2439f90 c2439f70 00000000
       04000000 4004b988 00000000 00000000 c2dc4480 c2dc4478 c1181790 080765e0
       04000000 4004b988 00000000 00000000 00001000 c2438000 00000004 c2438000
Call Trace:    [<c0122185>] [<c0108f13>]

Code: 31 c0 5b 5e 5f c3 8d 76 00 8d bc 27 00 00 00 00 fa be 00 e0
Ok, after copying the above message I tried running rc.M manually again, and it worked fine, until it got down to starting samba (i don't think it's a problem with samba- especially after the many errors on boot and the rc.sshd segfault), then the ssh client locked up and I went to the server to find it saying:
Code:
 <0>Kernal panic: Aiee, killing interrupt handler!
In interrupt handler - not syncing
After a hard reset it proceeded to load all services and scripts with no errors.

What is going on?

Also, I still haven't the faintest why my laptop isn't bothering to execute rc.local and rc.zwifi.

Thanks for the help
Simon

Last edited by systemparadox; 01-26-2005 at 10:15 AM.
 
Old 01-26-2005, 12:56 PM   #4
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 48
I think you may have some deeper problems. The other messages don't appear to be from services, there kernel modules/drivers. Maybe you have a bad driver, or some device is going bad on you? Maybe that's why sshd is failing to start?
 
  


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
execute shell-scripts at kde startup supersucker Linux - Newbie 10 10-28-2005 10:47 AM
how to execute bash scripts from C????? :( cho Programming 2 06-19-2005 07:15 PM
Execute Shell Scripts on startup dragoroberto Linux - Software 9 02-28-2005 08:46 AM
cant execute any scripts Phonics3k Linux - Newbie 2 06-19-2002 08:00 AM
Can't execute *.cgi scripts. BrianG Linux - General 1 04-11-2001 03:38 AM

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

All times are GMT -5. The time now is 02:04 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