[systemd-devel] service killed when usb device reloaded
Mantas Mikulėnas
grawity at gmail.com
Wed Jan 13 20:44:53 UTC 2021
On Wed, Jan 13, 2021, 20:17 Belisko Marek <marek.belisko at gmail.com> wrote:
> Hi,
>
> I'm facing a strange issue. I have gsm modem and when modem is
> restarted (removed from usb bus and plugged back) one of services is
> restarted (with enabled systemd debug level):
>
> Jan 07 09:07:00 device systemd[1]: Received SIGCHLD from PID 166
> (systemtest).
> Jan 07 09:07:00 device kernel[174]: option1 ttyUSB4: GSM modem
> (1-port) converter now disconnected from ttyUSB4
> Jan 07 09:07:00 device systemd[1]: Child 166 (systemtest) died
> (code=killed, status=1/HUP)
>
Sounds like your process had opened /dev/ttyUSB4 at some point, and this
became its "controlling tty" (because services start without one).
The kernel always sends SIGHUP to processes when their controlling tty
disappears or loses carrier (same happens when an xterm is closed). The
signal literally means "hang up".
If your service is accessing the modem, use the O_NOCTTY flag to avoid this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20210113/fcc05f30/attachment.htm>
More information about the systemd-devel
mailing list