In my warmup for #OldComputerChallenge 25, I dusted off ol' pal #RaspberryPi model B and burned #NetBSD 10 on an SD card to set it up.

It all went well (slow, but hey) but one thing that I still can't get around (that I didn't experience so much last time I tried it) is the console. Control chars get printed instead of arrow and home/end keys, no colors, etc. Hate to say it, but all in all, it feels backwards compared to a modern, full-fledged console environment of #FreeBSD or Linux. And it's starting to wear me out.

But I have a feeling that this is somehow my fault for not configuring the console properly or using the right output or something. I never had to deal with this before, so anybody knows how I can configure this so I can have a modern env in NetBSD?

#unix #askunix

@kzimmermann hey there! don't worry, give the beautiful NetBSD some time to click! :) you see, it is possible that NetBSD striving to be ultra portable, doesn't want to make any assumptions on what type of terminal you have connected into it! Try to type the command stty echoe echok . that should fix your linekill and delete characters. then you can make sure your TERM variable is set to something recognizable. try to start by export TERM=vt100 (also https://www.netbsd.org/docs/guide/en/chap-cons.html) :)
Chapter 8. Console drivers

@dsp hey, good point! For maximum compatibility, it's probably bottom-leveling everything. I'll try these again when I'm back.
@kzimmermann Depends what shell you picked. If sh, try set -o emacs

@kzimmermann Huh. I work from wscons quite a bit and it's great.

Are you using a serial console or wscons (eg: keyboard and monitor plugged directly into the pi)?

@overeducatedredneck yes, through HDMI port.

I figure this is a configuration issue. I just don't know what to look for and configure

@kzimmermann What happens when you use the second VT? Eg, hit ctrl-alt-F2 and log in there. (IIRC, the console VT gets put in VT100 mode, and the 2nd, 3rd and 4th consoles get the full wscons terminal definition. So, the second VT might work better. Also, the kernel won't log to it.)
@overeducatedredneck interestingly, I don't get a login prompt anywhere beyond tty1. But it did crash the system because the keyboard stopped responding afterwards... might try again after rebooting?

@kzimmermann The wscons defaults might also be different for 32 bit ARM platforms. Most of my experience with it is with x86_64.

Check your /etc/wscons.conf file, specifically for the `screens` section. Also, your /etc/ttys file. (And, of course, the man pages for both of those)

wscons.conf will tell you how many and which VTs are created (screen lines). ttys has the value for the TERM environment used on each one, with wsvt25 being the more featureful setting.

@overeducatedredneck OK, I think we're getting there... I edited /etc/ttys and was able to get HOME/END keys working, as well as colors.

But only as the root user. When I log in as normal user, control characters keep spilling when I press those special keys, which makes working on the shell super frustrating. :( I'm thinking it has to do with the shell initialization files or ENV settings?

@kzimmermann what does `echo $TERM` report as a normal user vs root user?
@overeducatedredneck OK, I figured it, I think. Changing to a real shell (tcsh instead of builtin /bin/csh) and correctly initiating env variables seemed to correct most things. The only remaining peeve seems to be that now Del does the same as Backspace. But I believe that's something to tinker further with the cshrc file. Thanks for the tips!

@kzimmermann oh right. DEC used ^H for backspace on the VT100 and switched to ^? for the VT220. Most all graphical terminal emulators follow the VT220, so most tools expect VT220 behavior. I'm pretty sure wscons is one of the VT100 holdouts.

I suggest using ed(1) to add an stty command to your shell rc:

ed .cshrc
$a
stty erase <ctrl-v><backspace>
.
w
q

@kzimmermann

What does "control chars get printed" mean?

Because it could be two different things with two very different adjustments to make.

If it means control characters actually being printed as glyphs on the screen, taking it at face value, that's a /etc/wscons.conf and screen emulation settings thing; but if it is line editing not working then that's a TERM=netbsd6 and /etc/ttys affair.

#NetBSD #wscons #terminfo