agetty:在 buildroot (systemd) 登录后出现无法识别的字符

agetty:在 buildroot (systemd) 登录后出现无法识别的字符

我在使用 agetty 时遇到了问题。当登录提示获取用户名时,密码提示或登录 shell 会显示无法识别的字符,如下所示:

[  OK  ] Started Serial Getty on ttymxc4.
[  OK  ] Reached target Login Prompts.
[  OK  ] Stopped Network Name Resolution.
[FAILED] Failed to start Network Name Resolution.
See 'systemctl status systemd-resolved.service' for details.
[  OK  ] Stopped Network Time Synchronization.
[FAILED] Failed to start Network Time Synchronization.
See 'systemctl status systemd-timesyncd.service' for details.
[  OK  ] Stopped Network Name Resolution.
[FAILED] Failed to start Network Name Resolution.
See 'systemctl status systemd-resolved.service' for details.
[  OK  ] Stopped Network Time Synchronization.
[FAILED] Failed to start Network Time Synchronization.
See 'systemctl status systemd-timesyncd.service' for details.
[  OK  ] Stopped Network Name Resolution.
[FAILED] Failed to start Network Name Resolution.
See 'systemctl status systemd-resolved.service' for details.
[  OK  ] Stopped Network Time Synchronization.
[FAILED] Failed to start Network Time Synchronization.
See 'systemctl status systemd-timesyncd.service' for details.
[  OK  ] Started OpenSSH server daemon.
[  OK  ] Reached target Multi-User System.
         Starting Update UTMP about System Runlevel Changes...
[  OK  ] Started Update UTMP about System Runlevel Changes.

Welcome to F+S i.MX6
fsimx6 login: root
�cs��ٓ

此后,我按下的任何键都会创建其他随机的无法识别的字符。

我的[电子邮件保护]文件内容如下:

[Unit]
Description=Serial Getty on %I
Documentation=man:agetty(8) man:systemd-getty-generator(8)
Documentation=http://0pointer.de/blog/projects/serial-console.html
BindsTo=dev-%i.device
After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
After=rc-local.service

# If additional gettys are spawned during boot then we should make
# sure that this is synchronized before getty.target, even though
# getty.target didn't actually pull it in.
Before=getty.target
IgnoreOnIsolate=yes

# IgnoreOnIsolate causes issues with sulogin, if someone isolates
# rescue.target or starts rescue.service from multi-user.target or
# graphical.target.
Conflicts=rescue.service
Before=rescue.service

[Service]
# The '-o' option value tells agetty to replace 'login' arguments with an
# option to preserve environment (-p), followed by '--' for safety, and then
# the entered username.
ExecStart=-/sbin/getty -L %I 115200 vt100
Type=idle
Restart=always
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
KillMode=process
IgnoreSIGPIPE=no
SendSIGHUP=yes

[Install]
WantedBy=getty.target

我的配置选项如下:

./configure --target=arm-buildroot-linux-gnueabihf --host=arm-buildroot-linux-gnueabihf --build=x86_64-pc-linux-gnu --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --localstatedir=/var --program-prefix="" --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --with-xmlto=no --with-fop=no --disable-dependency-tracking --enable-ipv6 --enable-nls --disable-static --enable-shared  --disable-rpath --disable-makeinstall-chown --without-systemd --with-systemdsystemunitdir=no --bindir=/usr/bin --sbindir=/usr/sbin --libdir=/usr/lib --with-ncursesw --without-selinux --enable-all-programs --enable-agetty --disable-bfs --disable-cal --disable-chfn-chsh --disable-chmem --disable-cramfs --disable-eject --disable-fallocate --disable-fdformat --enable-fsck --disable-hwclock --disable-ipcrm --disable-ipcs --disable-kill --enable-last --enable-libblkid --enable-libfdisk --enable-libmount --enable-libsmartcols --enable-libuuid --enable-line --disable-logger --enable-login --disable-losetup --disable-lslogins --disable-lsmem --disable-mesg --disable-minix --disable-more --enable-mount --enable-mountpoint --enable-newgrp --enable-nologin --disable-nsenter --disable-partx --disable-pg --disable-pivot_root --enable-raw --disable-rename --disable-rfkill --disable-runuser --disable-schedutils --disable-setpriv --disable-setterm --enable-su --enable-sulogin --disable-switch_root --disable-tunelp --disable-ul --disable-unshare --disable-utmpdump --disable-uuidd --disable-vipw --enable-wall --enable-wdctl --enable-write --disable-zramctl --with-python --enable-pylibmount --with-readline --without-audit

这是在 buildroot 项目之上构建的。我确信我使用了符号链接 getty -> agetty。对于一些测试,我使用了 init=/bin/sh 并测试了一些 agetty 选项,例如不带 -L、--keep-baud、--autologin、vt100、vt102 和 ansi,但它们对我来说都不起作用,结果是一样的。我无法访问 shell 来执行 stty -F。

我知道这些问题是特定于分布的,但我不知道要检查什么来解决这个问题。

我需要在配置中启用 --with-systemd 选项吗?

答案1

我终于找到了解决办法。

--flow-control向 agetty 添加了选项[email protected],这个选项解决了我的问题。

-h,——流量控制

启用硬件 (RTS/CTS) 流控制。由应用程序决定在适当的情况下禁用软件 (XON/XOFF) 流协议。

相关内容