OpenVZ Forum


Home » Mailing lists » Users » Debian-style init scripts considered harmful?
Debian-style init scripts considered harmful? [message #31848] Fri, 11 July 2008 01:23 Go to next message
Steve Wray is currently offline  Steve Wray
Messages: 18
Registered: August 2007
Junior Member
From: openvz.org
Hi there,

Debian uses start-stop-daemon in the init scripts to, for one thing, 
stop services.

 From the man page:

Note:  unless --pidfile is specified, start-stop-daemon behaves similar
to killall(1).  start-stop-daemon will scan the process  table  looking
for  any  processes  which  match the process name, uid, and/or gid (if
specified). Any matching process will prevent --start from starting the
daemon.  All  matching processes will be sent the KILL signal if --stop
is specified. For daemons which have long-lived children which need  to
live through a --stop you must specify a pidfile.

For example, nfs-kernel-server does not use --pidfile. It looks for nfsd 
processes to kill.

Suppose that the Openvz host and one of its guests were running NFS and, 
on the host, one were to run /etc/init.d/nfs-kernel-server stop

As I understand it this would have the side-effect of killing off the 
nfsd processes on the guest.

If true, this would seem somewhat... harsh?
Re: Debian-style init scripts considered harmful? [message #31849 is a reply to message #31848] Fri, 11 July 2008 03:18 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

From: openvz.org
Steve Wray wrote:
> Hi there,
>
> Debian uses start-stop-daemon in the init scripts to, for one thing, 
> stop services.
>
> From the man page:
>
> Note:  unless --pidfile is specified, start-stop-daemon behaves similar
> to killall(1).  start-stop-daemon will scan the process  table  looking
> for  any  processes  which  match the process name, uid, and/or gid (if
> specified). Any matching process will prevent --start from starting the
> daemon.  All  matching processes will be sent the KILL signal if --stop
> is specified. For daemons which have long-lived children which need  to
> live through a --stop you must specify a pidfile.
>
> For example, nfs-kernel-server does not use --pidfile. It looks for 
> nfsd processes to kill.
>
> Suppose that the Openvz host and one of its guests were running NFS 
> and, on the host, one were to run /etc/init.d/nfs-kernel-server stop
>
> As I understand it this would have the side-effect of killing off the 
> nfsd processes on the guest.
>
That is right, and this is just one of the reasons why we don't 
recommend to run anything (but the needed bare minimum like sshd) on the 
host system.

There is a solution and a workaround for the problem. The solution is, 
right, to fix bad initscripts. I mean, it's not OpenVZ-specific -- 
relying on process names is wrong, any user can run a process named nfsd 
and it should not be killed.

The workaround is to introduce a feature to hide guests' processes from 
the host system. This is implemented in OpenVZ kernels >= 2.6.24 as per 
bug #511 (http://bugzilla.openvz.org/511).
Re: Debian-style init scripts considered harmful? [message #31859 is a reply to message #31849] Fri, 11 July 2008 09:29 Go to previous messageGo to next message
Oliver Heinz is currently offline  Oliver Heinz
Messages: 1
Registered: July 2008
Junior Member
From: openvz.org
Am Freitag 11 Juli 2008 05:18:07 schrieb Kir Kolyshkin:
....
> The workaround is to introduce a feature to hide guests' processes from
> the host system. This is implemented in OpenVZ kernels >= 2.6.24 as per
> bug #511 (http://bugzilla.openvz.org/511).


That is great news, I don't consider it a workaround, seems like  a great 
feature to me :-)

I preferred  vservers behaviour on that. You have a special context (1) where 
you see all processes and in the root context (0) you see just those that 
belong to the root server. And you may change to context 1 if you really want 
to operate on the whole process list.

So thanks for creating this "workaround"! Will it still be possible to see the 
complete processlist including those hidden guests  if you want to do it on 
purpose?

[ups, am i hijacking this thread? I hope it's still of relevance to the 
original poster]


Oliver
Re: Debian-style init scripts considered harmful? [message #31998 is a reply to message #31849] Thu, 17 July 2008 01:41 Go to previous message
Steve Wray is currently offline  Steve Wray
Messages: 18
Registered: August 2007
Junior Member
From: openvz.org
Kir Kolyshkin wrote:
> Steve Wray wrote:
>> Hi there,
>>
>> Debian uses start-stop-daemon in the init scripts to, for one thing, 
>> stop services.
>>
>> From the man page:
>>
>> Note:  unless --pidfile is specified, start-stop-daemon behaves similar
>> to killall(1).  start-stop-daemon will scan the process  table  looking
>> for  any  processes  which  match the process name, uid, and/or gid (if
>> specified). Any matching process will prevent --start from starting the
>> daemon.  All  matching processes will be sent the KILL signal if --stop
>> is specified. For daemons which have long-lived children which need  to
>> live through a --stop you must specify a pidfile.
>>
>> For example, nfs-kernel-server does not use --pidfile. It looks for 
>> nfsd processes to kill.
>>
>> Suppose that the Openvz host and one of its guests were running NFS 
>> and, on the host, one were to run /etc/init.d/nfs-kernel-server stop
>>
>> As I understand it this would have the side-effect of killing off the 
>> nfsd processes on the guest.
>>
> That is right, and this is just one of the reasons why we don't 
> recommend to run anything (but the needed bare minimum like sshd) on the 
> host system.

In my case, this isn't practical; I use cfengine to manage and maintain 
virtually all of our servers. We have a lot of servers.

In fact, it was cfengine which brought this to my attention; I restarted 
it on the openvz host and then started to get nagios alerts about 
cfengine not running on any of the guests.

It was at this point that I realised that openvz isn't a virtualisation 
environment; its a very *very* sophisticated chroot.


> There is a solution and a workaround for the problem. The solution is, 
> right, to fix bad initscripts. I mean, it's not OpenVZ-specific -- 
> relying on process names is wrong, any user can run a process named nfsd 
> and it should not be killed.
> 
> The workaround is to introduce a feature to hide guests' processes from 
> the host system. This is implemented in OpenVZ kernels >= 2.6.24 as per 
> bug #511 (http://bugzilla.openvz.org/511).


Well I look forward to trying this out some time!
Previous Topic: mysqldump exceeding limits
Next Topic: kernel panics - 2.6.18 RHEL5 028stab053.14
Goto Forum:
  


Current Time: Sat Sep 21 05:02:04 GMT 2019