LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-15-2010, 11:27 AM   #1
sdgh1
LQ Newbie
 
Registered: Dec 2010
Posts: 6

Rep: Reputation: 0
Disabling unnecessary startup services


Hello,

In order to preserve resources and to have more secure machine I want to disable services which are of no use to me. But being relatively new to Linux I want to make sure I'm disabling those really unnecessary and that my actions wont have a negative impact on overall system health / usability. All comments, suggestions and constructive critique is welcome and appreciated!

Below is the output from sysv-rc-conf --list

Code:
acpi-support 1:off      2:on    3:on    4:on    5:on
acpid       
alsa-mixer-s
anacron     
apparmor     S:on
apport      
atd         
avahi-daemon
binfmt-suppo 2:on       3:on    4:on    5:on
bluetooth    0:off      1:off   2:on    3:on    4:on    5:on    6:off
bootlogd    
brltty       S:on
console-setu
cron        
cryptdisks   0:on       6:on
cryptdisks-e 0:on       6:on
cryptdisks-e
cryptdisks-u
cups        
dbus        
dmesg       
dns-clean    1:on       2:on    3:on    4:on    5:on
ecryptfs-uti
ecryptfs-uti
failsafe-x  
fancontrol   2:on       3:on    4:on    5:on
gdm         
grub-common  2:on       3:on    4:on    5:on
halt         0:on
hostname    
hwclock     
hwclock-save
irqbalance  
kerneloops   1:off      2:on    3:on    4:on    5:on
killprocs    1:on
lm-sensors   S:on
module-init-
network-inte
network-inte
network-mana
networking   0:on       6:on
ondemand     2:on       3:on    4:on    5:on
pcmciautils  S:on
plymouth    
plymouth-log
plymouth-spl
plymouth-sto
pppd-dns     1:on       2:on    3:on    4:on    5:on
procps      
pulseaudio   1:off      2:on    3:on    4:on    5:on
rc.local     2:on       3:on    4:on    5:on
reboot       6:on
rsync        2:on       3:on    4:on    5:on
rsyslog     
saned        1:off      2:on    3:on    4:on    5:on
screen-clean
sendsigs     0:on       6:on
single       1:on
speech-dispa 1:off      2:on    3:on    4:on    5:on
stop-bootlog
stop-bootlog
sudo         2:on       3:on    4:on    5:on
udev        
udev-finish 
udevmonitor 
udevtrigger 
ufw         
umountfs     0:on       6:on
umountroot   0:on       6:on
unattended-u 0:on       6:on
urandom      0:on       6:on    S:on
x11-common   S:on
Now, as far as I understand services which sysv-rc-conf listed as not being on or off at any runtime level are started by upstart at every boot using scripts from /etc/init/. So in order to disable any of those I need to remove or rename appropriate .conf file from /etc/init/ - Am I correct on this one?

I'm running Ubuntu 10.10 on a laptop which means that things like acpi-support, pcpid or lm_sensors I will want to have. I'm not using dail-up so I should have no need for atd and pppd-dns. To list other services I'm planing on getting rid of:
anacron, bluetooth, brltty, cups, rsync, saned, speech-dispatcher

I'm not sure what to do with avahi-deamon - I'm not using any network shares, at least currently, so it should be safe to turn it off.

Services I'm not quite sure what to do with are as follow:
dns-clean, hostname, screen-clean

Finally, services I'm planing on leaving on:
acpi-support, acpid, alsa-mixer-save, apparmor, apport, binfmt-support, bootlogd, console-setup, cron, cryptdisks, cryptdisks-enable, cryptdisks-udev, dbus, dmesg, ecryptfs-utils-restore, ecryptfs-utils-save, failsafe-x, fancontrol, gdm, grub-common, halt, hwclock, hwclock-save, irqbalance, kerneloops, killprocs, lm-sensors, module-init-tools, network-interface, network-interface-security, network-manager, networking, ondemand, pcmciautils, plymouth, plymouth-log, plymouth-spl, plymouth-sto, procps, pulseaudio, rc.local, reboot, rsyslog, saned, screen-clean, sendsigs, single, stop-bootlog, stop-bootlog, sudo, udev, udev-finish, udevmonitor, udevtrigger, ufw, umountfs, umountroot, unattended-u, urandom, x11-common

I know, I'm leaving plymouth - but it just looks gorgeous ;-)

Corrections and suggestions anyone?


Tom
 
Old 12-15-2010, 11:53 AM   #2
barriehie
Member
 
Registered: Nov 2010
Distribution: Debian Lenny
Posts: 136
Blog Entries: 1

Rep: Reputation: 23
The command you're looking for to enable/disable boot scripts is update-rc.d. What I do to disable a service is rename the /etc/init.d/file_name to /etc/init.d/file_name.bak and then run
Code:
update-rc.d file_name remove
to remove the init/kill scripts.

HTH,
 
Old 12-15-2010, 11:56 AM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Hi, welcome to LQ!

atd has nothing to do with dial-up; it allows you to
run commands as one-offs at a given time. You also
shouldn't really disable anacron - some system maintenance
tasks may rely on it (not that I know much about Ubuntus
inner workings).
 
Old 12-15-2010, 12:15 PM   #4
sdgh1
LQ Newbie
 
Registered: Dec 2010
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
The command you're looking for to enable/disable boot scripts is update-rc.d.
Thanks for explaining that! Your instructions combined with man should give me all the knowledge I need to disable unwanted services.

@Tinkster

You're right about atd and anacron! From man pages:
Quote:
atd - run jobs queued for later execution
And as for anacron I went and had a peak at /etc/anacrontab - it seems that it's taking care of tasks that weren't completed by cron, at least to my understanding. So indeed, I do want to have those two enabled. Thanks!
 
Old 12-15-2010, 01:31 PM   #5
barriehie
Member
 
Registered: Nov 2010
Distribution: Debian Lenny
Posts: 136
Blog Entries: 1

Rep: Reputation: 23
Be careful when disabling things! You could end of with a hung machine at boot.
 
Old 12-15-2010, 05:07 PM   #6
sdgh1
LQ Newbie
 
Registered: Dec 2010
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by barriehie View Post
Be careful when disabling things! You could end of with a hung machine at boot.
Ha! I'm well aware of it and careful I shall be, but there is no fun without a little bit of risk ;-) Worst come to worst I did a backup of everything.

For now I have disabled only avahi-demon, bluetooth, brltty, cups / cupsd and saned. Printing daemon and avahi were a bit of a pain - I wasn't able to get rid of them using update-rc.d. What did the trick for me was to rename their files in /etc/init/. Now they are no more!

In the course of googling form more information about couple of processes I came across this little, precious gem - bootchart. Now, my booting time is roughly 30 seconds and I'm quite happy with this, tweaking things to get an extra second or two doesn't appeal to me. But having more memory available is quite tempting.

My next target is getty - I'm not using terminal much and so I want to changing the number of available terminals from four to only two or even one. Any idea how I should get around to do that? I'm still looking for informations about that but this time google don't seems to be on my side...
 
Old 12-15-2010, 05:33 PM   #7
barriehie
Member
 
Registered: Nov 2010
Distribution: Debian Lenny
Posts: 136
Blog Entries: 1

Rep: Reputation: 23
Quote:
Originally Posted by sdgh1 View Post
...muted...
My next target is getty - I'm not using terminal much and so I want to changing the number of available terminals from four to only two or even one. Any idea how I should get around to do that? I'm still looking for informations about that but this time google don't seems to be on my side...
Yes, you'll want to edit /etc/inittab. Here you can see the section from mine where 6 are enabled. Just comment, put a # sign, at the beginning of the line.
Code:
# /sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
#  <id>:<runlevels>:<action>:<process>
#
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6
 
Old 12-15-2010, 05:43 PM   #8
sdgh1
LQ Newbie
 
Registered: Dec 2010
Posts: 6

Original Poster
Rep: Reputation: 0
Just rebooted and everything seems to be still working! I did have six as well, now it just two. But I done it in a different way - I went to /etc/init/ and appended _bak to filenames of last four tty's.

For now that the end for me - I need to read some more about other services before I will attempt to disable them. Suggestions where should I start are more than welcome!
 
Old 12-15-2010, 06:02 PM   #9
barriehie
Member
 
Registered: Nov 2010
Distribution: Debian Lenny
Posts: 136
Blog Entries: 1

Rep: Reputation: 23
Quote:
Originally Posted by sdgh1 View Post
Just rebooted and everything seems to be still working! I did have six as well, now it just two. But I done it in a different way - I went to /etc/init/ and appended _bak to filenames of last four tty's.

For now that the end for me - I need to read some more about other services before I will attempt to disable them. Suggestions where should I start are more than welcome!
While that method 'works' the system is still trying to find a file that doesn't exist, UNLESS you removed the init scripts with update-rc.d. If you want minimal services install fluxbox or the like.
Code:
03:37:08 /home/barrie $ > ps -u barrie
  PID TTY          TIME CMD
 3455 pts/0    00:00:00 bash
 3598 pts/1    00:00:00 bash
 3643 ?        00:00:01 fluxbox
 3691 ?        00:00:00 ssh-agent
 3694 ?        00:00:00 dbus-daemon
 3695 ?        00:00:00 dbus-launch
 3698 ?        00:00:00 xscreensaver
 3699 ?        00:00:00 conky
 3724 ?        00:00:06 mrxvt
 3725 pts/2    00:00:00 bash
 3727 ?        00:00:00 icedove
 3739 ?        00:00:00 run-mozilla.sh
 3744 ?        00:00:08 icedove-bin
 3747 ?        00:00:00 gconfd-2
 3763 ?        00:01:37 firefox-bin
 4235 pts/2    00:00:00 ps
03:57:43 /home/barrie $ >
Attached Thumbnails
Click image for larger version

Name:	conky.jpg
Views:	53
Size:	8.1 KB
ID:	5533  
 
Old 12-15-2010, 08:05 PM   #10
sdgh1
LQ Newbie
 
Registered: Dec 2010
Posts: 6

Original Poster
Rep: Reputation: 0
OK, I got rid of the following: avahi-daemon, bluetooth, brltty, cups, dns-clean, pppd-dns, rsync, saned, speech-dispatcher and I'm down to two tty's. I'm planing on removing unattended-updates as well but after setting up cron job to take over it's function.

@barriehie

I went with your advice and used update-rc.d to remove all the links, thanks again. Fluxbox looks interesting but (ashamed) I have to admit that I like visual side of Ubuntu. This "frantic" disabling of services is a learning experience for me - what those things are doing and what will happen when I will switch them off. And there is security / maintenance approach - less services running, less chances for something to go funny ;-)

I'm attaching graph from bootchart - if anyone will have any suggestions as to what (and why) I can still disable I will be grateful.
Attached Thumbnails
Click image for larger version

Name:	HAL-9000-maverick-20101216-2.jpg
Views:	68
Size:	240.4 KB
ID:	5535  
 
Old 12-15-2010, 08:15 PM   #11
tommcd
Senior Member
 
Registered: Jun 2006
Location: Philadelphia PA USA
Distribution: Lubuntu, Slackware
Posts: 2,230

Rep: Reputation: 293Reputation: 293Reputation: 293
You can use sysv-rc-conf directly to enable or disable services. That is what it is for. You don't need to mess with anything in /etc/init/. See this tutorial on sysv-rc.conf:
http://ubuntuforums.org/showthread.php?t=89491
It is a bit out of date, but it does go into detail on how to use sysv-rc-conf. It is a handy tool for enabling or disabling services.

There is also an option under: system > administration > startup_services (or it may be: system > preferences > startup_services) for enabling and disabling may things from starting automatically.

Last edited by tommcd; 12-15-2010 at 08:20 PM.
 
Old 12-15-2010, 08:33 PM   #12
sdgh1
LQ Newbie
 
Registered: Dec 2010
Posts: 6

Original Poster
Rep: Reputation: 0
Yeah, I know about sysv-rc-conf but you can't disable couple of things with it completely, ex. avahi-daemon or cups. If you will have a look here you will know what I was messing with /etc/init in the first place. As for using Startup Applications from the menu - it's OK to start with but it have just bare basic. What I want to do is to learn a bit about every process which is started - what they are there for and what can be done with them.

This tutorial you have mentioned is actually a reason for all that!
 
Old 12-16-2010, 01:29 AM   #13
barriehie
Member
 
Registered: Nov 2010
Distribution: Debian Lenny
Posts: 136
Blog Entries: 1

Rep: Reputation: 23
I've been using fluxbox long enought that a 'regular' desktop is rather weird! I can go with the CLI and not much in the way of a drop down menu!
 
Old 12-16-2010, 02:54 AM   #14
Axelman0
LQ Newbie
 
Registered: May 2010
Location: Chicago
Distribution: UbuntuStudio 10.10, Arch
Posts: 10

Rep: Reputation: 0
I'm not sure how editable the /etc/init/rc.local file is in Ubuntu, but Arch Linux uses a somewhat similarly named /etc/rc.conf file. Here is mine so you can see what the (almost) bare minimums are. Keep in mind I'm not running a gui or even pulseaudio.

Code:
#
# /etc/rc.conf - Main Configuration for Arch Linux
#

# -----------------------------------------------------------------------
# LOCALIZATION
# -----------------------------------------------------------------------
#
# LOCALE: available languages can be listed with the 'locale -a' command
# HARDWARECLOCK: set to "UTC" or "localtime", any other value will result
#   in the hardware clock being left untouched (useful for virtualization)
# TIMEZONE: timezones are found in /usr/share/zoneinfo
# KEYMAP: keymaps are found in /usr/share/kbd/keymaps
# CONSOLEFONT: found in /usr/share/kbd/consolefonts (only needed for non-US)
# CONSOLEMAP: found in /usr/share/kbd/consoletrans
# USECOLOR: use ANSI color sequences in startup messages
#
LOCALE="en_US.UTF-8"
HARDWARECLOCK="UTC"
TIMEZONE="America/Chicago"
KEYMAP="us"
CONSOLEFONT="ter-u32n.psf.gz"
CONSOLEMAP=
USECOLOR="yes"

# -----------------------------------------------------------------------
# HARDWARE
# -----------------------------------------------------------------------
#
# MOD_AUTOLOAD: Allow autoloading of modules at boot and when needed
# MOD_BLACKLIST: Prevent udev from loading these modules
# MODULES: Modules to load at boot-up. Prefix with a ! to blacklist.
#
# NOTE: Use of 'MOD_BLACKLIST' is deprecated. Please use ! in the MODULES array.
#
MOD_AUTOLOAD="yes"
#MOD_BLACKLIST=() #deprecated
MODULES=()

# Scan for LVM volume groups at startup, required if you use LVM
USELVM="no"

# -----------------------------------------------------------------------
# NETWORKING
# -----------------------------------------------------------------------
#
# HOSTNAME: Hostname of machine. Should also be put in /etc/hosts
#
HOSTNAME="Archer1"

# Use 'ifconfig -a' or 'ls /sys/class/net/' to see all available interfaces.
#
# Interfaces to start at boot-up (in this order)
# Declare each interface then list in INTERFACES
#   - prefix an entry in INTERFACES with a ! to disable it
#   - no hyphens in your interface names - Bash doesn't like it
# 
# DHCP:     Set your interface to "dhcp" (wlan0="dhcp")
# Wireless: See network profiles below
#

#Static IP example
#eth0="eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255"
#wlan0="dhcp"

INTERFACES=()

# Routes to start at boot-up (in this order)
# Declare each route then list in ROUTES
#   - prefix an entry in ROUTES with a ! to disable it
#
gateway="default gw 192.168.0.1"
ROUTES=(!gateway)
 
# Setting this to "yes" will skip network shutdown.
# This is required if your root device is on NFS.
NETWORK_PERSIST="no"

# Enable these network profiles at boot-up.  These are only useful
# if you happen to need multiple network configurations (ie, laptop users)
#   - set to 'menu' to present a menu during boot-up (dialog package required)
#   - prefix an entry with a ! to disable it
#
# Network profiles are found in /etc/network.d
#
# This now requires the netcfg package
#
#NETWORKS=(main)

# -----------------------------------------------------------------------
# DAEMONS
# -----------------------------------------------------------------------
#
# Daemons to start at boot-up (in this order)
#   - prefix a daemon with a ! to disable it
#   - prefix a daemon with a @ to start it up in the background
#
DAEMONS=(syslog-ng network netfs crond alsa)
If you want to trim some fat I'd suggest you look into the various wireless modules and blacklist the ones that you do not need. My wireless card on my old laptop actually would not work until I added "!b44" to the modules in the 'HARDWARE' section. It was getting in the way of the b43legacy driver that I needed. Test your computer by removing the modules with
Code:
modprobe -r <modulename>
before you mess with any config files though. You can use
Code:
lsmod
to list all of the modules that you have loaded, and if you're looking for something specific you can pipe it to grep:
Code:
lsmod|grep <search string>
.
 
  


Reply



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
Disabling startup services in Debian Etch swampdog2002 Debian 11 11-27-2007 08:13 AM
Disabling startup services Corallis Fedora 2 08-02-2004 11:51 AM
Which services are unnecessary? revenant Linux - Security 4 03-28-2004 11:43 PM
Disabling Startup Services loadedmind Slackware 7 11-07-2003 09:36 PM
Speeding up boot by stopping unnecessary services hamish Linux - Software 2 09-09-2003 03:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:33 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration