LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-05-2010, 06:06 PM   #16
Slax-Dude
Member
 
Registered: Mar 2006
Location: Valadares, Portugal
Distribution: Slackware
Posts: 255

Rep: Reputation: 72

Quote:
Originally Posted by Ivshti View Post
I appreciate what you have done, great job.

However, I think initng will be much better idea for moving into the future. I've prepared packages for Slackware (I think I mentioned it somewhere in the forum, PM me if interested), and my machine boots for 30 seconds to desktop with them. Awesome stuff.
I don't think Pat will like it thought. He doesn't look very open-minded.
Your scripts are much more likely to get into Slackware
I would like to try those. Can you share the packages?
 
Old 10-19-2010, 03:58 AM   #17
sahko
Senior Member
 
Registered: Sep 2008
Distribution: Slackware
Posts: 1,041

Rep: Reputation: Disabled
GrapefruiTgirl: did you send the scripts to Pat by any chance?
 
Old 10-19-2010, 05:05 AM   #18
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Original Poster
Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
sahko, funny you should ask at this moment.

For the last few days I have been griping to myself about how I'm going to have to go through all the latest Slack init-scripts again soon, see what's new and patch up my custom ones.

No, I never did send them, or the idea of them, to Pat. I never felt that there was enough of an impact caused by them for them to be something that Pat would consider. -- though the POSIX-compliance-ness of them should be of interest to him perhaps?

I wonder.. tuxdev also came up with a package of scripts too - I wonder if he forwarded the idea to Pat?

Anyhow, if there's interest from the community, and after I go over the scripts again and fix up the latest sysvinit-scripts package in my --current64, perhaps I will send the thing along to Pat and see if there's any interest. I should however set them up for #!/bin/ash rather than #!/bin/dash for obvious reasons (never say "for obvious reasons", right? )
 
Old 10-19-2010, 12:50 PM   #19
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,758

Rep: Reputation: 469Reputation: 469Reputation: 469Reputation: 469Reputation: 469
Sasha, I combined your scripts with some of tuxdev's and modified some others. By using them with dash, I was able to get a boot-time of about 7 seconds on a 2.0GHz Pentium 4 machine -normal boot time was around 25-30 seconds on the same machine.
I tried to create a complete set of scripts which get called directly from the existing init routines and not worry about the init 'fragments' which are included with individual packages -letting them use the normal 'bash as sh' code.
I used a 'dedicated' shebang (#!/bin/dash) instead of substituting dash for bash as the main /bin/sh shell. It turns out that using a shebang which points to a link also slows things down. In other words, just using #!/bin/bash instead of #!/bin/sh with the standard scripts would speed things up some...
 
Old 10-19-2010, 05:35 PM   #20
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Original Poster
Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
gnashley,

thanks for the feedback and interesting statistics about speed. You've achieved a significant boot-time increase for sure. Mine doesn't boot nearly that fast at the moment, more like about a minute or so till login at init 3.

I'm currently revisiting this whole scenario beginning with the latest sysvinit-scripts-32 package that came into -current the other day.

I also tried for the heck of it, since I mentioned it earlier, using /bin/ash as the boot shell. Don't try it. It doesn't work-- I thought Dash was strict but Ash is worse -- or maybe it's just plain incapable of doing anything the least bit complicated. My machine wouldn't boot with a #!/bin/ash in rc.M, had to reboot into /bin/bash to fix it.

Finally: I'm curious if anyone has had any issues with lines which source other scripts with arguments, and how you worked around them. Like for example:
Code:
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then
    . /etc/rc.d/rc.syslog start
fi
In Ash for sure, the argument doesn't get passed to the sourced script. The workaround I used for Ash is:
Code:
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then
  func_syslog () {
    . /etc/rc.d/rc.syslog
  }
  func_syslog start
fi
gnashley: I'd be interested to have a look through the script collection you're currently using on the machine you describe above in post #19-- have you got them all in a tarball that you can email me, or would you provide or send a link where I could download them?

Thanks!
 
Old 10-19-2010, 11:43 PM   #21
lumak
Member
 
Registered: Aug 2008
Location: Phoenix
Distribution: Arch
Posts: 799
Blog Entries: 32

Rep: Reputation: 109Reputation: 109
How much processing time would you loose to have symlinks take control of the "start" and "stop"... however that would be messy and ugly.

BTW... if you are already editing the scripts.. you can do:

CMD=start
. /etc/rc.d/rc.syslog
unset $CMD

Then instead of using $1, you could just use $CMD.. or use them both that will assign $1 to $CMD but only if $1 is set.

Last edited by lumak; 10-19-2010 at 11:44 PM.
 
Old 10-20-2010, 03:44 AM   #22
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: Tupelo, MS
Distribution: Gentoo
Posts: 6,926

Rep: Reputation: 124Reputation: 124
Quote:
Originally Posted by gnashley View Post
Sasha, I combined your scripts with some of tuxdev's and modified some others. By using them with dash, I was able to get a boot-time of about 7 seconds on a 2.0GHz Pentium 4 machine -normal boot time was around 25-30 seconds on the same machine.
I tried to create a complete set of scripts which get called directly from the existing init routines and not worry about the init 'fragments' which are included with individual packages -letting them use the normal 'bash as sh' code.
I used a 'dedicated' shebang (#!/bin/dash) instead of substituting dash for bash as the main /bin/sh shell. It turns out that using a shebang which points to a link also slows things down. In other words, just using #!/bin/bash instead of #!/bin/sh with the standard scripts would speed things up some...
Perhaps I've missed something here...

Changing every script in /etc/rc.d/ which was executable from #!/bin/sh to #!/bin/bash
did not speed up my boot time by a nanosecond. It takes ~ 34 seconds to boot from the
LiLO splash screen to Linux login in runlevel 3.

I do remember years ago changing several things, backgrounding scripts, to get Slackware
to boot faster. In fact, there was a thread about fastest boot times. But heck, I don't reboot
that often. Once a month usually to use Windoze for Adobe InDesign is about it.
 
Old 10-20-2010, 08:50 AM   #23
rmjohnso
Member
 
Registered: Mar 2006
Location: Wisconsin
Distribution: Slackware64-Current
Posts: 294

Rep: Reputation: 43
Quote:
Originally Posted by Bruce Hill View Post
Perhaps I've missed something here...

Changing every script in /etc/rc.d/ which was executable from #!/bin/sh to #!/bin/bash
did not speed up my boot time by a nanosecond. It takes ~ 34 seconds to boot from the
LiLO splash screen to Linux login in runlevel 3.

I do remember years ago changing several things, backgrounding scripts, to get Slackware
to boot faster. In fact, there was a thread about fastest boot times. But heck, I don't reboot
that often. Once a month usually to use Windoze for Adobe InDesign is about it.
Bruce, are you using bash or dash? The speed increases require you to use dash.
 
Old 10-20-2010, 09:07 AM   #24
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: Tupelo, MS
Distribution: Gentoo
Posts: 6,926

Rep: Reputation: 124Reputation: 124
But gnashley wrote: "In other words, just using #!/bin/bash instead of #!/bin/sh with the standard scripts would speed things up some..."
 
Old 10-20-2010, 11:50 AM   #25
Tsomi
LQ Newbie
 
Registered: Oct 2006
Posts: 13

Rep: Reputation: 6
Quote:
Originally Posted by GrapefruiTgirl View Post
I also tried for the heck of it, since I mentioned it earlier, using /bin/ash as the boot shell. Don't try it. It doesn't work-- I thought Dash was strict but Ash is worse -- or maybe it's just plain incapable of doing anything the least bit complicated. My machine wouldn't boot with a #!/bin/ash in rc.M, had to reboot into /bin/bash to fix it.

Finally: I'm curious if anyone has had any issues with lines which source other scripts with arguments, and how you worked around them. Like for example:
Code:
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then
    . /etc/rc.d/rc.syslog start
fi
In Ash for sure, the argument doesn't get passed to the sourced script. The workaround I used for Ash is:
Code:
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then
  func_syslog () {
    . /etc/rc.d/rc.syslog
  }
  func_syslog start
fi
gnashley: I'd be interested to have a look through the script collection you're currently using on the machine you describe above in post #19-- have you got them all in a tarball that you can email me, or would you provide or send a link where I could download them?

Thanks!
Actually, it seems that POSIX doesn't allow you to source a script with an argument.

Well, that's what a little script called checkbashism.pl told me:
http://sourceforge.net/projects/checkbaskisms/

I used it to switch my init scripts to ash, too, a long time ago. Very useful.
This link is interesting, too: https://wiki.ubuntu.com/DashAsBinSh

So, calling /bin/ash instead of sourcing seems to be OK (sometimes, the scripts don't even need to be sourced).

Here are my initscripts :
http://www.slackware-fr.org/users/ts...cripts.tar.bz2

However, USE WITH CAUTION:
- They're not updated for what I don't use: i.e luks, cryptsetup, maybe some services...
- bash is still used at some places (especially rc.inet1)
- I have disabled some stuff like atd/crond
- I use the '-F' flag for mount, which is unsafe if you have separated partitions like /usr and /usr/local, /var and /var/www.

I could have made a cleaner version without my personal changes (which may be dangerous for others), but unfortunately, I don't have much time...

So it may help people who want to have ash-compatible scripts but it might be "dangerous" to use them "as it".

It's also quite painful to use when running -current since a lot of rc scripts lack a .new/config() thingy in doinst.sh and thus whenever Pat upgrades them your changes are lost. So, make backups.

An other improvement could be to use awk instead of cut|rev|cut|sed.

The funny thing is that, by using a small shell like ash or dash, you have a really good booting time while keeping the simple BSD-like init scripts (compared to the over-complicated upstart, initng and all that stuff). But I don't think Pat is going to accept these small changes.

Hoping it might help you the same way your scripts helped me.

Last edited by Tsomi; 10-20-2010 at 11:58 AM.
 
Old 10-20-2010, 12:33 PM   #26
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,758

Rep: Reputation: 469Reputation: 469Reputation: 469Reputation: 469Reputation: 469
@Bruce Hill -I mentioned that links are slower than directly calling the desired program as a matter of theory -you need to run lots more iterations than in the init scripts in order to observe any difference.

@lumak I tried and discarded a scheme similar to waht you mention.

@Tsomi -you are right that POSIX doesn't support sourcing with appended parameters. My attempts have dealt with this in several ways. Thank you for posting a link to your files -always nice to have more comparisons(until you go crazy looking at diffs, that is...) Thanks also for mentioning checkbashisms (BTW, check the spelling in your link). I used that script (maybe slightly enhanced??) to check everything as a starting point. However, it does not take into account differences between ash and dash.

@Sasha -I am working on complying with your request for archives of my files. Hope to have it all ready by tomorrow. It's been about a year since you, Tim and I were fooling around with this and my work, back then, was still WIP. So, I had to dig back in, archive as new version what were my last efforts, and try to re-acquaint myself with what we were each doing. I spent a couple of hours today starting to write a README which tries to summarize the approach and content that you, Tim and I had going. And it tries to at least mention all possibly problematic areas of the code and the concepts I was using. Unfortunately, we have all (Tsomi too...) have included extraneous changes which are specific to our style tastes or system/hardware needs. if you only want to update your own scripts, just make a diff between script versions in Slackware-current and Slackware-12.1 (maybe it was 12.0 or 12.2) either way, the changes in the stndard scripts are very few compared to the changes in any one of our modified versions, so it'll be easier to use a diff between official versions as a guide than vice-versa.

I was building my scripts and packages for my own distro and could have done things any way I pleased. But still I tried to come up with a package-based solution which would make it possible to convert/upgrade/downgrade an existing system safely (and revertibly).

In my README, I discount the possibility of any of these ever getting into official Slackware. I doubt that PatV is very interested in POSIX-compliance *for itself*. And rocking the Slackware boat is generally frowned on... Perhaps unfortunately, my efforts to make something which installs/upgrade/downgrades cleanly led to some structural changes which were otherwise un-needed.

I'll do my best to get done with the README by tomorrow so I can upload the materials and link to them in this thread. It should be no surprise that my packages are built using src2pkg scripts, but any useful code there could easily be 'ported' to standard SlackBuild scripts. My doinst.sh scripts do much of the heavy lifting vis-a-vis clean installation.

Finally, as I went back through what I had done, I remembered a couple of details which contributed to my lower boot-times, which I have now left out of the builds. Namely, I had backgrounded all the calls to *update-* in rc.M (gtk-modules, pango and mime stuff, etc) Some of this may have already been implemented in Slackware scripts. The other thing I did, which I am sure is not in Slackware is to have commented out a 3-secnf sleep (waiting for USB modules to intialize) -definietely a no-no for a stock system. Still, the combined effect of those two categories of change amounted to 5-7 seconds, so a system using my changes (without those), would still be shaving close to 50% of the bootup time. Also, my test system had very few services being started so YMMV.

My scripts built on some of the most extensive changes which tuxdev and Sasha had already done. Aside from the extensive structural changes I made, I also spent quite a while on getting some of the most time-consuming sub-scripts working faster using ash or dash.
 
Old 10-20-2010, 01:41 PM   #27
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
I would much appreciate it if someone made a package or slackbuild out of this, because I've tried this before, but I didn't install dash in the right place, and the computer wouldn't boot properly. After fixing, I wasn't in the mood to try it again.
 
Old 10-20-2010, 01:49 PM   #28
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 7,038
Blog Entries: 52

Rep: Reputation: Disabled
There's a SlackBuild for dash.
http://slackbuilds.org/repository/13.1/system/dash/
 
Old 10-20-2010, 02:13 PM   #29
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
I guess I could try that.
 
Old 10-20-2010, 02:54 PM   #30
GrapefruiTgirl
Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Original Poster
Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
@ gilbert,

you wrote so much in post #26 thank you for the detailed reply.

Of course take whatever time you need/want to put together any archive of files you wish to share. I mainly want to look through what you're using, to see if there are any nifty tricks I can throw into my own scripts, and get an idea if there's perhaps any bootup-processes that I definitely should NOT background -- I haven't gone background crazy in my implementation..

You're right -- with the variety of approaches we all have likely taken in this, and the possibly negligible gains vs effort ratio for the general population, it isn't likely that Pat would be interested in this stuff, for better or worse, and also not likely we all could (or would want to) keep a single consistent set of working scripts. And that's OK. It's always been more a "Slacker project" idea that anyone can take upon themselves of they're interested in playing around, and each user can decide how far they want to push it. Also, it doesn't really make sense to have just the init scripts be all nice & modern & POSIXy and all that, when there still many other non-conformant and/or just "age-old-tradition" scripts all around in other locations. I don't dare (grep) the whole system and see just how many scripts there are that need a tune-up. :/

Anyhow, thanks for the feedback & thanks everyone for their input & thoughts on this. Gilbert, I'll enjoy looking through your stuff when you get it ready - no rush (P.S. new distro? wh--where!? What?! )
 
  


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
[SOLVED] init scripts, variables in INIT INFO section catkin Linux - General 1 08-18-2009 02:02 PM
Please recommend Slack-based & Slack-compatible distros. brjoon1021 Slackware 19 11-04-2007 03:14 PM
[SOLVED] Optimize slack boot process / init scripts ? H_TeXMeX_H Slackware 73 10-12-2007 04:47 AM
Wireless POSIX compatible library thebryster Linux - Laptop and Netbook 0 12-03-2004 12:44 PM
slack init scripts gui10 Slackware 11 05-15-2002 11:12 AM


All times are GMT -5. The time now is 07:28 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration