Tuning Ubuntu - Stopping Services

I have a number of servers (web, db, ftp) that are all built from a base install of Ubuntu 11.10 with software then installed with apt-get.

There are a number of similar services running from init.d which I don't really know what they are.

Does any one know which services can be stopped just to remove some memory footprint. Or is it a very bad idea to start doing this?

7 Replies

Try using this command:

apt-get autoremove

Make sure none of the packages are needed before you press Y though

Hi,

@ollietrex:

There are a number of similar services running from init.d which I don't really know what they are.

Does any one know which services can be stopped just to remove some memory footprint. Or is it a very bad idea to start doing this?

well, post a list of your running services (best: output of "ps axuf") so someone can have a look :)

My web server has the following output.

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         2  0.0  0.0      0     0 ?        S    Mar28   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [ksoftirqd/0]
root         4  0.0  0.0      0     0 ?        S    Mar28   0:21  \_ [kworker/0:0]
root         5  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [kworker/u:0]
root         6  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [migration/0]
root         7  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [migration/1]
root         8  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [kworker/1:0]
root         9  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [ksoftirqd/1]
root        10  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [migration/2]
root        11  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [kworker/2:0]
root        12  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [ksoftirqd/2]
root        13  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [migration/3]
root        14  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [kworker/3:0]
root        15  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [ksoftirqd/3]
root        16  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [cpuset]
root        17  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [khelper]
root        18  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [kworker/u:1]
root        22  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [xenwatch]
root        23  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [xenbus]
root       149  0.0  0.0      0     0 ?        S    Mar28   0:06  \_ [sync_supers]
root       151  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [bdi-default]
root       153  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [kblockd]
root       163  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [md]
root       247  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [rpciod]
root       249  0.0  0.0      0     0 ?        S    Mar28   0:29  \_ [kworker/0:1]
root       280  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [kswapd0]
root       281  0.0  0.0      0     0 ?        SN   Mar28   0:00  \_ [ksmd]
root       282  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [fsnotify_mark]
root       286  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [ecryptfs-kthrea]
root       288  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [nfsiod]
root       291  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [jfsIO]
root       292  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [jfsCommit]
root       293  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [jfsCommit]
root       294  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [jfsCommit]
root       295  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [jfsCommit]
root       296  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [jfsSync]
root       297  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [xfs_mru_cache]
root       298  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [xfslogd]
root       299  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [xfsdatad]
root       300  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [xfsconvertd]
root       301  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [glock_workqueue]
root       302  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [delete_workqueu]
root       303  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [gfs_recovery]
root       304  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [crypto]
root       866  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [khvcd]
root       979  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [kpsmoused]
root       980  0.0  0.0      0     0 ?        S    Mar28   0:46  \_ [kworker/2:1]
root      1008  0.0  0.0      0     0 ?        S    Mar28   0:07  \_ [kjournald]
root      1016  0.0  0.0      0     0 ?        S    Mar28   0:43  \_ [kworker/1:1]
root      1033  0.0  0.0      0     0 ?        S    Mar28   0:42  \_ [kworker/3:1]
root      2235  0.0  0.0      0     0 ?        S    Mar28   0:09  \_ [flush-202:0]
root         1  0.0  0.2   2732  1428 ?        Ss   Mar28   0:01 /sbin/init
root      1034  0.0  0.0   2364   472 ?        S    Mar28   0:00 upstart-udev-bridge --daemon
root      1036  0.0  0.0   2232   312 ?        S

My database server:

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         2  0.0  0.0      0     0 ?        S    Mar28   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    Mar28   0:04  \_ [ksoftirqd/0]
root         4  0.0  0.0      0     0 ?        S    Mar28   0:13  \_ [kworker/0:0]
root         5  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [kworker/u:0]
root         6  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [migration/0]
root         7  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [migration/1]
root         8  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [kworker/1:0]
root         9  0.0  0.0      0     0 ?        S    Mar28   0:01  \_ [ksoftirqd/1]
root        10  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [migration/2]
root        11  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [kworker/2:0]
root        12  0.0  0.0      0     0 ?        S    Mar28   0:18  \_ [ksoftirqd/2]
root        13  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [migration/3]
root        14  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [kworker/3:0]
root        15  0.0  0.0      0     0 ?        S    Mar28   0:02  \_ [ksoftirqd/3]
root        16  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [cpuset]
root        17  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [khelper]
root        18  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [kworker/u:1]
root        22  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [xenwatch]
root        23  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [xenbus]
root       149  0.0  0.0      0     0 ?        S    Mar28   0:05  \_ [sync_supers]
root       151  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [bdi-default]
root       153  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [kblockd]
root       163  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [md]
root       247  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [rpciod]
root       248  0.0  0.0      0     0 ?        S    Mar28   0:40  \_ [kworker/2:1]
root       280  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [kswapd0]
root       281  0.0  0.0      0     0 ?        SN   Mar28   0:00  \_ [ksmd]
root       282  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [fsnotify_mark]
root       286  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [ecryptfs-kthrea]
root       288  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [nfsiod]
root       291  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [jfsIO]
root       292  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [jfsCommit]
root       293  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [jfsCommit]
root       294  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [jfsCommit]
root       295  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [jfsCommit]
root       296  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [jfsSync]
root       297  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [xfs_mru_cache]
root       298  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [xfslogd]
root       299  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [xfsdatad]
root       300  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [xfsconvertd]
root       301  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [glock_workqueue]
root       302  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [delete_workqueu]
root       303  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [gfs_recovery]
root       304  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [crypto]
root       866  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [khvcd]
root       965  0.0  0.0      0     0 ?        S    Mar28   0:22  \_ [kworker/0:1]
root       981  0.0  0.0      0     0 ?        S<   Mar28   0:00  \_ [kpsmoused]
root      1004  0.0  0.0      0     0 ?        S    Mar28   0:40  \_ [kworker/1:1]
root      1009  0.0  0.0      0     0 ?        S    Mar28   0:00  \_ [kjournald]
root      1047  0.0  0.0      0     0 ?        S    Mar28   0:41  \_ [kworker/3:1]
root     10495  0.0  0.0      0     0 ?        S    20:08   0:00  \_ [flush-202:0]
root         1  0.0  0.3   3212  1724 ?        Ss   Mar28   0:00 /sbin/init
root      1045  0.0  0.1   2660   608 ?        S    Mar28   0:00 upstart-udev-bridge --daemon
root      1049  0.0  0.1   2640  1012 ?        Ss   Mar28   0:00 udevd --daemon
root      1705  0.0  0.1   2636   656 ?        S    Mar28   0:00  \_ udevd --daemon
root      1710  0.0  0.1   2636   648 ?        S    Mar28   0:00  \_ udevd --daemon
root      1923  0.0  0.0   2660   344 ?        S    Mar28   0:00 upstart-socket-bridge --daemon
syslog    2040  0.0  0.2  29088  1376 ?        Sl   Mar28   1:51 rsyslogd -c5
102       2047  0.0  0.1   3576   920 ?        Ss   Mar28   0:00 dbus-daemon --system --fork --activation=upstart
daemon    2078  0.0  0.0   2292   348 ?        Ss   Mar28   0:00 atd
root      2079  0.0  0.1   2440   824 ?        Ss   Mar28   0:01 cron
root      2138  0.0  0.1   1980   532 hvc0     Ss+  Mar28   0:00 /sbin/getty -8 38400 hvc0
ntp       2316  0.0  0.2   3668  1440 ?        Ss   Mar28   1:21 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 105:110
root      3945  0.0  0.4   6436  2324 ?        Ss   Mar28   0:02 
mysql     8960  0.0  3.6 122984 18596 ?        Ssl  Mar28   4:12 /usr/sbin/mysqld

The only one I'd consider disabling is atd on your database server. I personally never use it.

Hi,

that's already looking very good. With the exception of "atd", there are no unnecessary services running (everything in square brackets, like "[khelper]" is a kernel task, that you can't stop or start manually). And even "atd" (it's like a complement to cron; used to run one time tasks at some point in the future) sometimes has its uses and probably uses nearly no resources, so you may as well keep it running.

However, this part is strange:

root      3945  0.0  0.4   6436  2324 ?        Ss   Mar28   0:02

A process without a name, running as root? That looks quite suspicious. Can you confirm that this isn't simply a display error?

I removed some stuff which I did not want people to see which I know needs to be running :D

Good spot :D

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct