Starting graphical session on demand reddit / selfhosted ---------------------------------------------------------------------- Zealousideal_Cook704 · 2023-10-19 14:37 *(Sorry for the incredibly noob question. I'm trying to figure what is possible before buying some parts, which is why I'm asking instead of just trying it out myself.)* I am planning to make a server out of a few old PC parts. I'll mostly be using it for two purposes: (1) Serving media, cloud storage and a few other services to my devices. (2) As a media center for a home cinema setup. Of course, since (1) implies it will be running 24/7, I'm trying to be mindful about power consumption. One of the ways I've planned to do that is by keeping the setup headless until I actually want to use it as in (2), when I'd like to be able to launch a graphical session (for the sake of the argument, let's say in Ubuntu). Now my question is: is there any way to launch an X session (again, simplicity, let's say I plug in a keyboard and type a command) and exit it without needing to restart the server? For example, if someone else is using the server to watch something in their own laptop, I wouldn't want to restart the server just to watch something in the home cinema. My intuition tells me that simply running startx should not kill the existent session, is this correct? ---------------------------------------------------------------------- thekrautboy · 2023-10-19 14:43 Why not do it the simple way and keep the X session running when you dont play any media and you disconnect the kb/m? I dont think you will notice any *real* difference in total power consumption between X run or not. Your CPU/GPU go to "sleep" regardless. But of course you could probably do a very basic script that checks when a specific USB HID (for example your keyboard) gets connected, then checks if a X session is already running, if it is, do nothing, if it isnt then start a X session. And upon disconnect of that specific USB HID, close any existing X sessions. I figure thats not too hard to do, maybe even some tool like "when USB connected run something" tool already exists. Maybe ask /r/LinuxQuestions for example. ---------------------------------------------------------------------- Zealousideal_Cook704 · 2023-10-19 14:54 Huh, fair enough. I just \*assumed\* it would entail some cost, since most servers are headless. Yes, the specific "how to do that" is not much of a problem (the keyboard will always be connected, i can just make a key combo that launches a X session). My question is more "will launching an X session kill the headless session?". ---------------------------------------------------------------------- XeliteXirish · 2023-10-19 15:31 Why don't you just use plex for 2? Then keep the server always headless and the power consumption will be minimal? ---------------------------------------------------------------------- Zealousideal_Cook704 · 2023-10-19 16:01 I don't think I understand what you mean by plex for 2. ---------------------------------------------------------------------- BeYeCursed100Fold · 2023-10-19 18:24 From your post: >(2) a media center ---------------------------------------------------------------------- Zealousideal_Cook704 · 2023-10-19 19:02 I don't think this addresses my question in any way. ---------------------------------------------------------------------- BeYeCursed100Fold · 2023-10-19 19:21 Plex is headless. You install it via cli, configure it via a web service in a browser, and watch your movies/shows via apps on devices (roku, appletv, androidtv, etc.). The person you originally replied to scoped their response to your point 2. You seemed confused by what 2 meant, I clarified. As someone else said, just keep x running or use the "startx" command to start X as needed. ---------------------------------------------------------------------- XeliteXirish · 2023-10-19 21:17 Plex or Jellyfin can act as your media server and stream direct to your TV. No need to have a graphical interface running on the server at all. Also has the benefit of being able to access the content anywhere. ---------------------------------------------------------------------- Zealousideal_Cook704 · 2023-10-20 05:09 Yes, I know this, but this not relevant to my question. I don't have a TV, the server *is* the playing device. ---------------------------------------------------------------------- Zealousideal_Cook704 · 2023-10-20 05:13 Thank you, this solves my question!