Possible to change resolution of tty1-6? laptop's non-GUI TTYs?

I’m stuck with a touchscreen I can’t control so in the meantime have made due by switching to a tty via Ctrl+Alt+F2 (“raw tty”? “serial tty”? IDK what these are called).

Question: how do I change the resolution of this kind of tty? (Even if requires reboot/rebuild, it’s fine). That is: tput lines; tput cols shows 42 and 135. While the TTY lets me escape the GUI (and this buggy touch display) it’s frustrating fitting so little content on the screen. This is a 13.0" 2K (2160 x 1350) display after all. Is there any way for me to set a new column/row pair? Or do something else to increase these TTYs’ screen usage?

I’ve searched the web but don’t see references to how to change it (only reference to how to read the current settings). I tried doubling resolution by running stty rows 84 cola 270 but it doesn’t work:

  • run regularly (as my own user) I get the error stty: 'standard input': invalid argument
  • run elevated via sudo I get no output and no error-exit, yet nothing changes.

Also no luck doing both similarly with stty’s --file flag given /dev/tty3 (or whatever path readlink -f /dev/stdin reports).

This is the linux console virtual terminal. In most cases on modern hardware it’s a graphical terminal emulator, and drives the display at its recommended resolution, using a font with x × y pixel size that ends up determining the tty dimensions for lines and rows that you’re looking at.

You can set some options, the first one you probably want to look at is console.font

2 Likes

This is the linux console virtual terminal.

Thanks for that! From that I’ve now found both “virtual console” and “virtual terminal” appear to mean this; that is: not the terminal emulation in a GUI (eg: rxvt) but one of Linux’s 6 non-GUI TTYs: Virtual console - Wikipedia (interesting page on FreeBSD’s version of this also using th term “virtual console”)

You can set some options, the first one you probably want to look at is console.font

Perfect thanks again! That lead me to the solution: run setfont against /etc/kbd/consolefonts basenames. Found that via more pointed searches of other forum posts with your help. Here’s the quick “fix it now” solution: was ter-912n.psf.gz or ter-d18n.psf.gz made the screen usable again (can’t recall which):

# list values that are a valid arg to the _next_ command
$ find -L /etc/kbd/consolefonts -type f -name '*.gz' -printf '%P\n' | sort
# nixos-robust alternative to listing an actual file
# https://discourse.nixos.org/t/need-help-setting-tty-font/16295/9

$ sudo setfont "$font_gz"
# example
$ sudo setfont ter-d18n.psf.gz

and of course that came from a bunch of much more nix-robust solutions, as well as long-term (ie: save in your config) solutions:

2 Likes

Great, I’m glad you found your answer and suspected it was just a matter of the right concepts and search terms.

Yes. The ‘virtual’ part seems to mostly refer to the idea that you can switch between multiple ‘real’ kernel terminal devices (/dev/tty…) on the one physical console, rather than the ‘terminal emulation’ aspect (which would be the case even for a console locked to a single session).

Software terminal emulators in a GUI use ‘pseudo’ terminal devices (/dev/pty…). The distinction between all of these is more blurred than it used to be; even a ‘real’ terminal on a physical serial port is more than likely to be another computer running an emulator application, rather than a dedicated embedded system running a terminal application. You can also run a userspace graphical terminal program on the linux framebuffer without the rest of a gui framework (X or Wayland); these usually have fancier capabilities because there’s at least some incentive to have a simpler implementation for the in-kernel emulator.

The major difference is that the kernel can use a ‘real’ tty for its own io, panic outputs, and very-early-stage recovery (such as before any filesystems are mounted and enough process tree exists to start one of the userspace emulators). This is the distinction that usually matters between ‘terminal’ and ‘console’.