Re: serial console works only if system is booted from it
On Thu, 28 Jul 2022 15:11:58 -0500, Andrew Daugherity wrote: > This is probably worth a mention in the ttys(5) man page. It's one of > those things that once you've worked through it, you know, but it's > not at all obvious that HUP-ing init applies changes from every other > column but NOT any flags changes. I think the wording NetBSD has [1] > is decent: > "Nota Bene: Sending SIGHUP to init(8) does not change the state of the > various tty(4) device flags listed above; the ttyflags(8) program must > be run for changes in those flags to take effect on the devices." How does this look? I couldn't resist making some other minor tweaks while there. - todd Index: libexec/getty/ttys.5 === RCS file: /cvs/src/libexec/getty/ttys.5,v retrieving revision 1.13 diff -u -p -u -r1.13 ttys.5 --- libexec/getty/ttys.58 Feb 2020 01:09:57 - 1.13 +++ libexec/getty/ttys.529 Jul 2022 01:46:57 - @@ -1,4 +1,5 @@ .\"$OpenBSD: ttys.5,v 1.13 2020/02/08 01:09:57 jsg Exp $ +.\" .\" Copyright (c) 1985, 1991, 1993 .\"The Regents of the University of California. All rights reserved. .\" @@ -42,6 +43,7 @@ and control the use of terminal special This information is read with the .Xr getttyent 3 library routines. +.Pp There is one line in the .Nm file per special device file. @@ -54,24 +56,29 @@ are delimited by hash marks and newlines. Any unspecified fields will default to null. .Pp +Each line in +.Nm +is of the format: +.Dl tty command type flags +.Pp The first field is the name of the terminal special file as it is found in .Pa /dev . .Pp -The second field of the file is the command to execute for the line, +The second field is the command to execute for the line, usually .Xr getty 8 , which initializes and opens the line, setting the speed, waiting for a user name and executing the .Xr login 1 -program. +utility. It can be, however, any desired command, for example the start up for a window system terminal emulator or some other daemon process, and can contain multiple words if quoted. .Pp The third field is the type of terminal usually connected to that -TTY line, normally the one found in the -.Xr termcap 5 +tty line, normally the one found in the +.Xr terminfo 5 database file. The environment variable .Dv TERM @@ -87,7 +94,7 @@ entry (see or specify a window system process that .Xr init 8 will maintain for the terminal line. -The following is a list of permitted flags for each TTY: +The following is a list of permitted flags for each tty: .Bl -tag -width xxx .It Ar on Specify that @@ -98,7 +105,7 @@ The opposite of on. .It Ar secure If .Ar on -is also specified, allows users with a UID of 0 to log in on this line. +is also specified, allows users with a user ID of 0 to log in on this line. If set for the .Ar console entry, then @@ -130,11 +137,21 @@ will execute .Em before starting the command specified by the second field. .Pp -Changes to the ttys file take effect after it has been reloaded by +Changes to the +.Nm +file take effect after it has been reloaded by .Xr init 8 , which can be triggered by sending it a .Dv HUP signal. +Reloading the +.Nm +file does +.Em not +change the state of the device-specific terminal flags described above. +The +.Xr ttyflags 8 +utility can be used to set those flags. .Sh FILES .Bl -tag -width /etc/ttys -compact .It Pa /etc/ttys
Re: serial console works only if system is booted from it
On Mon, Jul 25, 2022 at 9:01 PM Todd C. Miller wrote: > > On Sun, 24 Jul 2022 23:50:11 -0700, Kastus Shchuka wrote: > > > Apparently, restarting getty on tty00 was not enough. > > After reboot, I got login prompt on tty00 line. > > Running "ttyflags -a" as root would probably also fix it without > the need for a reboot. This is probably worth a mention in the ttys(5) man page. It's one of those things that once you've worked through it, you know, but it's not at all obvious that HUP-ing init applies changes from every other column but NOT any flags changes. I think the wording NetBSD has [1] is decent: "Nota Bene: Sending SIGHUP to init(8) does not change the state of the various tty(4) device flags listed above; the ttyflags(8) program must be run for changes in those flags to take effect on the devices." I'm pretty sure I tried 'local' on some Dell servers but it didn't work for me, on either the physical port or IPMI Serial-over-LAN; 'softcar' did the trick in my case. Without that I get the same issue -- getty only works if the device is also the boot console. Thanks, -Andrew [1] http://man.bsd.lv/NetBSD-9.2/ttys
Re: serial console works only if system is booted from it
On Sun, 24 Jul 2022 23:50:11 -0700, Kastus Shchuka wrote: > Apparently, restarting getty on tty00 was not enough. > After reboot, I got login prompt on tty00 line. Running "ttyflags -a" as root would probably also fix it without the need for a reboot. - todd
Re: serial console works only if system is booted from it
On Sun, Jul 24, 2022 at 11:35:18PM -0700, Kastus Shchuka wrote: > On Mon, Jul 25, 2022 at 01:38:41AM -0400, Hugo Villeneuve wrote: > > > > I wrote this ages ago: > > > > https://marc.info/?l=openbsd-misc=139089795907395=2 > > > > it may apply to you. > > Thank you for the link. Unfortunately, adding "local" to tty00 made no > difference. > Apparently, restarting getty on tty00 was not enough. After reboot, I got login prompt on tty00 line. So, "local" really fixes it. I guess without "local" getty waits for the carrier which never comes on a null modem. > The other percularity that I noticed, getty on tty00 stays in > ttyopn wait state, while other terminals where I can see login prompt, > are in ttyin state. Please see pid 11907 below: > > jetway$ pgrep -lf getty > 11907 /usr/libexec/getty std.9600 tty00 > 21180 /usr/libexec/getty std.9600 ttyC0 > 18041 /usr/libexec/getty std.9600 ttyC5 > 70940 /usr/libexec/getty std.9600 ttyC3 > 62965 /usr/libexec/getty std.9600 ttyC2 > 65765 /usr/libexec/getty std.9600 ttyC1 > > > and top shows > > load averages: 0.02, 0.01, 0.00 > jetway.tprfct.net 23:31:10 > 39 processes: 38 idle, 1 on processor > up 3:46 > CPU0 states: 0.0% user, 0.0% nice, 0.0% sys, 0.0% spin, 0.0% intr, 100% > idle > CPU1 states: 0.0% user, 0.0% nice, 0.0% sys, 0.0% spin, 0.0% intr, 100% > idle > CPU2 states: 0.0% user, 0.0% nice, 0.0% sys, 0.0% spin, 0.0% intr, 100% > idle > CPU3 states: 0.0% user, 0.0% nice, 0.0% sys, 0.0% spin, 0.0% intr, 100% > idle > Memory: Real: 34M/1320M act/tot Free: 6520M Cache: 711M Swap: 0K/8349M > > PID USERNAME PRI NICE SIZE RES STATE WAIT TIMECPU COMMAND > 21180 root 30 512K 1500K idle ttyin 0:03 0.00% getty > 70940 root 30 516K 1492K idle ttyin 0:00 0.00% getty > 62965 root 30 508K 1476K idle ttyin 0:00 0.00% getty > 65765 root 30 508K 1472K idle ttyin 0:00 0.00% getty > 18041 root 30 508K 1476K idle ttyin 0:00 0.00% getty > 11907 root 30 508K 1496K idle ttyopn0:00 0.00% getty > > I wonder if getty cannot open tty00 for some reason. > Now getty looks like it should: jetway$ pgrep -lf getty 33943 /usr/libexec/getty std.9600 tty00 31285 /usr/libexec/getty std.9600 ttyC5 69646 /usr/libexec/getty std.9600 ttyC3 36033 /usr/libexec/getty std.9600 ttyC2 90820 /usr/libexec/getty std.9600 ttyC1 13016 /usr/libexec/getty std.9600 ttyC0 PID USERNAME PRI NICE SIZE RES STATE WAIT TIMECPU COMMAND 33943 root 30 508K 1520K idle ttyin 0:07 0.00% getty 90820 root 30 512K 1512K idle ttyin 0:00 0.00% getty 36033 root 30 508K 1492K idle ttyin 0:00 0.00% getty 69646 root 30 512K 1512K idle ttyin 0:00 0.00% getty 13016 root 30 504K 1500K idle ttyin 0:00 0.00% getty 31285 root 30 508K 1500K idle ttyin 0:00 0.00% getty Thanks a lot!
Re: serial console works only if system is booted from it
On Mon, Jul 25, 2022 at 01:38:41AM -0400, Hugo Villeneuve wrote: > > I wrote this ages ago: > > https://marc.info/?l=openbsd-misc=139089795907395=2 > > it may apply to you. Thank you for the link. Unfortunately, adding "local" to tty00 made no difference. The other percularity that I noticed, getty on tty00 stays in ttyopn wait state, while other terminals where I can see login prompt, are in ttyin state. Please see pid 11907 below: jetway$ pgrep -lf getty 11907 /usr/libexec/getty std.9600 tty00 21180 /usr/libexec/getty std.9600 ttyC0 18041 /usr/libexec/getty std.9600 ttyC5 70940 /usr/libexec/getty std.9600 ttyC3 62965 /usr/libexec/getty std.9600 ttyC2 65765 /usr/libexec/getty std.9600 ttyC1 and top shows load averages: 0.02, 0.01, 0.00 jetway.tprfct.net 23:31:10 39 processes: 38 idle, 1 on processor up 3:46 CPU0 states: 0.0% user, 0.0% nice, 0.0% sys, 0.0% spin, 0.0% intr, 100% idle CPU1 states: 0.0% user, 0.0% nice, 0.0% sys, 0.0% spin, 0.0% intr, 100% idle CPU2 states: 0.0% user, 0.0% nice, 0.0% sys, 0.0% spin, 0.0% intr, 100% idle CPU3 states: 0.0% user, 0.0% nice, 0.0% sys, 0.0% spin, 0.0% intr, 100% idle Memory: Real: 34M/1320M act/tot Free: 6520M Cache: 711M Swap: 0K/8349M PID USERNAME PRI NICE SIZE RES STATE WAIT TIMECPU COMMAND 21180 root 30 512K 1500K idle ttyin 0:03 0.00% getty 70940 root 30 516K 1492K idle ttyin 0:00 0.00% getty 62965 root 30 508K 1476K idle ttyin 0:00 0.00% getty 65765 root 30 508K 1472K idle ttyin 0:00 0.00% getty 18041 root 30 508K 1476K idle ttyin 0:00 0.00% getty 11907 root 30 508K 1496K idle ttyopn0:00 0.00% getty I wonder if getty cannot open tty00 for some reason. Thanks, Kastus > > > > On Sun, Jul 24, 2022 at 08:37:06PM -0700, Kastus Shchuka wrote: > > Hi, > > > > I tried to set up serial console on my system in addition to the > > regular monitor/keyboard, and I am running into a problem. > > > > I want to have both local monitor and serial console. > > > > This is what I have tried. > > > > The system is booted with console on the attached monitor/keyboard. > > > > I change the line in /etc/ttys for tty00 to enable getty on tty00: > > > > tty00 "/usr/libexec/getty std.9600" vt220 on secure > > > > I reloaded init after the change by sending SIGHUP to it. I can see getty > > process running for tty00. Terminal emulator connected to the serial port > > shows nothing. > > > > Now I reboot the system and type "set tty com0" at the boot prompt > > on the locally attached keyboard/monitor. The boot process continues > > on the serial port and I see all output on the terminal emulator. > > After boot finishes, I have login prompt both on the serial port > > and on the monitor/keyboard. Login works from both. > > > > It appears that serial console works for me only if I booted the system > > from it. I am not able to activate serial console if the system was > > not booted from it. > > > > Is this expected behavior or am I doing something wrong here? > > > > I can see a difference in dmesg between boot on serial console > > and regular monitor/keyboard. > > > > Boot on serial has > > > > com0 at acpi0 UAR1 addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo > > com0: console > > com1 at acpi0 UAR2 addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo > > com2 at acpi0 UAR3 addr 0x3e8/0x8 irq 10: ns16550a, 16 byte fifo > > com3 at acpi0 UAR4 addr 0x2e8/0x8 irq 11: ns16550a, 16 byte fifo > > > > Boot on monitor/keyboard has > > > > com0 at acpi0 UAR1 addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo > > com1 at acpi0 UAR2 addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo > > com2 at acpi0 UAR3 addr 0x3e8/0x8 irq 10: ns16550a, 16 byte fifo > > com3 at acpi0 UAR4 addr 0x2e8/0x8 irq 11: ns16550a, 16 byte fifo > > > > > > Full dmesg is below: > > > > OpenBSD 7.1 (GENERIC.MP) #465: Mon Apr 11 18:03:57 MDT 2022 > > dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP > > real mem = 8486543360 (8093MB) > > avail mem = 8212041728 (7831MB) > > random: good seed from bootblocks > > mpath0 at root > > scsibus0 at mpath0: 256 targets > > mainbus0 at root > > bios0 at mainbus0: SMBIOS rev. 2.8 @ 0xec120 (16 entries) > > bios0: vendor American Megatrends Inc. version "BASIIA06" date 03/23/2021 > > bios0: NF792I NF792I > > acpi0 at bios0: ACPI 5.0 > > acpi0: sleep states S0 S3 S4 S5 > > acpi0: tables DSDT FACP APIC FPDT FIDT MCFG SSDT SSDT SSDT UEFI LPIT CSRT > > acpi0: wakeup devices XHC1(S4) HDEF(S4) RP01(S4) PXSX(S4) RP02(S4) PXSX(S4) > > RP03(S4) PXSX(S4) RP04(S4) PXSX(S4) BRC1(S0) > > acpitimer0 at acpi0: 3579545 Hz, 24 bits > > acpimadt0 at acpi0 addr 0xfee0: PC-AT compat > > cpu0 at
serial console works only if system is booted from it
Hi, I tried to set up serial console on my system in addition to the regular monitor/keyboard, and I am running into a problem. I want to have both local monitor and serial console. This is what I have tried. The system is booted with console on the attached monitor/keyboard. I change the line in /etc/ttys for tty00 to enable getty on tty00: tty00 "/usr/libexec/getty std.9600" vt220 on secure I reloaded init after the change by sending SIGHUP to it. I can see getty process running for tty00. Terminal emulator connected to the serial port shows nothing. Now I reboot the system and type "set tty com0" at the boot prompt on the locally attached keyboard/monitor. The boot process continues on the serial port and I see all output on the terminal emulator. After boot finishes, I have login prompt both on the serial port and on the monitor/keyboard. Login works from both. It appears that serial console works for me only if I booted the system from it. I am not able to activate serial console if the system was not booted from it. Is this expected behavior or am I doing something wrong here? I can see a difference in dmesg between boot on serial console and regular monitor/keyboard. Boot on serial has com0 at acpi0 UAR1 addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo com0: console com1 at acpi0 UAR2 addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo com2 at acpi0 UAR3 addr 0x3e8/0x8 irq 10: ns16550a, 16 byte fifo com3 at acpi0 UAR4 addr 0x2e8/0x8 irq 11: ns16550a, 16 byte fifo Boot on monitor/keyboard has com0 at acpi0 UAR1 addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo com1 at acpi0 UAR2 addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo com2 at acpi0 UAR3 addr 0x3e8/0x8 irq 10: ns16550a, 16 byte fifo com3 at acpi0 UAR4 addr 0x2e8/0x8 irq 11: ns16550a, 16 byte fifo Full dmesg is below: OpenBSD 7.1 (GENERIC.MP) #465: Mon Apr 11 18:03:57 MDT 2022 dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP real mem = 8486543360 (8093MB) avail mem = 8212041728 (7831MB) random: good seed from bootblocks mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.8 @ 0xec120 (16 entries) bios0: vendor American Megatrends Inc. version "BASIIA06" date 03/23/2021 bios0: NF792I NF792I acpi0 at bios0: ACPI 5.0 acpi0: sleep states S0 S3 S4 S5 acpi0: tables DSDT FACP APIC FPDT FIDT MCFG SSDT SSDT SSDT UEFI LPIT CSRT acpi0: wakeup devices XHC1(S4) HDEF(S4) RP01(S4) PXSX(S4) RP02(S4) PXSX(S4) RP03(S4) PXSX(S4) RP04(S4) PXSX(S4) BRC1(S0) acpitimer0 at acpi0: 3579545 Hz, 24 bits acpimadt0 at acpi0 addr 0xfee0: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: Intel(R) Celeron(R) CPU N3160 @ 1.60GHz, 1600.43 MHz, 06-4c-04 cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,TSC_ADJUST,SMEP,ERMS,MD_CLEAR,IBRS,IBPB,STIBP,SENSOR,ARAT,MELTDOWN cpu0: 1MB 64b/line 16-way L2 cache cpu0: smt 0, core 0, package 0 mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges cpu0: apic clock running at 80MHz cpu0: mwait min=64, max=64, C-substates=0.2.0.0.0.0.3.3, IBE cpu1 at mainbus0: apid 2 (application processor) cpu1: Intel(R) Celeron(R) CPU N3160 @ 1.60GHz, 1600.02 MHz, 06-4c-04 cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,TSC_ADJUST,SMEP,ERMS,MD_CLEAR,IBRS,IBPB,STIBP,SENSOR,ARAT,MELTDOWN cpu1: 1MB 64b/line 16-way L2 cache cpu1: smt 0, core 1, package 0 cpu2 at mainbus0: apid 4 (application processor) cpu2: Intel(R) Celeron(R) CPU N3160 @ 1.60GHz, 1600.02 MHz, 06-4c-04 cpu2: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,TSC_ADJUST,SMEP,ERMS,MD_CLEAR,IBRS,IBPB,STIBP,SENSOR,ARAT,MELTDOWN cpu2: 1MB 64b/line 16-way L2 cache cpu2: smt 0, core 2, package 0 cpu3 at mainbus0: apid 6 (application processor) cpu3: Intel(R) Celeron(R) CPU N3160 @ 1.60GHz, 1600.02 MHz, 06-4c-04 cpu3: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,RDRAND,NXE,RDTSCP,LONG,LAHF,3DNOWP,PERF,ITSC,TSC_ADJUST,SMEP,ERMS,MD_CLEAR,IBRS,IBPB,STIBP,SENSOR,ARAT,MELTDOWN cpu3: 1MB 64b/line 16-way L2 cache cpu3: smt 0, core 3, package 0 ioapic0 at mainbus0: apid 1 pa 0xfec0, version 20, 115 pins acpimcfg0 at acpi0 acpimcfg0: addr 0xe000, bus 0-255 acpiprt0 at