I'm kinda obsessed with serial (UART) CLI interaction with Linux hosts lately.
To access a Raspberry Pi 4 running Home Assistant OS:
Mount the first partition on its SD card. Add
dtoverlay=uart2
to the [pi4] section in config.txt there, and
console=ttyAMA2,115200
to the kernel command line in cmdline.txt.
Then, connect 3v3 UART on GPIO0 (Pi's TX) and GPIO1 (Pi's RX), Ground on Pin 25 or 30 (see https://pinout.xyz/pinout/uart), and reboot.
Login: root, no password.
Note that on a Raspberry Pi 5, things are different, I haven't researched any of that.
The Pi 4 usually has its Bluetooth adapter running on UART0, and UART1 is a limited "mini UART", which is why we need to move the serial console over to UART2.
See https://www.raspberrypi.com/documentation/computers/configuration.html#uarts for the technical details.
https://contributors.home-assistant.io/os/operating-system/raspberry-pi/#serial-console also has instructions by the HAOS team, but they unnecessarily disable Bluetooth instead of just using UART2.
#HomeAssistant
Raspberry Pi