[systemd-devel] How to start a service when a device is created under /dev/pts/

Giuseppe Sacco giuseppe at sguazz.it
Mon Feb 13 15:16:37 UTC 2023


Hello Mantas,

Il giorno lun, 13/02/2023 alle 14.32 +0100, Giuseppe Sacco ha scritto:
> Il giorno lun, 13/02/2023 alle 15.25 +0200, Mantas Mikulėnas ha scritto:
> > On Mon, Feb 13, 2023 at 3:21 PM Giuseppe Sacco <giuseppe at sguazz.it>
> > wrote:
> > > [...]
> > > In this scenario, the ptys are created by software like iaxmodem
> > > (that uses
> > > asterisk) when its daemon starts. Some more information is available
> > > at
> > > Debian bug 1031200 (http://bugs.debian.org/1031200) and a suggested
> > > solution is to change the unit and depend on the pty daemon service
> > > and
> > > on
> > > the a file system link in /dev that points to the real device in
> > > /dev/pty/
> > > (the link being created by the pty service at startup time).
> > > 
> > > Something like:
> > > 
> > > [Unit]
> > > Description=HylaFAX faxgetty %I
> > > Wants=iaxmodem.service dev-%i.device
> > 
> > I can't see how that would work. Udev doesn't issue events for symlinks
> > –
> > a symlink to something that's not a "device" is still not a device.
> 
> Yes, that's my point of view too. That's way I am asking here.
> 
> > Would it be enough to order faxgetty After=iaxmodem.service, i.e. wait
> > until it has created *all* of the ptys that it was set up to create?
> > Are
> > they preconfigured or do they show up dynamically?
> 
> I don't know. I am going to check.

The link in /dev is created by the iaxmodem service when it starts, and
deleted when it stops. I think you may configure more than one line in
iaxmodem, so you will have many links, like /dev/ttyIAX0 and /dev/ttyIAX1.

BTW, this seems to be working: the dev-%i.device listed in Wants, even if
it only refers to a link, seems to be working.

Bye,
Giuseppe



More information about the systemd-devel mailing list