Technology news and Jobs arrow Information Technology News arrow Getting grubby: Demystifying the Linux start-up processes
Getting grubby: Demystifying the Linux start-up processes E-mail
by David M Williams   
Monday, 15 October 2007
A runlevel is not constrained by how it starts up; commands can be run to bring online any required service. You can execute any command or indeed, any of the scripts under /etc/rc.d at any time if so required. The only thing you must be aware of is that a “start” command must be passed in on the command line (e.g. /etc/rc.d/rc5.d/S55cups start to enable printing.)

Other settings in /etc/inittab kickstart virtual consoles, stipulate a command to execute in the event of power failure and other matters.

And, by now, your computer is up and running and waiting for you to tell it what to do. That, in a nutshell, is the complete Linux boot process and the steps which operate in turn and hand off to each other.

Service control
It’s worth spending a bit more time on the /etc/rc.d directories. These really are the key to understanding what Linux is doing when it begins. If you are short on resources, or want to lock down your computer, it’s definitely worth checking out what is starting up by default on boot.

You should look into these folders, but also become familiar with two important relevant Linux commands.

Firstly, chkconfig can be called from a terminal window. It allows services to be added or removed or modified within different runlevels. It will list startup information and also check the state of a particular service (allowing you to see if an expected service is in fact running or not.)

chkconfig works via command-line parameters; chkconfig --list cups will show whether cups is enabled or disabled for each runlevel. You can turn it on or off for any particular runlevel. For instance, to turn cups off for runlevel 4 execute chkconfig --level 4 cups off or chkconfig --level 4 cups on to turn it back on again. In a similar way, you may use the --add and --del switches to install or uninstall services.

Be careful to specify the runlevel; if you do not do so, chkconfig will perform your request over all runlevels. The command chkconfig cups off will disable cups in every runlevel, which may not be your intention. Note that the converse isn’t true; chkconfig cups on will enable cups but only in runlevels 2 through 5. Runlevel 1, single-user mode, isn’t automatically affected (nor are runlevels 0 and 6 which are the two special runlevels, that halt and reboot the system, respectively.)

chkconfig is extremely useful but although having a heritage dating back to certain versions of UNIX, it is largely restricted to Red Hat's Linux distro. A freshmeat project exists to make it available for all other distros.

You may achieve the same results using the ntsysv command. This is still a text-based command (not a GUI program) but it provides a series of prompts, rather than relying solely on command-line parameters.

By default, ntsysv will only work on the current runlevel. You can pass in different runlevels via the --level parameter, e.g. ntsysv --level 3 will let you work on runlevel 3.

Finally, for the more visually-inclined, use System/Administration/Server Settings/Services (or execute system-config-services) to invoke the graphical Service Configuration Tool. This also allows you to modify the services that run upon boot in different runlevels.

Check these tools out; understand just what your computer is doing, and pare down services you don’t require and minimise your potential attack surface at the same time.

Please enable JavaScript in your browser to post your comment!


Get stories like this delivered daily - FREE - subscribe now


 
< Next story in category   Previous story in the category >
iTWire user statistics Visitors last 30 days
Suscribers
904,266
13,751
#1 independent technology news advertise here
  •   *  
  • Search
  • AdvSeach
  • Login
  • Events
  • FreeStuff
Subscribe to our free e-newsletter