Marc Haber
2018-11-15 19:15:29 UTC
Hallo,
ich möchte gerne auf einem Raspberri Pi 3 eine serielle Konsole nutzen
und krieg das nicht hin. Ich habe einen 3.3-V-USB-UART auf die
GPIO-Pins aufgesetzt und mit einem Debian Buster nachgewiesen, dass
die Konsole funktioniert. Im Debian-System ist sie auf ttyS1 und kann
mit 115200 bps angesprochen werden:
|[5/4995]***@fan:~ $ telnet localhost 15210
|Trying 127.0.0.1...
|Connected to localhost.
|Escape character is '^]'.
|
|ser2net port 15210 device /dev/ttyUSB0 [115200 N81] (Debian GNU/Linux)
das /dev/ttyUSB0 ist der USB-to-Serial-Adapter im "Terminal".
Ab hier sprechen wir mit dem Pi3:
|Debian GNU/Linux buster/sid rpi3 ttyS1
|
|rpi3 login: root
|Password:
|Last login: Thu Dec 14 22:14:13 UTC 2017 on ttyS1
|Linux rpi3 4.14.0-3-arm64 #1 SMP Debian 4.14.12-2 (2018-01-06) aarch64
|
|***@rpi3:~# w
| 22:34:01 up 24 min, 1 user, load average: 0.00, 0.00, 0.00
|USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
|root ttyS1 - 22:33 1.00s 0.06s 0.01s w
|***@rpi3:~# ls -al /dev/ttyS1
|crw------- 1 root tty 4, 65 Dec 14 22:34 /dev/ttyS1
|***@rpi3:~#
|***@rpi3:~# grep uart /boot/firmware/config.txt
|enable_uart=1
|***@rpi3:~# cat /boot/firmware/cmdline.txt
|console=tty0 console=ttyS1,115200 root=/dev/mmcblk0p2 rw elevator=deadline fsck.repair=yes net.ifnames=0 rootwait
|***@rpi3:~# systemctl status serial-***@ttyS1.service
|? serial-***@ttyS1.service - Serial Getty on ttyS1
| Loaded: loaded (/lib/systemd/system/serial-***@.service; indirect; vendor p
| Active: active (running) since Thu 2017-12-14 22:33:43 UTC; 2min 48s ago
| Docs: man:agetty(8)
| man:systemd-getty-generator(8)
| http://0pointer.de/blog/projects/serial-console.html
| Main PID: 445 (login)
| Tasks: 0 (limit: 4915)
| CGroup: /system.slice/system-serial\x2dgetty.slice/serial-***@ttyS1.service
| ? 445 /bin/login -p --
|
|Dec 14 22:33:43 rpi3 systemd[1]: Started Serial Getty on ttyS1.
|Dec 14 22:33:54 rpi3 login[445]: pam_unix(login:auth): authentication failure; l
|Dec 14 22:33:57 rpi3 login[445]: FAILED LOGIN (1) on '/dev/ttyS1' FOR 'root', Au
|Dec 14 22:33:59 rpi3 login[445]: pam_unix(login:account): account root has passw
|Dec 14 22:33:59 rpi3 login[445]: pam_env(login:session): Unable to open env file
|Dec 14 22:33:59 rpi3 login[445]: pam_unix(login:session): session opened for use
|***@rpi3:~# systemctl cat serial-***@ttyS1.service
|# /lib/systemd/system/serial-***@.service
|# SPDX-License-Identifier: LGPL-2.1+
|#
|# This file is part of systemd.
|#
|# systemd is free software; you can redistribute it and/or modify it
|# under the terms of the GNU Lesser General Public License as published by
|# the Free Software Foundation; either version 2.1 of the License, or
|# (at your option) any later version.
|
|[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 get
|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/agetty -o '-p -- \\u' --keep-baud 115200,38400,9600 %I $TERM
|Type=idle
|Restart=always
|UtmpIdentifier=%I
|TTYPath=/dev/%I
|TTYReset=yes
|TTYVHangup=yes
|KillMode=process
|IgnoreSIGPIPE=no
|SendSIGHUP=yes
|
|[Install]
|WantedBy=getty.target
|***@rpi3:~# dmesg | grep tty
|[ 0.000000] Kernel command line: bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 dma.dmachans=0x7f35 bcm2709.boardrev=0xa02082 bcm2709.serial=0xaae226d bcm2709.uart_clock=48000000 smsc95xx.macaddr=B8:27:EB:AE:22:6D vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 console=tty0 console=ttyS1,115200
root=/dev/mmcblk0p2 rw elevator=deadline fsck.repair=yes net.ifnames=0 rootwait
|[ 0.001336] console [tty0] enabled
|[ 4.006698] console [ttyS1] disabled
|[ 4.008839] 3f215040.serial: ttyS1 at MMIO 0x0 (irq = 61, base_baud = 31250000) is a 16550
|[ 4.848922] console [ttyS1] enabled
|[ 4.974847] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 72, base_baud = 0) is a PL011 rev2
|***@rpi3:~#
Das sieht also ziemlich genau so aus, wie ich es von einem x86-System
mit serieller Konsole gewöhnt bin. So soll es sein.
Leider sieht es auf Raspbian anders aus, dort gibt es kein /dev/ttyS1,
und zwar schon im dmesg nicht:
|***@raspberrypi:~ $ dmesg |grep tty
|[ 0.000000] Kernel command line: 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 dwc_otg.lpm_enable=0 console=tty0 console=ttyS1,115200 root=PARTUUID=262205ad-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
|[ 0.001190] console [tty0] enabled
|[ 0.896815] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
|***@raspberrypi:~ $ uname -a
|Linux raspberrypi 4.9.80-v7+ #1098 SMP Fri Mar 9 19:11:42 GMT 2018 armv7l GNU/Linux
|***@raspberrypi:~ $
Dementsprechend gehen natürlich auch alle Versuche, das ttyS1 zu
benutzen, natürlich in die Hose.
Wie wird beim Raspberry Pi 3 die dtb ausgewählt? Oder woran könnte es
liegen, dass in Debian die serielle Konsole funktioniert und in
Raspbian nicht?
Grüße
Marc
P.S.: ja, das Raspbian ist alt, das ist ein fertiges Image aus dem
Volkszählerprojekt und ich will das erstmal so zu laufen bekommen
bevor ich mir den Community-Support durch Update zu versauen, und ja,
das ist alles in einem abgeschotteten Testnetz.
ich möchte gerne auf einem Raspberri Pi 3 eine serielle Konsole nutzen
und krieg das nicht hin. Ich habe einen 3.3-V-USB-UART auf die
GPIO-Pins aufgesetzt und mit einem Debian Buster nachgewiesen, dass
die Konsole funktioniert. Im Debian-System ist sie auf ttyS1 und kann
mit 115200 bps angesprochen werden:
|[5/4995]***@fan:~ $ telnet localhost 15210
|Trying 127.0.0.1...
|Connected to localhost.
|Escape character is '^]'.
|
|ser2net port 15210 device /dev/ttyUSB0 [115200 N81] (Debian GNU/Linux)
das /dev/ttyUSB0 ist der USB-to-Serial-Adapter im "Terminal".
Ab hier sprechen wir mit dem Pi3:
|Debian GNU/Linux buster/sid rpi3 ttyS1
|
|rpi3 login: root
|Password:
|Last login: Thu Dec 14 22:14:13 UTC 2017 on ttyS1
|Linux rpi3 4.14.0-3-arm64 #1 SMP Debian 4.14.12-2 (2018-01-06) aarch64
|
|***@rpi3:~# w
| 22:34:01 up 24 min, 1 user, load average: 0.00, 0.00, 0.00
|USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
|root ttyS1 - 22:33 1.00s 0.06s 0.01s w
|***@rpi3:~# ls -al /dev/ttyS1
|crw------- 1 root tty 4, 65 Dec 14 22:34 /dev/ttyS1
|***@rpi3:~#
|***@rpi3:~# grep uart /boot/firmware/config.txt
|enable_uart=1
|***@rpi3:~# cat /boot/firmware/cmdline.txt
|console=tty0 console=ttyS1,115200 root=/dev/mmcblk0p2 rw elevator=deadline fsck.repair=yes net.ifnames=0 rootwait
|***@rpi3:~# systemctl status serial-***@ttyS1.service
|? serial-***@ttyS1.service - Serial Getty on ttyS1
| Loaded: loaded (/lib/systemd/system/serial-***@.service; indirect; vendor p
| Active: active (running) since Thu 2017-12-14 22:33:43 UTC; 2min 48s ago
| Docs: man:agetty(8)
| man:systemd-getty-generator(8)
| http://0pointer.de/blog/projects/serial-console.html
| Main PID: 445 (login)
| Tasks: 0 (limit: 4915)
| CGroup: /system.slice/system-serial\x2dgetty.slice/serial-***@ttyS1.service
| ? 445 /bin/login -p --
|
|Dec 14 22:33:43 rpi3 systemd[1]: Started Serial Getty on ttyS1.
|Dec 14 22:33:54 rpi3 login[445]: pam_unix(login:auth): authentication failure; l
|Dec 14 22:33:57 rpi3 login[445]: FAILED LOGIN (1) on '/dev/ttyS1' FOR 'root', Au
|Dec 14 22:33:59 rpi3 login[445]: pam_unix(login:account): account root has passw
|Dec 14 22:33:59 rpi3 login[445]: pam_env(login:session): Unable to open env file
|Dec 14 22:33:59 rpi3 login[445]: pam_unix(login:session): session opened for use
|***@rpi3:~# systemctl cat serial-***@ttyS1.service
|# /lib/systemd/system/serial-***@.service
|# SPDX-License-Identifier: LGPL-2.1+
|#
|# This file is part of systemd.
|#
|# systemd is free software; you can redistribute it and/or modify it
|# under the terms of the GNU Lesser General Public License as published by
|# the Free Software Foundation; either version 2.1 of the License, or
|# (at your option) any later version.
|
|[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 get
|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/agetty -o '-p -- \\u' --keep-baud 115200,38400,9600 %I $TERM
|Type=idle
|Restart=always
|UtmpIdentifier=%I
|TTYPath=/dev/%I
|TTYReset=yes
|TTYVHangup=yes
|KillMode=process
|IgnoreSIGPIPE=no
|SendSIGHUP=yes
|
|[Install]
|WantedBy=getty.target
|***@rpi3:~# dmesg | grep tty
|[ 0.000000] Kernel command line: bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 dma.dmachans=0x7f35 bcm2709.boardrev=0xa02082 bcm2709.serial=0xaae226d bcm2709.uart_clock=48000000 smsc95xx.macaddr=B8:27:EB:AE:22:6D vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 console=tty0 console=ttyS1,115200
root=/dev/mmcblk0p2 rw elevator=deadline fsck.repair=yes net.ifnames=0 rootwait
|[ 0.001336] console [tty0] enabled
|[ 4.006698] console [ttyS1] disabled
|[ 4.008839] 3f215040.serial: ttyS1 at MMIO 0x0 (irq = 61, base_baud = 31250000) is a 16550
|[ 4.848922] console [ttyS1] enabled
|[ 4.974847] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 72, base_baud = 0) is a PL011 rev2
|***@rpi3:~#
Das sieht also ziemlich genau so aus, wie ich es von einem x86-System
mit serieller Konsole gewöhnt bin. So soll es sein.
Leider sieht es auf Raspbian anders aus, dort gibt es kein /dev/ttyS1,
und zwar schon im dmesg nicht:
|***@raspberrypi:~ $ dmesg |grep tty
|[ 0.000000] Kernel command line: 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 dwc_otg.lpm_enable=0 console=tty0 console=ttyS1,115200 root=PARTUUID=262205ad-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
|[ 0.001190] console [tty0] enabled
|[ 0.896815] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
|***@raspberrypi:~ $ uname -a
|Linux raspberrypi 4.9.80-v7+ #1098 SMP Fri Mar 9 19:11:42 GMT 2018 armv7l GNU/Linux
|***@raspberrypi:~ $
Dementsprechend gehen natürlich auch alle Versuche, das ttyS1 zu
benutzen, natürlich in die Hose.
Wie wird beim Raspberry Pi 3 die dtb ausgewählt? Oder woran könnte es
liegen, dass in Debian die serielle Konsole funktioniert und in
Raspbian nicht?
Grüße
Marc
P.S.: ja, das Raspbian ist alt, das ist ein fertiges Image aus dem
Volkszählerprojekt und ich will das erstmal so zu laufen bekommen
bevor ich mir den Community-Support durch Update zu versauen, und ja,
das ist alles in einem abgeschotteten Testnetz.
--
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber | " Questions are the | Mailadresse im Header
Mannheim, Germany | Beginning of Wisdom " |
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 621 72739834
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber | " Questions are the | Mailadresse im Header
Mannheim, Germany | Beginning of Wisdom " |
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 621 72739834