The problem Link to heading
When I run a Linux VM it runs full screen yet I never access it from the console, always via SSH. Why does it run full screen? because of a quirk with VMWare on MacOS the VM window needs to be open for it to work and running it full screen keeps it out of the way because MacOS puts it on it’s own “space” (virtual desktop). I know one option is to hide the windows but that’s not compatible with my workflow.
I wanted to do something very simple; run btop automatically on the console screen (TTY). That way I can just swipe right and get some useful information instead of a useless login prompt.
This is such a simple thing to do on Linux/Unix that it’s not worthy of a blog post - you just edit /etc/inittab and…
File not found! They seem to have changed how you configure TTYs on Debian and probably every other Linux flavour during the great move to systemd about 10-15 years ago.
I read the manual so you don’t have to.
My solution Link to heading
All of the below was done on Debian 13.5, logged in a root so hence no “sudo”
First we need to create an “override” for the TTY1 config.
systemctl edit getty@tty1.service
This will open your default editor, allowing you to enter the following in-between the hashes as explained in the file:
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin UserNameHere --noclear %I $TERM
After you save the file you should see a success response similar to this:
Successfully installed edited file '/etc/systemd/system/getty@tty1.service.d/override.conf'.
Next add the following to the ~/.bash_profile (not the .bashrc) of the user (i.e. whatever you put in for UserNameHere above):
if [ "$(tty)" = "/dev/tty1" ]; then
exec btop
fi
Finally, reload everything.
systemctl daemon-reload
systemctl restart getty@tty1.service
How this works Link to heading
We override the default configuration of TTY1 and get it to automatically login a user. That same user’s bash profile says to run btop if the current terminal is TTY1.
You can still access the console and login there if you need to. When Linux boots up it spawns a number of local TTYs. TTY1 is the first and what we’ve changed here. But TTY2-8 are still login screens because we didn’t change them. To access them use “Command” or “Alt” + F2-8.
There could be a much cleaner way to do this but I really don’t care - it’s just a VM for testing stuff.
P.S. In case you don’t realise - this method is not security conscious and really only suitable for a personal VM on your computer. Please don’t do this on a cloud VM.