This is a cross-post from RPi. I wrote a series of bash functions to allow me to switch between Raspbian, kodi, and emulationstation so that I could use Siri/homebridge to initiate the switch. Switching works all pretty well. The only problem is that stopping any of the OSs without starting another one leaves the console’s connection to VT1 in some sort of weird state. All I see is a black screen.
I can manually fix this using either alt+F1 or by executing
sudo chvt 2;sudo chvt 1 to reinitialize VT1, but I would prefer to avoid this bad state entirely. I assume that this is happening as a side-effect using pkill to stop the OSs. E.g.
pkill emulationstatio;pkill xinit;pkill kodi;.
I could add
sudo chvt 2;sudo chvt 1 to my stop functions, but I’d rather not since I don’t know in that function whether another OS is starting or going to start.
So how can I cleanly stop kodi/emulationstation/raspbian so that VT 1 is left in a good state so that I can see the console after the OS has stopped?
BTW, this is on a raspberry pi. I have been testing via ssh and watching the results on the hdmi-connected TV from the couch.