背景:
使用的SDK为 ti-processor-sdk-linux-am335x-evm-04.02.00.09,我把默认串口驱动改为了omap-serial.c,内容并没有改变。
现象:
偶尔发现调试串口无法使用,即ttyO0无法使用。向其发送什么它就返回什么。只能重新启动设备才能恢复。
通过systemctl status serial-getty@ttyO0看到如下信息:
46 ?00:00:00 bioset47 ?00:00:00 mmcqd/1boot048 ?00:00:00 bioset ● serial-getty@ttyO0.service - Serial Getty on ttyO0Loaded: loaded (/lib/systemd/system/serial-getty@.service; enabled; vendor preset: enabled)Active: active (running) since Wed 2019-01-09 16:12:18 UTC; 4s agoDocs: man:agetty(8)man:systemd-getty-generator(8)0pointer.de/.../serial-console.html Main PID: 3338 (agetty)Tasks: 1 (limit: 512)CGroup: /system.slice/system-serial\x2dgetty.slice/serial-getty@ttyO0.service└─3338 /sbin/agetty -8 -L ttyO0 115200 xterm Jan 09 16:12:18 am335x-evm systemd[1]: Started Serial Getty on ttyO0. Jan 09 16:12:18 am335x-evm agetty[3338]: /dev/ttyO0: not a tty
正常情况下不会打印not a tty。且serial-getty@ttyO0服务是经常在尝试恢复正常的(日志时间经常变化)。
下面是出问题时系统日志:
Jan 9 11:10:33 am335x-evm daemon.err systemd-coredump[741]: Failed to connect to coredump service: Connection refused Jan 9 11:15:38 am335x-evm authpriv.info login[342]: pam_unix(login:session): session closed for user ecity Jan 9 11:15:38 am335x-evm daemon.info systemd[1]: serial-getty@ttyO0.service: Service has no hold-off time, scheduling restart. Jan 9 11:15:38 am335x-evm auth.info systemd-logind[170]: Removed session c1. Jan 9 11:15:38 am335x-evm daemon.info systemd[1]: Removed slice User Slice of root. Jan 9 11:15:38 am335x-evm daemon.info systemd[1]: Stopped Serial Getty on ttyO0. Jan 9 11:15:38 am335x-evm daemon.info systemd[1]: Started Serial Getty on ttyO0. Jan 9 11:18:56 am335x-evm authpriv.info login[752]: pam_unix(login:session): session opened for user ecity by LOGIN(uid=0) Jan 9 11:18:56 am335x-evm auth.info systemd-logind[170]: New session c2 of user root. Jan 9 11:18:56 am335x-evm daemon.info systemd[1]: Created slice User Slice of root. Jan 9 11:18:56 am335x-evm daemon.info systemd[1]: Starting User Manager for UID 0... Jan 9 11:18:56 am335x-evm authpriv.err systemd: PAM unable to dlopen(/lib/security/pam_loginuid.so): /lib/security/pam_loginuid.so: cannot open shared object file: No such file or directory Jan 9 11:18:56 am335x-evm authpriv.err systemd: PAM adding faulty module: /lib/security/pam_loginuid.so Jan 9 11:18:56 am335x-evm daemon.info systemd[1]: Started Session c2 of user root. Jan 9 11:18:56 am335x-evm authpriv.info systemd: pam_unix(systemd-user:session): session opened for user root by (uid=0) Jan 9 11:18:56 am335x-evm daemon.err systemd[755]: user@0.service: Failed at step PAM spawning /lib/systemd/systemd: Operation not permitted Jan 9 11:18:56 am335x-evm daemon.info systemd[1]: Started User Manager for UID 0. Jan 9 11:18:56 am335x-evm authpriv.notice login[765]: ROOT LOGIN on '/dev/ttyO0' Jan 9 11:25:30 am335x-evm authpriv.info login[752]: pam_unix(login:session): session closed for user ecity Jan 9 11:25:30 am335x-evm daemon.info systemd[1]: serial-getty@ttyO0.service: Service has no hold-off time, scheduling restart. Jan 9 11:25:30 am335x-evm auth.info systemd-logind[170]: Removed session c2. Jan 9 11:25:30 am335x-evm daemon.info systemd[1]: Removed slice User Slice of root. Jan 9 11:25:30 am335x-evm daemon.info systemd[1]: Stopped Serial Getty on ttyO0. Jan 9 11:25:30 am335x-evm daemon.info systemd[1]: Started Serial Getty on ttyO0. Jan 9 13:17:35 am335x-evm authpriv.info login[850]: pam_unix(login:session): session opened for user ecity by LOGIN(uid=0) Jan 9 13:17:35 am335x-evm auth.info systemd-logind[170]: New session c3 of user root. Jan 9 13:17:35 am335x-evm daemon.info systemd[1]: Created slice User Slice of root. Jan 9 13:17:35 am335x-evm daemon.info systemd[1]: Started Session c3 of user root. Jan 9 13:17:35 am335x-evm daemon.info systemd[1]: Starting User Manager for UID 0... Jan 9 13:17:35 am335x-evm authpriv.err systemd: PAM unable to dlopen(/lib/security/pam_loginuid.so): /lib/security/pam_loginuid.so: cannot open shared object file: No such file or directory Jan 9 13:17:35 am335x-evm authpriv.err systemd: PAM adding faulty module: /lib/security/pam_loginuid.so Jan 9 13:17:35 am335x-evm authpriv.info systemd: pam_unix(systemd-user:session): session opened for user root by (uid=0) Jan 9 13:17:35 am335x-evm daemon.err systemd[851]: user@0.service: Failed at step PAM spawning /lib/systemd/systemd: Operation not permitted Jan 9 13:17:35 am335x-evm daemon.info systemd[1]: Started User Manager for UID 0. Jan 9 13:17:36 am335x-evm authpriv.notice login[864]: ROOT LOGIN on '/dev/pts/0' from '10.10.51.95:46884' Jan 9 13:23:15 am335x-evm authpriv.info login[850]: pam_unix(login:session): session closed for user ecity Jan 9 13:23:15 am335x-evm auth.info systemd-logind[170]: Removed session c3. Jan 9 13:23:15 am335x-evm daemon.info systemd[1]: Removed slice User Slice of root. Jan 9 13:38:43 am335x-evm authpriv.info login[792]: pam_unix(login:session): session opened for user ecity by LOGIN(uid=0) Jan 9 13:38:44 am335x-evm auth.info systemd-logind[170]: New session c4 of user root. Jan 9 13:38:44 am335x-evm daemon.info systemd[1]: Created slice User Slice of root. Jan 9 13:38:44 am335x-evm daemon.info systemd[1]: Starting User Manager for UID 0... Jan 9 13:38:44 am335x-evm authpriv.err systemd: PAM unable to dlopen(/lib/security/pam_loginuid.so): /lib/security/pam_loginuid.so: cannot open shared object file: No such file or directory Jan 9 13:38:44 am335x-evm authpriv.err systemd: PAM adding faulty module: /lib/security/pam_loginuid.so Jan 9 13:38:44 am335x-evm daemon.info systemd[1]: Started Session c4 of user root. Jan 9 13:38:44 am335x-evm authpriv.info systemd: pam_unix(systemd-user:session): session opened for user root by (uid=0) Jan 9 13:38:44 am335x-evm daemon.err systemd[895]: user@0.service: Failed at step PAM spawning /lib/systemd/systemd: Operation not permitted Jan 9 13:38:44 am335x-evm daemon.info systemd[1]: Started User Manager for UID 0. Jan 9 13:38:44 am335x-evm authpriv.notice login[908]: ROOT LOGIN on '/dev/ttyO0' Jan 9 13:51:29 am335x-evm authpriv.info login[792]: pam_unix(login:session): session closed for user ecity Jan 9 13:51:29 am335x-evm daemon.info systemd[1]: serial-getty@ttyO0.service: Service has no hold-off time, scheduling restart. Jan 9 13:51:29 am335x-evm auth.info systemd-logind[170]: Removed session c4. Jan 9 13:51:29 am335x-evm daemon.info systemd[1]: Removed slice User Slice of root. Jan 9 13:51:29 am335x-evm daemon.info systemd[1]: Stopped Serial Getty on ttyO0. Jan 9 13:51:29 am335x-evm daemon.info systemd[1]: Started Serial Getty on ttyO0. Jan 9 14:14:07 am335x-evm authpriv.info login[952]: pam_unix(login:session): session opened for user ecity by LOGIN(uid=0) Jan 9 14:14:07 am335x-evm auth.info systemd-logind[170]: New session c5 of user root. Jan 9 14:14:07 am335x-evm daemon.info systemd[1]: Created slice User Slice of root. Jan 9 14:14:07 am335x-evm daemon.info systemd[1]: Starting User Manager for UID 0... Jan 9 14:14:07 am335x-evm daemon.info systemd[1]: Started Session c5 of user root. Jan 9 14:14:07 am335x-evm authpriv.err systemd: PAM unable to dlopen(/lib/security/pam_loginuid.so): /lib/security/pam_loginuid.so: cannot open shared object file: No such file or directory Jan 9 14:14:07 am335x-evm authpriv.err systemd: PAM adding faulty module: /lib/security/pam_loginuid.so Jan 9 14:14:07 am335x-evm authpriv.info systemd: pam_unix(systemd-user:session): session opened for user root by (uid=0) Jan 9 14:14:07 am335x-evm daemon.err systemd[962]: user@0.service: Failed at step PAM spawning /lib/systemd/systemd: Operation not permitted Jan 9 14:14:07 am335x-evm daemon.info systemd[1]: Started User Manager for UID 0. Jan 9 14:14:07 am335x-evm authpriv.notice login[977]: ROOT LOGIN on '/dev/ttyO0'
不知道从哪里下手查找问题了。
Shine:
串口波特率是多少?降低试试。
user4043133:
回复 Shine:
这个问题是偶发,不好重现。且使用115200波特率时,尽管ttyO0无系统信息,但是可以通过其他串口调试助手向ttyO0发送数据,16进制也可以,发送什么数据它都返回什么数据。