empty runlevels overide LSB defaults

General programming chat and advice for beginners

4 posts
by saniel » Fri Feb 22, 2013 10:58 pm
I have learned a lot trying to figure this out, but I cannot seem to come to a solution. I am writing my first bash script via init.d and updaterc.d in order to boot a python file on startup.

Code: Select all
## BEGIN INIT INFO
# Provides: superHouse
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
#Default-Stop: 0 1 6
### END INIT INFO

#! /bin/sh
# /etc/init.d/superhouse

case "$1" in
   start)
       sudo python /home/pi/superHouse.py
       echo "Superhouse Started"
   ;;
   stop)
       echo "Power Down"
       exit 1
   ;;
   *)
        echo "Power Down"
        exit 1
   ;;
esac
exit 0


I changed permissions of the file
Code: Select all
sudo chmod 755 superhouse


ran updaterc.d
Code: Select all
sudo updaterc.d superhouse defaults


I had a bunch of errors that I got rid of by removing all of the spaces and indentation in the script (Why?)

The only error that I have left is :
Code: Select all
insserv: warning: current start runlevel(s) (empty) of script 'superhouse' overrides LSB defaults (2 3 4 5).


Upon doing some poking around, I found that there are no start up scripts in any of the rcx.d folders. There are some kill files though. That being said, the "Power Down" message is shown on reboot and shutdown. But the "Superhouse Started" is not printed on startup, nor is the script, superhouse.py, executed.

Thanks in advance for your help
Posts: 3
Joined: Sun Feb 17, 2013 10:30 pm
by saniel » Sat Feb 23, 2013 4:03 pm
Code: Select all
updaterc.d -f superhouse remove

updaterc.d superhouse defaults

Posts: 3
Joined: Sun Feb 17, 2013 10:30 pm
by lunakid » Sun Feb 24, 2013 10:22 pm
Not sure how much it helps, but the Debian LSB Init doc. (http://wiki.debian.org/LSBInitScripts) says the header should look precisely like it is described there, so the first line should also start with 3 #s, and the Default-Stop should have a space after the #:

Code: Select all
### BEGIN INIT INFO
# Provides: superHouse
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO


As to why the kill link is still there, and what's wrong with update-rc.d... I wish I knew... (These giant monster gaps between apparent program logic, common sense and counter-intuitive error messages with the evil support of (more often than not) outdated/irrelevant Linux docs don't always help. ;) In this case, the Debian page is great, but the insserv error seems to be totally pointless & contradicting the actual facts, and Googling it did not help either.)
Posts: 1
Joined: Sun Feb 24, 2013 9:26 pm
by jackokring » Sun Feb 24, 2013 11:52 pm
./Default-Stop would have been a nice command to accidentally write. This is a good reason for the hard $#<space>Default- search expression. I wonder if conf35 would be a better package name?

I think the configuration script scans and places symbolic links to all the possible scripts, with a stop or start first parameter passed when entering or leaving a runlevel. Strange because it really could be a leave as is or start/stop. And why would you not restart instead of switch runlevels? It could be said though that restart is stop followed by start, and services should be fault tolerant. That is to say die without reason and make a best of it start. Churning the occasional restart may actually be good for a system, in the binary cosmic ray sense.

symlink mingetty to a script to run the xserver (not via init 5), and use the runlevels to churn services, for eventually understanding of a need to start rc.local from X.
Pi=B256R0USB CL4SD8GB Raspbian Stock. https://sites.google.com/site/rubikcompression/strictly-long https://dl.dropboxusercontent.com/u/1615413/Own%20Work/Leptronics.pdf https://groups.google.com/forum/#!topic/comp.compression/t22ct_BKi9w
User avatar
Posts: 773
Joined: Tue Jul 31, 2012 8:27 am
Location: London, UK