5 Replies Latest reply on Jun 6, 2018 10:35 PM by waelect

    Running Headless from GUI




      I am fairly new to Raspberry Pi and have been working on a project for a while using GUI. I am now finished the GUI learning process but without starting from scratch is it possible to change to headless operation from the current GUI format with minimal fuss.


      Is there a link to describe this or do I have to start fresh?


      Starting fresh I can do but trying to short cut the exercise. I have a RPi 3





        • Re: Running Headless from GUI

          Hi Malcolm,


          If you mean the GUI needs to run on a remote machine, there are a few ways if you don't want to change your existing app, for example by running an X server, or using some remote desktop software such as VNC or Windows Remote Desktop (the latter is described here: Accessing and Controlling the Pi  ). If the GUI runs as a browser based app then that can be accessed remotely too.

          If you mean running the app remotely without any remote display either, i.e. no GUI at all, then that's not normally possible unless the app provides for a way to interface using (say) command line (CLI) or some other interface, serial or HTTP for example. If it is an app for which you have the source code, you could try to add to it, to enable (say) a command line interface to it too.

          One example is (say) you've written some code to flash some lights according to a pattern selected via a GUI. If you add a command line parameter, then when the application runs, it can check if the parameter is there, and not invoke the GUI in that case, but take its input from the command line instead. The parameter could be (say) the sequence of lights that need flashing, e.g.

          myledprog --sequence 111222112212123

          or (say)

          myledprog --seqfile pattern1.txt


          Depending on the language your program is written it, it could be easy to check for parameters when the program is called. In C it is straightforward for instance.

          Anyway, this is just an idea.. as mentioned, I'm not sure if you meant you still wished the GUI to run but on a remote screen.

          1 of 1 people found this helpful
            • Re: Running Headless from GUI

              Mostly i want to test the power consumption difference removing the GUI. Fortunately most of the application should work without the GUI running. Anyway VNC Server is easy to use, I have no problems using that but each GUI operation draws more power from the system and I need to reduce power consumption as much as possible.


              All the apps are Python based and can work on a headless system. I just don't want to completely re-install and re-configure a lite system.

              1 of 1 people found this helpful
                • Re: Running Headless from GUI

                  Hi Malcolm,


                  You can try by brutally removing all the X11 components from the system, that would definitely remove all the GUI components. You just need to make sure none of your applications use any X11 library, otherwise they will fail (even if they don't use graphics, sometimes applications use X11 functions for other reasons... it is bad practice but it happens)


                  To uninstall, just issue:


                  sudo apt-get remove --purge x11-*
                  sudo apt-get autoremove


                  I hope it helps.



                  1 of 1 people found this helpful
              • Re: Running Headless from GUI

                Depending on the OS that you are running on the RasPi, but if you are running Raspbian you can use 'raspi-config' to disable boot to gui/desktop.


                3 of 3 people found this helpful