[systemd-devel] systemd doesn't see ttyPS0 devices from udev

Mantas Mikulėnas grawity at gmail.com
Wed Sep 23 07:34:24 UTC 2020


On Wed, Sep 23, 2020, 09:21 ZhouPeng <zhoupengwork01 at 163.com> wrote:

>
> Thank you  very much for you great suggestions.
>
> I chroot the rootfs and tried to the 3 methods in '/usr/lib/udev/rules.d'
> respectively:
>
> try 1) add  a line of  ACTION!="remove", KERNEL=="ttyPS0", TAG+="systemd"
> below the line of  "ACTION=="remove", GOTO="systemd_end"" in file
> 99-systemd.rules
> try 2) add  a line of  ACTION!="remove", KERNEL=="ttyPS0",  NAME="ttyPS0",
> TAG+="systemd"  below the line of  "ACTION=="remove", GOTO="systemd_end""
> in file 99-systemd.rules
> try 3) replace the line  "SUBSYSTEM=="tty",
> KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*|ttysclp*|sclp_line*|3270/tty[0-9]*",
> TAG+="systemd" with "SUBSYSTEM=="tty",
> KERNEL=="ttyPS[0-9]|tty[a-zA-Z]*|hvc*|xvc*|hvsi*|ttysclp*|sclp_line*|3270/tty[0-9]*",
> TAG+="systemd"",  in file 99-systemd.rules.
>

At least the 1st one *should* have worked, though NAME= seems wrong in the
2nd one...


> At the same time, I replace the line of
> "KERNEL=="tty[A-Z]*[0-9]|ttymxc[0-9]*|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*",
> GROUP="dialout"" with
> "KERNEL=="ttyPS[0-9]|tty[A-Z]*[0-9]|ttymxc[0-9]*|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*",
> GROUP="dialout"".
>

This line is irrelevant, since TAG+="systemd" is the important part –
groups and modes shouldn't be the problem.



> But they didn't take any effect.
>
> Then at the same time, I do
> cp /usr/lib/systemd/system/serial-getty at .service
> /etc/systemd/system/serial-getty at ttyPS0.service
> Edit /etc/systemd/system/serial-getty\@ttyPS0.service:  replace
> "ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM" with
> "ExecStart=-/sbin/agetty --keep-baud 115200 %I $TERM"
> ln -s /etc/systemd/system/serial-getty at ttyPS0.service
> /etc/systemd/system/getty.target.wants/
>
> But there was still no effect. There is still boot failure logs like:
> [ *] (3 of 3) a start job is running for dev-ttyPS0.device (41s / 1min
> 30s)// **here**
> ...
>  [ TIME ] Timed out waiting for device dev-ttyPS0.device. // **here**
> ...
>

Yeah, the baudrate won't change anything if systemd doesn't even see the
device in the first place. It doesn't even get to the point of launching
agetty.


> By the way, Do I need to add some configuration to tiger executing
> something like 'mknod /dev/ttyPS0 c 248 0'  for systemd or udev pls? If
> needed, where is the proper place to add this action pls?
>

No. The kernel automatically creates device nodes (as long as /dev has a
"devtmpfs" mounted); udev only applies modes/symlinks. The problem here is
that udev doesn't properly inform systemd about the new device.


> >What does "udevadm info -a /dev/ttyPS0" output?
> I can not get a console from ttyPS0, so I can not run  "udevadm info -a
> /dev/ttyPS0" in the target(xilinx pynq) board.
>

Try booting with the 'rescue' option, this should directly create a root
login prompt on the kernel console.

>
Alternatively, try creating a simple .service that runs this command, then
you'll find its output in the journal or in the boot console (depending on
what StandardOutput= you set).


>
> Thanks all,
> At 2020-09-22 20:34:15, "Andrei Borzenkov" <arvidjaar at gmail.com> wrote:
> >On Tue, Sep 22, 2020 at 2:53 PM Mantas Mikulėnas <grawity at gmail.com>
> wrote:
> >>
> >> On Tue, Sep 22, 2020 at 1:46 PM Andrei Borzenkov <arvidjaar at gmail.com>
> wrote:
> >>>
> >>> On Tue, Sep 22, 2020 at 1:35 PM ZhouPeng <zhoupengwork01 at 163.com>
> wrote:
> >>> >
> >>> > Hi all,
> >>> >
> >>> > When I use Fedora image as rootfs on Xilinx PYNQ-Z2, I encountered
> the issue  when use the /dev/ttyPS0.
> >>> > I think the issue is because systemd and udev on fedora can didn't
> detect ttyPS0 properly. Do I need to install any other package or do some
> special configuration?
> >>> >
> >>> > **systemd version the issue has been seen with**
> >>> > udevadm --version
> >>> > 237
> >>> > systemd-udev.riscv64                     237-1.0.riscv64.fc28
> >>> >
> >>> >
> >>> > **Unexpected behaviour you saw**
> >>> > We can see ttyPS0 boots ok in the kernel boot period:
> >>> > [    0.180000] console [ttyPS0] enabledat MMIO 0xe0000000 (irq = 2,
> base_baud = 6250000) is a xuartps
> >>> > [    0.180000] console [ttyPS0] enabled
> >>> >
> >>> > But, when boot into systemd, it failed on dev ttyPS0:
> >>> > [ TIME ] Timed out waiting for device dev-ttyPS0.device. // **here**
> >>>
> >>> systemd only monitors for devices with "sysemd" tag. Tags are assigned
> >>> by udev rules. You should add rule to assign tag to ttyPS0. I have no
> >>> idea what it is, but something like
> >>>
> >>> ACTION!="remove", KERNEL=="ttyPS0", TAG+="systemd"Mantas
> >>>
> >>> should do it. Whether this should go upstream depends on how common
> >>> this device is.
> >>
> >>
> >> Well yes, but that should have been already covered by the existing
> upstream rules:
> >>
> >> 99-systemd.rules:12:SUBSYSTEM=="tty",
> KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*|ttysclp*|sclp_line*|3270/tty[0-9]*",
> TAG+="systemd"
> >>
> >
> >Are you sure ttyPS0 has the "tty" subsystem?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20200923/00d3a422/attachment-0001.htm>


More information about the systemd-devel mailing list