This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

求助!!!调试串口偶发无法使用



背景:

使用的SDK为 ti-processor-sdk-linux-am335x-evm-04.02.00.09,我把默认串口驱动改为了omap-serial.c,内容并没有改变。

现象:

偶尔发现调试串口无法使用,即ttyO0无法使用。向其发送什么它就返回什么。只能重新启动设备才能恢复。

通过systemctl status serial-getty@ttyO0看到如下信息:

   46 ?        00:00:00 bioset
   47 ?        00:00:00 mmcqd/1boot0
   48 ?        00:00:00 bioset
● serial-getty@ttyO0.service - Serial Getty on ttyO0
   Loaded: loaded (/lib/systemd/system/serial-getty@.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2019-01-09 16:12:18 UTC; 4s ago
     Docs: 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'

不知道从哪里下手查找问题了。