News for hackers. Stuff that matters.
Re:Broken by design: systemd by InclinedPlane on Monday February 10, 2014 @06:14AM (#7210335)
See what happens when you kill PID 1 on a system using sysvinit.
Re:Broken by design: systemd by munchhausen on Monday February 10, 2014 @07:03AM (#7210514)
On Linux, nothing:

The only signals that can be sent to process ID 1, the init process, are those for which init has explicitly installed signal handlers. This is done to assure the system is not brought down accidentally. (From kill(2))

In practice, you will find that:

    kill(1, SIGKILL)                        = 0
results in exactly...no effect.
Re:Broken by design: systemd by nailer on Monday February 10, 2014 @07:12AM (#7210545)
It's also because Unix doesn't generally believe in being forgiving (or, UX in general):

    someapp &

    [job 1 backgrounded]

    kill %1

    (job 1 is killed - yep, you can use kill for jobs)
Miss a percent there? You've just sent a TERM to init.
Re:Broken by design: systemd by srd on Monday February 10, 2014 @09:10AM (#7211123)
Which won't matter if you're a normal user. If you're root - why are you using the job system to kill your jobs?
Re:Broken by design: systemd by nailer on Monday February 10, 2014 @09:13AM (#7211139)
> If you're root - why are you using the job system to kill your jobs?

Probably because you know the features of your shell and enjoy productivity.

Re:Broken by design: systemd by yk on Monday February 10, 2014 @11:54AM (#7212060)
Because thats a job for kill.
Re:Broken by design: systemd by belorn on Monday February 10, 2014 @08:53AM (#7211008)
I wonder what would happen if you used OOM_Killer on process ID 1.
Re:Broken by design: systemd by makomk on Monday February 10, 2014 @09:10AM (#7211124)
PID 1 is meant to be immune to the OOM killer. Last time I did development work in that area, it was also impossible to attach a debugger to PID 1 without patching the kernel, and although it worked I'm not sure how safe it was to do so.
Re:Broken by design: systemd by zx2c4 on Monday February 10, 2014 @09:33AM (#7211225)

    zx2c4@thinkpad ~ $ sudo strace -p 1
    Process 1 attached
    select(11, [10], NULL, NULL, {1, 122329}) = 0 (Timeout)
    stat("/dev/initctl", {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
    fstat(10, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
    stat("/dev/initctl", {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
    select(11, [10], NULL, NULL, {5, 0})    = 0 (Timeout)
    stat("/dev/initctl", {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
    fstat(10, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
    stat("/dev/initctl", {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
    select(11, [10], NULL, NULL, {5, 0}^CProcess 1 detached
    <detached ...>
Ptracing seems to work for me.