NetBSD Problem Report #54932
From www@netbsd.org Tue Feb 4 16:09:42 2020
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id E87951A9245
for <gnats-bugs@gnats.NetBSD.org>; Tue, 4 Feb 2020 16:09:41 +0000 (UTC)
Message-Id: <20200204160941.39D611A9246@mollari.NetBSD.org>
Date: Tue, 4 Feb 2020 16:09:41 +0000 (UTC)
From: i@-.-
Reply-To: i@-.-
To: gnats-bugs@NetBSD.org
Subject: A green message overwrite part of screen in sysinst on laptop
X-Send-Pr-Version: www-1.0
>Number: 54932
>Category: install
>Synopsis: A green message overwrite part of screen in sysinst on laptop
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: martin
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Feb 04 16:10:00 +0000 2020
>Closed-Date: Sun Jul 05 13:50:08 +0000 2026
>Last-Modified: Sun Jul 05 13:50:08 +0000 2026
>Originator: guest01
>Release: 9.0_RC2
>Organization:
-
>Environment:
amd64
>Description:
When you try to install NetBSD on laptop and you are in sysinst, suddenly green message
[ 31.9565180] acpibat0: normal capacity on 'charge state'
is displayed and covers a text.
Sorry, I don't answer emails. You can close the report if it is useless.
>How-To-Repeat:
1 Boot computer with system installation disk
2 Select Install NetBSD
3 Wait for screen with Keyboard type selection
4 Do nothing, just wait. After a moment, in the place of a: option
there will be dispayed a message:
[ 31.9565180] acpibat0: normal capacity on 'charge state'
>Fix:
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: install-manager->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Tue, 04 Feb 2020 16:16:53 +0000
Responsible-Changed-Why:
Will fix
From: Andreas Gustafsson <gson@gson.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: install/54932: A green message overwrite part of screen in sysinst on laptop
Date: Sun, 7 Jun 2026 14:40:48 +0300
Kernel messages messing up the sysinst output is still an issue.
For example, while trying to install NetBSD-current/evbmips-mips64eb
(source date 2026.03.01.20.46.00) on an erlite3, the following output
appeared:
Ok, we are no[ 32.7006732] dk1 at sd0 (octeon-root) deleted
w ready to insta[ 32.7116867] dk1: detached
ll NetBSD on your hard disk (sd0)
Aside from giving new users a bad first impression, this also makes it
harder to automate installs.
Sysinst already intercepts kernel messages using TIOCCONS, but only while
running external commands. It should intercept them at all times.
--
Andreas Gustafsson, gson@gson.org
From: Andreas Gustafsson <gson@gson.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: install/54932: A green message overwrite part of screen in sysinst on laptop
Date: Sat, 27 Jun 2026 15:07:20 +0300
A few weeks ago, I wrote:
> Sysinst already intercepts kernel messages using TIOCCONS, but only while
> running external commands. It should intercept them at all times.
I propose the following patch.
Index: src/usr.sbin/sysinst/defs.h
===================================================================
RCS file: /cvsroot/src/usr.sbin/sysinst/defs.h,v
retrieving revision 1.95
diff -u -r1.95 defs.h
--- src/usr.sbin/sysinst/defs.h 26 Apr 2026 13:31:47 -0000 1.95
+++ src/usr.sbin/sysinst/defs.h 15 Jun 2026 16:21:19 -0000
@@ -919,6 +919,8 @@
struct disk_partitions*);
void free_install_desc(struct install_partition_desc*);
bool may_swap_if_not_sdmmc(const char*);
+void redirect_console(int, int);
+void discard_console_output(void);
/* from target.c */
#if defined(DEBUG) || defined(DEBUG_ROOT)
Index: src/usr.sbin/sysinst/main.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/sysinst/main.c,v
retrieving revision 1.36
diff -u -r1.36 main.c
--- src/usr.sbin/sysinst/main.c 26 Apr 2026 13:31:47 -0000 1.36
+++ src/usr.sbin/sysinst/main.c 15 Jun 2026 16:21:19 -0000
@@ -274,6 +274,9 @@
no_https = 1;
}
+ /* Prevent kernel conole messages from messing up the display */
+ discard_console_output();
+
/* initialize message window */
if (menu_init()) {
__menu_initerror();
Index: src/usr.sbin/sysinst/run.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/sysinst/run.c,v
retrieving revision 1.16
diff -u -r1.16 run.c
--- src/usr.sbin/sysinst/run.c 4 Oct 2024 15:11:09 -0000 1.16
+++ src/usr.sbin/sysinst/run.c 15 Jun 2026 16:21:19 -0000
@@ -419,7 +419,6 @@
char *cp, *ncp;
struct termios rtt, tt;
struct timeval tmo;
- static int do_tioccons = 2;
(void)tcgetattr(STDIN_FILENO, &tt);
if (openpty(&master, &slave, NULL, &tt, win) == -1) {
@@ -433,20 +432,7 @@
ttysig_ignore = 1;
ioctl(master, TIOCPKT, &ttysig_ignore);
- /* Try to get console output into our pipe */
- if (do_tioccons) {
- if (ioctl(slave, TIOCCONS, &do_tioccons) == 0
- && do_tioccons == 2) {
- /* test our output - we don't want it grabbed */
- write(1, " \b", 2);
- ioctl(master, FIONREAD, &do_tioccons);
- if (do_tioccons != 0) {
- do_tioccons = 0;
- ioctl(slave, TIOCCONS, &do_tioccons);
- } else
- do_tioccons = 1;
- }
- }
+ redirect_console(master, slave);
if (logfp)
fflush(logfp);
@@ -589,6 +575,7 @@
}
close(master);
close(slave);
+ discard_console_output();
if (logfp)
fflush(logfp);
Index: src/usr.sbin/sysinst/util.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/sysinst/util.c,v
retrieving revision 1.78
diff -u -r1.78 util.c
--- src/usr.sbin/sysinst/util.c 5 Aug 2025 14:52:43 -0000 1.78
+++ src/usr.sbin/sysinst/util.c 15 Jun 2026 16:21:20 -0000
@@ -193,6 +193,8 @@
programs available on install media */
int have_raid, have_vnd, have_cgd, have_lvm, have_gpt, have_dk;
+int console_tty = -1; /* tty where console is currently redirected */
+
/*
* local prototypes
*/
@@ -2682,3 +2684,48 @@
return strncmp(parent, "sdmmc", 5) != 0;
}
#endif
+
+/*
+ * Redirect console output to the pty associated with master/slave
+ */
+void
+redirect_console(int master, int slave) {
+ static int do_tioccons = 2;
+ /* Try to get console output into our pipe */
+ if (do_tioccons) {
+ /* Turn off any existing console redirection */
+ if (console_tty != -1) {
+ int off = 0;
+ ioctl(console_tty, TIOCCONS, &off);
+ console_tty = -1;
+ }
+ if (ioctl(slave, TIOCCONS, &do_tioccons) == 0) {
+ console_tty = slave;
+ if (do_tioccons == 2) {
+ /* test our output - we don't want it grabbed */
+ write(1, " \b", 2);
+ ioctl(master, FIONREAD, &do_tioccons);
+ if (do_tioccons != 0) {
+ do_tioccons = 0;
+ ioctl(slave, TIOCCONS, &do_tioccons);
+ console_tty = -1;
+ } else
+ do_tioccons = 1;
+ }
+ }
+ }
+}
+
+/*
+ * Redirect console output to nowhere
+ */
+void
+discard_console_output(void) {
+ static int master = -1, slave = -1;
+ if (slave == -1)
+ /* Return value ignored */
+ openpty(&master, &slave, NULL, NULL, NULL);
+ if (slave == -1)
+ return;
+ redirect_console(master, slave);
+}
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: install/54932: A green message overwrite part of screen in
sysinst on laptop
Date: Sat, 27 Jun 2026 15:21:42 +0200
On Sat, Jun 27, 2026 at 12:10:02PM +0000, Andreas Gustafsson via gnats wrote:
> I propose the following patch.
Looks good to me (but I can not easily test right now).
Please feel free to commit + request pullup to -11.
Martin
From: "Andreas Gustafsson" <gson@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/54932 CVS commit: src/usr.sbin/sysinst
Date: Sun, 28 Jun 2026 11:03:14 +0000
Module Name: src
Committed By: gson
Date: Sun Jun 28 11:03:14 UTC 2026
Modified Files:
src/usr.sbin/sysinst: defs.h main.c run.c util.c
Log Message:
Make sysinst intercept kernel console messages using TIOCCONS at all
times, not just when running an external command, and discard those
that occur when not running an external command so that they don't
mess up the display when running sysinst on the console. Fixes
PR install/54932.
To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/sysinst/main.c
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/sysinst/run.c
cvs rdiff -u -r1.84 -r1.85 src/usr.sbin/sysinst/util.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/54932 CVS commit: [netbsd-11] src/usr.sbin/sysinst
Date: Sun, 5 Jul 2026 13:35:35 +0000
Module Name: src
Committed By: martin
Date: Sun Jul 5 13:35:35 UTC 2026
Modified Files:
src/usr.sbin/sysinst [netbsd-11]: defs.h main.c run.c util.c
Log Message:
Pull up following revision(s) (requested by gson in ticket #371):
usr.sbin/sysinst/run.c: revision 1.17
usr.sbin/sysinst/defs.h: revision 1.98
usr.sbin/sysinst/util.c: revision 1.85
usr.sbin/sysinst/main.c: revision 1.39
Make sysinst intercept kernel console messages using TIOCCONS at all
times, not just when running an external command, and discard those
that occur when not running an external command so that they don't
mess up the display when running sysinst on the console. Fixes
PR install/54932.
To generate a diff of this commit:
cvs rdiff -u -r1.94.2.2 -r1.94.2.3 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.34.2.2 -r1.34.2.3 src/usr.sbin/sysinst/main.c
cvs rdiff -u -r1.16 -r1.16.2.1 src/usr.sbin/sysinst/run.c
cvs rdiff -u -r1.77.4.5 -r1.77.4.6 src/usr.sbin/sysinst/util.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: gson@NetBSD.org
State-Changed-When: Sun, 05 Jul 2026 13:50:08 +0000
State-Changed-Why:
Fixed and pulled up to -11.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.