Raspberry Pi bluetooth console
Sometimes you want to connect to a bluetooth on the console. Likely because you screwed something up with the network or filewall settings.
You could plug in a screen and keyboard, but that’s a hassle. And maybe you didn’t prepare the Pi to force the monitor to be on even if it’s not connected at boot. Then it just doesn’t work.
Even more of a hassle is to plug in a serial console cable into the GPIO pins.
But modern Raspberry Pi’s have bluetooth. So let’s use that!
Setting up the service on the raspberry pi
Create /etc/systemd/system/bluetooth-console.service with this content:
[Unit]
Description=Bluetooth console
After=bluetooth.service
Requires=bluetooth.service
[Service]
ExecStart=/usr/bin/rfcomm watch hci0 1 getty rfcomm0 115200 vt100
Restart=always
RestartSec=10
StartLimitIntervalSec=0
[Install]
WantedBy=multi-user.target
This sets up a console on bluetooth channel 1 with a login prompt. But
it doesn’t work yet. Apparently setting After, Required, and even
Requisite doesn’t prevent systemd from running this before setting
up bluetooth (timestamps in the logs don’t lie). Hence the restart stuff.
I also tried setting ExecStartPre / ExecStartPost there to enable
Bluetooth discoverability, since something else in the boot process
seems to turn it back off if I set it Continue reading


