2023-12-23 Console

I've been trying to get used to Sway as my window manager. Recently I realized that my `dmenu` wouldn't list games like `openarena`. No surprise there: `/usr/games/bin` is not part of `PATH` and so it doesn't get shown. I wondered how to get it there, and then I found that many people log in from the Linux console without a session manager or display manager. That is, they login from the console, get a login shell, and that shell then starts the window manager.

Sway as my window manager

This is what I see on the first virtual console:

Debian GNU/Linux 12 melanobombus tty1

login: _

If I log in, `fish` starts and one of the startup files it executes is `.config/fish/conf.d/sway.fish` which starts `sway` but only when logging in from `tty1`. You can switch between the consoles using Alt-F1 to Alt-F6. Once `sway` runs, you can switch back to the remaining virtual consoles using Ctrl Alt F2 to Ctrl Alt F6.

# If running from tty1 start sway
set TTY1 (tty)
[ "$TTY1" = "/dev/tty1" ] && exec sway

Since this script uses `exec`, `sway` replaces `fish`. No big deal. But I still get to setup PATH.

So now I was staring at the login prompt of the console… and I don't know about you, but I could use a larger font!

I tried to go the `console-setup` route but that doesn't help:

sudo dpkg-reconfigure console-setup

This allows me to change the console font.

And once my script runs, I can repeat that:

setupcon

But at that point I'm already logged in!

In theory, there's a systemd service that is supposed to handle it:

$ systemctl status console-setup
● console-setup.service - Set console font and keymap
     Loaded: loaded (/lib/systemd/system/console-setup.service; enabled; preset: enabled)
     Active: active (exited) since Sat 2023-12-23 14:45:03 CET; 18min ago
    Process: 496 ExecStart=/lib/console-setup/console-setup.sh (code=exited, status=0/SUCCESS)
   Main PID: 496 (code=exited, status=0/SUCCESS)
        CPU: 3ms

And yet… it does not! Why is that? Examining `/lib/systemd/system/console-setup.service` I find that it runs `/lib/console-setup/console-setup.sh` and that does some complicated stuff to try and determine whether to run `setupcon` or not. I guess in my case doesn't?

Oh well, there's always the option of using kernel parameters!

I created a one line file called `/etc/default/grub.d/font.cfg` to set a console font. This way the default setting in `/etc/default/grub` is overwritten, too. No more `quiet splash`! I like to see the output scroll by as the system boots.

GRUB_CMDLINE_LINUX_DEFAULT="fbcon=font:TER16x32"

To activate it:

sudo dpkg-reconfigure grub2

Rebooting the system, I noticed that things still didn't seem to work for the `initramfs` which ends up asking me for the password to decrypt my disk. So what I needed was to get the new config into the `initramfs`, too.

Based on the current kernel I'm running:

sudo dpkg-reconfigure linux-image-6.1.0-15-amd64

I think it works, now!

​#Administration

@landley@mstdn.jp had some pointers:

Ramfs, rootfs and initramfs

The problem. (Why "root=" doesn't scale.)

Tech Tip: How to use initramfs.

Programming for Initramfs.

mkroot

mkroot walkthrough