Dear systemd/udev folks, Having a large pool of (different) systems, we hit Linux kernel panics several times in a year. To better debug those, we want to make use of the serial ports still present on today’s systems. Unfortunately, the serial ports on the back plane, we’d like to use, are numbered differently. Can you recommend best practices how to detect where that port is on a system? Currently, we only do it for port ttyS1, by adding `console=ttyS1,115200n8` to the Linux kernel command line *on all systems*, and using the attached script and service unit template and the server the serial cable is connected to. ``` [Unit] Description=TTY logger [Service] ExecStart=/usr/libexec/serial-log %I Type=simple UtmpIdentifier=%I [Install] WantedBy=basic.target ``` ``` devnam="$1" while true; do until /usr/bin/stty -F "/dev/$devnam" 115200 -echo 2>/dev/null; do sleep 60 done until cat "/dev/$devnam" >> /var/log/$devnam.log 2>&1;do sleep 1 done done ``` Polling the device every 60 seconds is not very elegant, and we also would like to avoid having to configure each device manually, where the serial port is. Does udev/systemd/… have some features solving this more in a better way? Kind regards, Paul
[Unit] Description=TTY logger [Service] ExecStart=/usr/libexec/serial-log %I Type=simple UtmpIdentifier=%I [Install] WantedBy=basic.target
#! /bin/bash (($#==1)) || { echo "usage: $0 device-name" >&2; exit 1; } devnam="$1" while true; do until /usr/bin/stty -F "/dev/$devnam" 115200 -echo 2>/dev/null; do sleep 60 done until cat "/dev/$devnam" >> /var/log/$devnam.log 2>&1;do sleep 1 done done
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ systemd-devel mailing list systemd-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/systemd-devel