0

I've just got a vserver running debian 7 and whenever I start the server and call the top command, there are very many processes that were started automatically on startup.

Can I kill them or are they critical for general functionality of the vserver?

1
  • Can you add the reason you are killing them? If you are killing for fun, go ahead. If you plan to improve resources usage you should probably prevent them from starting at all by disabling them.
    – pqnet
    Commented Aug 25, 2014 at 15:34

2 Answers 2

3

As always it depends...

Typically when I install Debian I start with a minimal installation and add to that what I need and want to run. Anything that gets started automatically then is supposed to be running.

You may have installed and enabled (much) more than YOU need, but randomly killing things is the wrong way to reduce any potential overhead.

Check what is installed, which services get started automatically at system boot and determine if you need those.

Then stop that particular service gracefully (e.g. traditionally with /etc/init.d/servicename stop) and if nothing breaks, prevent that service from starting automatically or remove the package completely.

A lot of what you see in top may be kernel-threads you simply can't kill anyway. For example on this mostly idle system:

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
25878 <me>      20   0 15036 1172  912 R    0  0.0   0:00.09 top
    1 root      20   0 19356 1516 1196 S    0  0.0   0:02.01 init
    2 root      20   0     0    0    0 S    0  0.0   0:00.21 kthreadd
    3 root      RT   0     0    0    0 S    0  0.0   0:01.03 migration/0
    4 root      20   0     0    0    0 S    0  0.0   0:00.20 ksoftirqd/0
    5 root      RT   0     0    0    0 S    0  0.0   0:00.00 migration/0
    6 root      RT   0     0    0    0 S    0  0.0   0:01.75 watchdog/0
    7 root      RT   0     0    0    0 S    0  0.0   0:00.36 migration/1
    8 root      RT   0     0    0    0 S    0  0.0   0:00.00 migration/1
    9 root      20   0     0    0    0 S    0  0.0   0:00.36 ksoftirqd/1
   10 root      RT   0     0    0    0 S    0  0.0   0:01.72 watchdog/1
   11 root      20   0     0    0    0 S    0  0.0   0:37.92 events/0
   12 root      20   0     0    0    0 S    0  0.0   0:43.73 events/1

you see only two real applications top and init and the remainder have a 0 memory footprint indication they're part of the kernel.

Killing init, which is the parent of all processes on the system and is responsible for starting all other processes, is a sure way to kill your system and something to be avoided...

1
  • "kernel panic: tried to kill init". It may be called systemd instead of init now though.
    – pqnet
    Commented Aug 25, 2014 at 15:38
1

Some probably are. A few might not be.

If you check ps fxa, you'll see a lot of them are children of [kthreadd] and have names also in brackets. Those you can mostly ignore (they're part of the Linux kernel).

Other than those, you'll have to research each individually. Some (e.g., init) are critical. Others are critical depending on how you use the server (sshd, apache2/httpd, etc.). Others are only needed if you or your code make use of that feature (e.g., atd).

Killing them is generally not the way to deal with them. Instead, you'll want to disable them starting in the first place (or remove them entirely). How to do that depend on the distro your vserver is running.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .