LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Modify rc.M for a faster boot, is this safe. (https://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

samac 04-27-2014 04:00 PM

Layout:

computer ---- Belkin F5D7230 ----- Zyxel P-660R-T1 ----- ISP via telephone line
..................Wireless Access Point

samac

samac 04-27-2014 04:14 PM

The Belkin has a version number A000de and it is not possible to install dd-wrt. Is what you are suggesting still possible?

samac

ReaperX7 04-27-2014 08:56 PM

Get a Buffalo Networks router.

Richard Cranium 04-28-2014 09:44 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.

Really? There's no admin interface (normally web based) that allows you to set a couple of static IP addresses?

TobiSGD 04-28-2014 09:53 PM

Quote:

Originally Posted by Richard Cranium (Post 5160951)
Really? There's no admin interface (normally web based) that allows you to set a couple of static IP addresses?

Usually you don't need to do something like that. At least on my network I never did, I just used netconfig (or editing /etc/conf.d/net on Gentoo) and it worked without a problem. But that is possibly dependent on the router.

Richard Cranium 04-28-2014 09:54 PM

Hmm. http://cache-www.belkin.com/support/...xxx_manual.pdf and scroll to page 45.

Setup your IP pool to not include the address that you want to give your computer that you're talking about in this thread (otherwise it might be given to another machine that logs into your network).

Richard Cranium 04-28-2014 09:55 PM

Quote:

Originally Posted by TobiSGD (Post 5160960)
Usually you don't need to do something like that. At least on my network I never did, I just used netconfig (or editing /etc/conf.d/net on Gentoo) and it worked without a problem. But that is possibly dependent on the router.

Normally you do have to tell the router to not hand out your static IP to someone else. :)

TobiSGD 04-28-2014 10:46 PM

Quote:

Originally Posted by Richard Cranium (Post 5160964)
Normally you do have to tell the router to not hand out your static IP to someone else. :)

You are right, but in a single user network (as described by the OP) that won't happen.

samac 04-29-2014 02:17 AM

@Richard Cranium
Thanks for the link much better than the pamphlet that came with the router. I do have access to the router, but I haven't been able to set things up yet, perhaps the manual will help (I hear cries of RTFM resound widely across the internet).

@TobiSGD & Richard Cranium
Could it have something to do with the Belkin Wireless router being set up as a wireless access point that is causing the problem with it not connecting through to the internet when I set a static IP in rc.inet1.conf

samac

enorbet 04-29-2014 05:02 AM

Quote:

Originally Posted by samac (Post 5160212)
I have a broadband router set up a wireless access point. Could I use this? If so, how?

samac

Easy. A Wireless Access Point behaves as if it were a NIC so only requires DHCP setup to talk to your ISPs modem and static addy to talk with your wired NIC.

Back in the day when wireless drivers were rare (and troublesome) on Linux and nearly non-existent on OS/2 and BeOS I circumvented the problem by using a wired NIC supported sweetly in each, and connected wirelessly through a cheap little portable WAP. Worked great for years until I just decided wired was better in too many ways.

TobiSGD 04-29-2014 07:13 AM

Quote:

Originally Posted by samac (Post 5161054)
@TobiSGD & Richard Cranium
Could it have something to do with the Belkin Wireless router being set up as a wireless access point that is causing the problem with it not connecting through to the internet when I set a static IP in rc.inet1.conf

samac

It shouldn't matter if you connect through WLAN or Ethernet.

samac 05-03-2014 12:40 PM

Marking this as solved.

I had to change the usage of the Belkin from a wireless access point back to a router, then I had reset it and set it back up. Then after running netconfig and restarting the network. I have internet and also a machine that boots in about 19-20 seconds after the lilo prompt.

samac


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