From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/2907 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Alex Suykov Newsgroups: gmane.comp.sysutils.supervision.general Subject: Re: runit SIGPWR support Date: Fri, 28 Feb 2020 11:45:41 +0200 Message-ID: <20200228094541.GA2429@cube> References: <18110531581952419@sas8-7ec005b03c91.qloud-c.yandex.net> <7003111582476686@vla3-6a5326aeb4ee.qloud-c.yandex.net> <77a6d0d5-f292-b225-e9b9-77c290394b47@gmx.com> <20200224152617.GA28493@mail.hallyn.com> <5f5e0473-4ed1-58c0-26af-2eabf43232b0@gmx.com> <20200228063947.w6le5lzy7wbfs4xf@klumpi.ignorelist.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="112527"; mail-complaints-to="usenet@ciao.gmane.io" To: supervision@list.skarnet.org Original-X-From: supervision-return-2496-gcsg-supervision=m.gmane-mx.org@list.skarnet.org Fri Feb 28 10:47:37 2020 Return-path: Envelope-to: gcsg-supervision@m.gmane-mx.org Original-Received: from alyss.skarnet.org ([95.142.172.232]) by ciao.gmane.io with smtp (Exim 4.92) (envelope-from ) id 1j7cF6-000T5J-Si for gcsg-supervision@m.gmane-mx.org; Fri, 28 Feb 2020 10:47:36 +0100 Original-Received: (qmail 32748 invoked by uid 89); 28 Feb 2020 09:47:56 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm Original-Sender: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Original-Received: (qmail 32741 invoked from network); 28 Feb 2020 09:47:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=dtvjlV0X8054iSulPJVGgQiVuXECMpPkeZmzQT4YcEA=; b=BDPb2K5zUjT7DKrWuugrjVS00Hr7y4yOCVlpM+eXK8vd7NEccLllC3mTuFqEAlR6Pp 0GFc/Q1EFndsw06vwzzvj96DVzmNy28JExKaymLLdLibbkPjeiPCOa+asrCMxDEWsuLg Txtm2ZyY94BtLd1PgSkyic695uJT5v47e8cMz7YfLzWIPsifFbl8dIgQYaGUHnicNba/ 02Ct6MfxtWemZtnfDvDnZlrleP2JlPJloNJ16+yzMNvoIW8PGLR6GcaraOhvyPBT2qpy 493sIhhh9i8Xp5o7FEyFdOF5ubA+W5i1f/jboiIc2q0+9yDnFK4Z79fBz/+6be0NVXfR HQIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=dtvjlV0X8054iSulPJVGgQiVuXECMpPkeZmzQT4YcEA=; b=QmBlgPKNnUfAh6nq1GScKyxXE/vOc+mhWALaEZ4086haI0tdJN7FgiU/0AW//CaT6f f17fMvOw2PyGRwrglkx3GrONdfTQ9GPT/YyaXPshU3uSVEgYSme4u4W1UIxKHBu2MC17 AOCcKGfEap/7jrnnnhfEQoxAkVevJe9/faamgGYLmZ46mWDZapGo7LxwOGDQbYezlzoH 4Q4w8LB5QvKhxuqni+wkx7F9yODDIdJ1mI45CvjCEDkkTQ2hYca4yXqIZ+MdFUmgyQwB YPPitMN/KpdjgCrZGW1ezbLjw8ufwPU40HGtXeMPzYKzAuODVhXnYVXBPxJWB36PBafl ulGw== X-Gm-Message-State: ANhLgQ0RrerhmAtMR1rnF8vfWShpqAOOOWvPJ12oE5bz1zpIjUoNgLO1 kuCv9pI3zkRwqn67n41t+6wvNVJm X-Google-Smtp-Source: ADFU+vv2ff/fMF+g8jPV40E5IFFn/aaPVRniSqZJz9KMlwtI/bszNophzIwxUaC3Gw9SE/DjZfZYEw== X-Received: by 2002:ac2:5198:: with SMTP id u24mr2199364lfi.137.1582883247120; Fri, 28 Feb 2020 01:47:27 -0800 (PST) Content-Disposition: inline In-Reply-To: <20200228063947.w6le5lzy7wbfs4xf@klumpi.ignorelist.com> Xref: news.gmane.io gmane.comp.sysutils.supervision.general:2907 Archived-At: Fri, Feb 28, 2020 at 07:39:47AM +0100, Jan Braun wrote: > The Linux kernel uses SIGPWR to tell init "there's a power failure > imminent". There's a difference to "please shutdown the system", even if > (current versions of) busybox and openrc choose to shutdown the system > when told about an imminent power failure. The Linux kernel never sends SIGPWR to init on most platforms. Grepping the source, there are only about two places where SIGPWR can be sent to the init process from the kernel: machine check exception on S390, and some power-related hardware failure indication on SGI workstations. I'm not familiar with either of those but I suspect in both cases the signal is expected to initiate immediate shutdown. Otherwise, why would they signal init. Just for reference, I checked apcupsd sources. It does include an example of sending SIGPWR to init when some UPS event arrives, but it's just an example, and in that setting spawning some script would be a better approach anyway. The same applies to pretty much anything else in userspace that might be monitoring power supply. It should not be signalling init, it should have some sort of a configuration event handler. Unless it's matter of principle, hard-coding SIGPWR as a shutdown signal sounds like a decent idea to me, at least on Linux. LXD and similar containers might be the only class of applications for which signalling init like that actually makes sense. The distinction between SIGINT for reboot and SIGPWR for shutdown does not sound awful either.