LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Modify rc.M for a faster boot, is this safe. (http://www.linuxquestions.org/questions/slackware-14/modify-rc-m-for-a-faster-boot-is-this-safe-4175503074/)

samac 04-26-2014 01:53 PM

Modify rc.M for a faster boot, is this safe.
 
I have managed to half my boot speed to around 20 seconds by making a couple of changes to rc.M

I would like to know if what I have done is safe or will it cause unexpected problems further down the line.

Code:

# Initialize the networking hardware.
if [ -x /etc/rc.d/rc.inet1 ]; then
  . /etc/rc.d/rc.inet1 &
fi

Added an & ampersand to background the network hardware discovery.

Remmed font cache update, icon cache update, mime type update and GTK+/pango but added them to a script that I intend to run from cron.
Code:

#!/bin/sh
#
# Update shared libraries, font cache, icon cache and GTK+/pango
# Update the X font indexes:
if [ -x /usr/bin/fc-cache ]; then
  echo "Updating X font indexes:  /usr/bin/fc-cache -f &"
  /usr/bin/fc-cache -f &
fi
# Update any existing icon cache files:
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then
  for theme_dir in /usr/share/icons/* ; do
    if [ -r ${theme_dir}/icon-theme.cache ]; then
      echo "Updating icon-theme.cache in ${theme_dir}..."
      /usr/bin/gtk-update-icon-cache -t -f ${theme_dir} 1> /dev/null 2> /dev/null &
    fi
  done
  # This would be a large file and probably shouldn't be there.
  if [ -r /usr/share/icons/icon-theme.cache ]; then
    echo "Deleting icon-theme.cache in /usr/share/icons..."
    #/usr/bin/gtk-update-icon-cache -t -f /usr/share/icons 1> /dev/null 2> /dev/null &
    rm -f /usr/share/icons/icon-theme.cache
  fi
fi
# Update mime database:
if [ -x /usr/bin/update-mime-database -a -d /usr/share/mime ]; then
  echo "Updating MIME database:  /usr/bin/update-mime-database /usr/share/mime &"
  /usr/bin/update-mime-database /usr/share/mime 1> /dev/null 2> /dev/null &
fi
# These GTK+/pango files need to be kept up to date for
# proper input method, pixbuf loaders, and font support.
if [ -x /usr/bin/update-gtk-immodules ]; then
  /usr/bin/update-gtk-immodules --verbose
fi
if [ -x /usr/bin/update-gdk-pixbuf-loaders ]; then
  /usr/bin/update-gdk-pixbuf-loaders --verbose
fi
if [ -x /usr/bin/update-pango-querymodules ]; then
  /usr/bin/update-pango-querymodules --verbose
fi
if [ -x /usr/bin/glib-compile-schemas ]; then
  /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas >/dev/null 2>&1
fi
# All done.

Any thoughts?

samac

metaschima 04-26-2014 02:36 PM

None of these modifications will speed anything up significantly. First, you cannot background inet1 because it is sourced. Second, the '&' at the end of the other commands will background them, so I don't see why you would move these to cron. The ones you should move to cron are the GTK+/pango updates as these are very slow and don't need to be run very often.

samac 04-26-2014 03:16 PM

Hmm rc.inet1 on my computer takes at least 15 seconds to find the dhcp address, yet GTK+/pango are completed in about 1 to 2 seconds. OK I agree with the other things.

samac

ReaperX7 04-26-2014 03:24 PM

Updates library links and such from cron is recommended actually by many people here to shave off the boot time. As far as inet however, you may want to fully test that before committing it. Messing with inet1 because it's the first network daemon initialized can cause a lot of problems with network services, so do be VERY careful with it.

There is yet another way to shave off more boot time but it involves replacing sysvinit with another init package like Runit.

Now before you go rushing off to grab Runit, let me warn you ahead of time. Runit does NOT come with premade run scripts to initialize daemons, you have to create them on your own using the trigger commands located in each sysv/bsd script used by Slackware and it's a tedious process to create, test, and debug them. It is however sysvinit script compatible, and you can run sysvinit and bsdinit scripts from Runit while you migrate them to Runit run scripts. The Runit website has a lot of information that is vital you fully read and understand.

This is just my personal opinion, but Runit is fast and highly customizable as an init system, but it's not as user friendly as sysvinit and bsdinit. Most stuff is admin created, so you'll have to know bash shell scripting at least and daemon control executions and flags extensively. It handles runlevels differently also. It does have an auto triggered console in case a boot process fails which is nice for administration purposes. As well as this most daemons can be loaded in parallel vastly speeding up boot time and shutdown processes, it also does daemon management as well.

My suggestion is to not go the route of an alternative init until you fully understand init systems. BSDinit ans SysVinit can be sped up, but it depends on which service daemons you want to load, and when you load them. Desktops like KDE and Xfce have the ability to run daemons on startup in the background.

I've been experimenting with Runit for a few months now but I'm still not comfortable with it, however, it is one of the more promising init systems that spans several operating systems across the UNIX spectrum.

samac 04-26-2014 03:34 PM

My machine is a stand alone machine only used to access the internet and read email. I run no other network services, that I am aware of, and so far it doesn't seem to have had any problems, although I was concerned that rc.inet2 would probably be run before rc.inet1 finished configuring the hardware.

I have no plans to change to Runit, but I would like to speed up my dhcp connection. The main problem is that my broadband router needs longer than the default Slackware setup time to be found, to reply and set up dhcp. So I've had to lengthen the wait time from 10 to 15.

If this process could be done in the background then I get my boot time to about 20 seconds.

samac

samac 04-26-2014 03:54 PM

Had a quick look at rc.inet2 and the only thing that I use in there is rc.firewall, possibly rc.inetd, so I can't see a problem for me. Am I missing something?

samac

metaschima 04-26-2014 05:11 PM

Quote:

Originally Posted by samac (Post 5159721)
Hmm rc.inet1 on my computer takes at least 15 seconds to find the dhcp address, yet GTK+/pango are completed in about 1 to 2 seconds. OK I agree with the other things.

samac

An option would be to undo any changes to 'rc.inet1.conf', set all values to "", and use network manager or wicd. This way connections don't need to take up boot time, and if connections go down you can set it auto reconnect.

Mark Pettit 04-27-2014 04:24 AM

If you want a faster boot, consider looking at e4rat. Once setup, it monitors all the programs and files that are used for a certain period of time - say 10 minutes. Then, it rearranges all the files on disk to be physically ordered in the order you use them. This results in a boot process that merely shifts the disk head in a steady direction, not randomly. I found it to be very significant. And it's not only the boot - there's the startup of X-windows, your DE (eg gnome,kde, xfce) and the first few programs you generally use (firefox, thunderbird, libreoffice, xterm - all of these start up faster. As long as you set the sample period big enough. Of course, all meaningless if you have a ssd. I recently acquired a hybrid disk - a 1 TB laptop drive with 8 GB of ssd - 4 for read-cache and 4 for write cache. This also makes a difference, altho' you have no real control over how it works.

TobiSGD 04-27-2014 05:28 AM

Quote:

Originally Posted by samac (Post 5159735)
I have no plans to change to Runit, but I would like to speed up my dhcp connection. The main problem is that my broadband router needs longer than the default Slackware setup time to be found, to reply and set up dhcp. So I've had to lengthen the wait time from 10 to 15.

The solution would be to not use DHCP, give the machine a fixed IP and you won't have to wait for the router.

samac 04-27-2014 07:25 AM

My router is supplied by the ISP and it only wants to connect using dhcp, so a atatic IP doesn't seem to be the solutions, unless anyone knows a way around this.

samac

TobiSGD 04-27-2014 09:27 AM

Just set up a static IP and your router as standard gateway and nameserver, I don't see why this shouldn't work.

samac 04-27-2014 10:22 AM

Still no luck

IP 192.168.3.33
netmask 255.255.255.0
router IP 192.168.3.254
Gateway192.168.3.254
nameserver 192.168.3.254 or 8.8.8.8

I'm using netconfig as root and restarting rc.inet1 and rc.inet2 after each modification.

I'm currently back on dhcp.

samac

Mark Pettit 04-27-2014 10:25 AM

Could you tell us the make of this router, so that we can all avoid it.

jtsn 04-27-2014 01:33 PM

Quote:

Originally Posted by samac (Post 5160022)
My router is supplied by the ISP and it only wants to connect using dhcp, so a atatic IP doesn't seem to be the solutions, unless anyone knows a way around this.

Get your own (Wi-Fi) broadband router, preferably with WRT pre-installed, which has an ethernet WAN port, and put it between your network and the ISP device. Your router then talks DHCP to the alien ISP device without slowing down your PC boot-up every time and on the LAN side you can do what you want and what works best for you.

samac 04-27-2014 03:46 PM

Quote:

Get your own (Wi-Fi) broadband router, preferably with WRT pre-installed, which has an ethernet WAN port, and put it between your network and the ISP device. Your router then talks DHCP to the alien ISP device without slowing down your PC boot-up every time and on the LAN side you can do what you want and what works best for you.
I have a broadband router set up a wireless access point. Could I use this? If so, how?

samac


All times are GMT -5. The time now is 09:18 AM.