MakeTechEasier
  • Home
  •  
  • About
  •  
  • Archives
  •  
  • Jobs
  •  
  • Advertise
  •  
  • Contact Us
  • Windows
  • Linux
  • Mac
  • Internet
  • WordPress
  • iPhone
  • Android
  • All Categories
    • Android RSS
    • Firefox RSS
    • Gaming RSS
    • Google RSS
    • google chrome RSS
    • Internet RSS
    • iPhone/iPod Touch RSS
    • Linux RSS
    • Mac RSS
    • Mobile RSS
    • OpenOffice RSS
    • PC Hardware RSS
    • Review RSS
    • Roundup RSS
    • Windows RSS
    • Windows Mobile RSS
    • WordPress RSS
    • WordPress Plugins RSS
  • rss icon
  • email icon
  • facebook icon
  • twitter icon

How To Customize Your Startup Routine In Debian

Posted by: Joshua Price on April 8th, 2009
  • View Comments
  • Share

littledebtuxEvery modern operating system has some sort of startup routine. Even DOS had the old AUTOEXEC.BAT and CONFIG.SYS. The startup system defines what is launched on system startup, under what conditions, and in what order. DOS did things the simple way, having a file that was read on every boot that would run commands in whatever order they’re placed in the file. It is indeed simple, but like much of DOS, not nearly powerful or flexible enough to cut it these days.

Nearly all Linux variants use a startup routing modeled after the one found in UNIX System V. Ubuntu uses a system called Upstart which is meant to be backward-compatible with the normal SysV Init. These all run based on the concept of runlevels. A runlevel is simply a set of instructions for bootup/shutdown. If your Linux is set to use, for example, runlevel 5 by default, then every time you boot up you’re going to run all the startup scripts for runlevel 5. The following example shows how the runlevels are set up on a standard Debian installation.

  • 0 – Halt
  • 1 – Single User
  • 2 – Full Multi-User
  • 3 – Full Multi-User
  • 4 – Full Multi-User
  • 5 – Full Multi-User
  • 6 – Reboot

These can be customized by the makers of each distro, so some may default to different runlevels than others. Debian typically defaults to runlevel 2.

To find out your default runlevel, open a console and enter:

cat /etc/inittab | grep initdefault

Or just open /etc/inittab in your text editor of choice and look toward the top for the “initdefault” line.

Now that we know which runlevel our system is using, we can begin trimming out the unneeded parts. Each runlevel has a directory on the system with all the startup scripts. Right now, we’re only worried about the scripts for runlevel 2. Open your file manager or command prompt to /etc/rc2.d. In that directory are all the links to your startup programs for that runlevel.

Example of contents of /etc/rc2.d

You’ll see that each starts with a letter (S or K) followed by a two digit number (00-99). Those scripts that begin with S are started when that runlevel is entered, those beginning with K are killed when the runlevel is entered. The numbers represent the order to run those scripts. For example, S05Foo would start before S80Bar.

There’s a pretty good chance you won’t recognize some of the items listed in that directory. Some of them are pretty clear like “network-manager” while others are more cryptic. If you’re not sure what you can safely remove, look for a man page on that item. For example, if you’re not sure what “acpid” is, enter

man acpid

into your terminal. If man has no entry, there’s always Google.

Now, to begin removing unneeded items. You COULD simply delete the scripts in the rc2.d directory (they’re actually just links to the real scripts) but I wouldn’t recommend that method. It would work in that it would prevent the script from being run on startup, but it could leave open “K” scripts in other runlevels, and it makes it more difficult to restore that item should you need it later. As usual, Debian has a better way.

The command update-rc.d can be used to cleanly add and remove startup items from your runlevel. I have no bluetooth capability on this computer, so I’m going to remove the bluetooth startup item.

update-rc.d -f bluetooth remove

The same method can be used for each item in your default runlevel that you want to remove. If in doubt, leave it there.

If you find yourself wanting to restore that startup item later, the same tool can be used to add services to runlevels. If I later add bluetooth capability to this computer, I can restore that service with

update-rc.d bluetooth defaults

Once you’ve removed all the unnecessary items for your startup, you’ll find your machine boots much more quickly and takes up fewer system resources.

There are other methods from controlling your startup routine, some include graphical utilities to make it easier. If you use a graphical tool for managing your startup, leave a comment and tell me which one and what you like about it.


Josh Price is a Linux professional and contributing writer to MakeTechEasier.com

Tags: debian, init, startup, sysvinit, update-rc.d
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Share and Enjoy!

  • StumbleUpon It!
  • reddit

Related Posts

  • How To Automate Tasks In KDE
  • 8 Useful and Interesting Bash Prompts
  • 13 Ways To Customize Ubuntu Netbook Remix For Better Usability
  • How to Run 32-bit Apps in 64-bit Linux
  • How to Install XBMC Media Center In Ubuntu Hardy

Popular Posts

  • Turn Your Ubuntu Hardy to Mac OSX Leopard 502 comment(s)
  • Turn Your Ubuntu Intrepid Into Mac OSX Leopard 319 comment(s)
  • How To Boot And Install Windows 7 From USB Flash Drive 137 comment(s)
  • 28 Coolest Firefox About:Config Tricks 126 comment(s)
  • How to Create An iPhone Ringtone Using iTunes For Free 111 comment(s)

Enjoyed the article? Subscribe to Make Tech Easier today to get your daily updates of technology tutorials, tips and tricks.

Enter your email:

  • ????? ??????
    very useful article,tnx a lot!
  • Toshio
    Other front-ends to update-rc.d and invoke-rc.d are:
    - bum (boot-up manager), which is a full-fledged GUI front-end;
    - sysv-rc-conf (console-based, interactive, I'm not sure whether it's curses-based).
  • Sharninder
    Very nice post and yes, this should be useful to anyone running a Linux system.
  • Joshua Price
    Yeah I had originally titled it "How to Customize Your Startup Routine in Linux", but since a good portion is Debian-specific I thought this title might reduce some confusion if people were trying to run "update-rc.d" on, say, Fedora. Or wondering why they're on runlevel 5, or why they don't have runlevels at all, etc.
  • Owen
    Nice write up, a lot of the items are not specific to Debian they will work on a number of distributions. Although the update-rc is limited to Debian like systems.
blog comments powered by Disqus

Our Writers

  • Damien Oh - Chief Editor
  • Joshua Price
  • Shevonne Polastre (FreeAgentWriter)
  • Tavis J. Hampton (Lantern Torch)
  • Trevor Dobrygoski
  • Soumen Halder (Ampercent)
  • Sharninder Khera (Geeky Ninja)
  • Tanmay Ahmed (Tech-Tips-Geek)
  • Write for us

Latest Posts

  • BaseKit: Easily Create a Website From Photoshop
  • YuuGuu – Free and Easy Web Conferencing
  • How To Pin Any Files/Folders To Windows 7 Taskbar
  • Manage Your RSS Feed In Mac With NetNewsWire
  • How to Migrate From Blogger.com to Self-Hosted WordPress
Make Tech Easier on Facebook
Jobs by SimplyHired
Job Widgets

Copyright

All the articles (including the text, images and tutorials) are properties of MakeTechEasier.

You cannot copy whole tutorials, either in English or translate to another language without our permission.

Write for us

Writing a tutorial or article for MakeTechEasier is a great way to get exposure and give back to the community.

Read More Details

Suggestions

We need your help to help us serve you better! This is YOUR site, so if you have suggestions/feedbacks on how we can improve it for you, please let us know! We do our best to make this place better!

Make a Suggestion

Navigation

  • Home
  • About Us
  • Advertise
  • Jobs
  • Archives
  • Contact Us

Copyright © 2007-2010 Make Tech Easier | All Right Reserved.