Can't start GUI programs via command line due to wrong DISPLAY variable












4















I am using Ubuntu 18.10 and I cannot launch GUI programs via the command line. This applies to subl (for Sublime Text) and Firefox. When trying to start Firefox via CLI; it prints: Invalid MIT-MAGIC-COOKIE-1 key.



My environment shows:



➜ echo $DISPLAY
:0.0


And I do have a file with that cookie:



➜ echo $XAUTHORITY 
/run/user/1000/gdm/Xauthority
➜ cat /run/user/1000/gdm/Xauthority
voltaireMIT-MAGIC-COOKIE-1OZ��8�ص������v�voltaireMIT-MAGIC-COOKIE-1OZ��8�ص������v%


Also:



➜ xauth list
voltaire/unix: MIT-MAGIC-COOKIE-1 4f5abfd438eb88d8b586f0fbad8aee76
#ffff#766f6c7461697265#: MIT-MAGIC-COOKIE-1 4f5abfd438eb88d8b586f0fbad8aee76


It seems that two Xorg processes are running:



➜ ps aux | grep xorg
root 1400 0.0 0.1 213748 48068 tty1 Sl+ 09:29 0:00 /usr/lib/xorg/Xorg vt1 -displayfd 3 -auth /run/user/121/gdm/Xauthority -background none -noreset -keeptty -verbose 7 -core
root 4701 1.9 0.5 658612 195732 tty2 Sl+ 09:30 1:50 /usr/lib/xorg/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -background none -noreset -keeptty -verbose 7 -core


I previously had lightdm installed to fix a login issue, and I have the current NVIDIA graphics drivers installed on my system. I guess this is very much related?



When I run:



DISPLAY=:1 subl


it works!



What could I do to fix this?





Update



I deleted ~/.Xauthority and rebooted, but the problem still remains.










share|improve this question





























    4















    I am using Ubuntu 18.10 and I cannot launch GUI programs via the command line. This applies to subl (for Sublime Text) and Firefox. When trying to start Firefox via CLI; it prints: Invalid MIT-MAGIC-COOKIE-1 key.



    My environment shows:



    ➜ echo $DISPLAY
    :0.0


    And I do have a file with that cookie:



    ➜ echo $XAUTHORITY 
    /run/user/1000/gdm/Xauthority
    ➜ cat /run/user/1000/gdm/Xauthority
    voltaireMIT-MAGIC-COOKIE-1OZ��8�ص������v�voltaireMIT-MAGIC-COOKIE-1OZ��8�ص������v%


    Also:



    ➜ xauth list
    voltaire/unix: MIT-MAGIC-COOKIE-1 4f5abfd438eb88d8b586f0fbad8aee76
    #ffff#766f6c7461697265#: MIT-MAGIC-COOKIE-1 4f5abfd438eb88d8b586f0fbad8aee76


    It seems that two Xorg processes are running:



    ➜ ps aux | grep xorg
    root 1400 0.0 0.1 213748 48068 tty1 Sl+ 09:29 0:00 /usr/lib/xorg/Xorg vt1 -displayfd 3 -auth /run/user/121/gdm/Xauthority -background none -noreset -keeptty -verbose 7 -core
    root 4701 1.9 0.5 658612 195732 tty2 Sl+ 09:30 1:50 /usr/lib/xorg/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -background none -noreset -keeptty -verbose 7 -core


    I previously had lightdm installed to fix a login issue, and I have the current NVIDIA graphics drivers installed on my system. I guess this is very much related?



    When I run:



    DISPLAY=:1 subl


    it works!



    What could I do to fix this?





    Update



    I deleted ~/.Xauthority and rebooted, but the problem still remains.










    share|improve this question



























      4












      4








      4








      I am using Ubuntu 18.10 and I cannot launch GUI programs via the command line. This applies to subl (for Sublime Text) and Firefox. When trying to start Firefox via CLI; it prints: Invalid MIT-MAGIC-COOKIE-1 key.



      My environment shows:



      ➜ echo $DISPLAY
      :0.0


      And I do have a file with that cookie:



      ➜ echo $XAUTHORITY 
      /run/user/1000/gdm/Xauthority
      ➜ cat /run/user/1000/gdm/Xauthority
      voltaireMIT-MAGIC-COOKIE-1OZ��8�ص������v�voltaireMIT-MAGIC-COOKIE-1OZ��8�ص������v%


      Also:



      ➜ xauth list
      voltaire/unix: MIT-MAGIC-COOKIE-1 4f5abfd438eb88d8b586f0fbad8aee76
      #ffff#766f6c7461697265#: MIT-MAGIC-COOKIE-1 4f5abfd438eb88d8b586f0fbad8aee76


      It seems that two Xorg processes are running:



      ➜ ps aux | grep xorg
      root 1400 0.0 0.1 213748 48068 tty1 Sl+ 09:29 0:00 /usr/lib/xorg/Xorg vt1 -displayfd 3 -auth /run/user/121/gdm/Xauthority -background none -noreset -keeptty -verbose 7 -core
      root 4701 1.9 0.5 658612 195732 tty2 Sl+ 09:30 1:50 /usr/lib/xorg/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -background none -noreset -keeptty -verbose 7 -core


      I previously had lightdm installed to fix a login issue, and I have the current NVIDIA graphics drivers installed on my system. I guess this is very much related?



      When I run:



      DISPLAY=:1 subl


      it works!



      What could I do to fix this?





      Update



      I deleted ~/.Xauthority and rebooted, but the problem still remains.










      share|improve this question
















      I am using Ubuntu 18.10 and I cannot launch GUI programs via the command line. This applies to subl (for Sublime Text) and Firefox. When trying to start Firefox via CLI; it prints: Invalid MIT-MAGIC-COOKIE-1 key.



      My environment shows:



      ➜ echo $DISPLAY
      :0.0


      And I do have a file with that cookie:



      ➜ echo $XAUTHORITY 
      /run/user/1000/gdm/Xauthority
      ➜ cat /run/user/1000/gdm/Xauthority
      voltaireMIT-MAGIC-COOKIE-1OZ��8�ص������v�voltaireMIT-MAGIC-COOKIE-1OZ��8�ص������v%


      Also:



      ➜ xauth list
      voltaire/unix: MIT-MAGIC-COOKIE-1 4f5abfd438eb88d8b586f0fbad8aee76
      #ffff#766f6c7461697265#: MIT-MAGIC-COOKIE-1 4f5abfd438eb88d8b586f0fbad8aee76


      It seems that two Xorg processes are running:



      ➜ ps aux | grep xorg
      root 1400 0.0 0.1 213748 48068 tty1 Sl+ 09:29 0:00 /usr/lib/xorg/Xorg vt1 -displayfd 3 -auth /run/user/121/gdm/Xauthority -background none -noreset -keeptty -verbose 7 -core
      root 4701 1.9 0.5 658612 195732 tty2 Sl+ 09:30 1:50 /usr/lib/xorg/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -background none -noreset -keeptty -verbose 7 -core


      I previously had lightdm installed to fix a login issue, and I have the current NVIDIA graphics drivers installed on my system. I guess this is very much related?



      When I run:



      DISPLAY=:1 subl


      it works!



      What could I do to fix this?





      Update



      I deleted ~/.Xauthority and rebooted, but the problem still remains.







      command-line xorg display-manager






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 3 at 11:50







      slhck

















      asked Jan 3 at 9:27









      slhckslhck

      724629




      724629






















          1 Answer
          1






          active

          oldest

          votes


















          2














          The issue was that DISPLAY was incorrectly set to :0.0 by a shell configuration file. Once I removed that, launching programs from the shell was possible again.



          You can use this command to search through all the default shell configuration files:



          grep "DISPLAY" ~/.bashrc ~/.profile ~/.bash_profile ~/bash.login 
          ~/.bash_aliases /etc/bash.bashrc /etc/profile
          /etc/profile.d/* /etc/environment 2> /dev/null


          There are indeed two Xorg processes, which is expected behavior, so this should not be an issue in itself.



          Also, the .Xauthority file does not seem to be necessary.






          share|improve this answer

























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1106533%2fcant-start-gui-programs-via-command-line-due-to-wrong-display-variable%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            The issue was that DISPLAY was incorrectly set to :0.0 by a shell configuration file. Once I removed that, launching programs from the shell was possible again.



            You can use this command to search through all the default shell configuration files:



            grep "DISPLAY" ~/.bashrc ~/.profile ~/.bash_profile ~/bash.login 
            ~/.bash_aliases /etc/bash.bashrc /etc/profile
            /etc/profile.d/* /etc/environment 2> /dev/null


            There are indeed two Xorg processes, which is expected behavior, so this should not be an issue in itself.



            Also, the .Xauthority file does not seem to be necessary.






            share|improve this answer






























              2














              The issue was that DISPLAY was incorrectly set to :0.0 by a shell configuration file. Once I removed that, launching programs from the shell was possible again.



              You can use this command to search through all the default shell configuration files:



              grep "DISPLAY" ~/.bashrc ~/.profile ~/.bash_profile ~/bash.login 
              ~/.bash_aliases /etc/bash.bashrc /etc/profile
              /etc/profile.d/* /etc/environment 2> /dev/null


              There are indeed two Xorg processes, which is expected behavior, so this should not be an issue in itself.



              Also, the .Xauthority file does not seem to be necessary.






              share|improve this answer




























                2












                2








                2







                The issue was that DISPLAY was incorrectly set to :0.0 by a shell configuration file. Once I removed that, launching programs from the shell was possible again.



                You can use this command to search through all the default shell configuration files:



                grep "DISPLAY" ~/.bashrc ~/.profile ~/.bash_profile ~/bash.login 
                ~/.bash_aliases /etc/bash.bashrc /etc/profile
                /etc/profile.d/* /etc/environment 2> /dev/null


                There are indeed two Xorg processes, which is expected behavior, so this should not be an issue in itself.



                Also, the .Xauthority file does not seem to be necessary.






                share|improve this answer















                The issue was that DISPLAY was incorrectly set to :0.0 by a shell configuration file. Once I removed that, launching programs from the shell was possible again.



                You can use this command to search through all the default shell configuration files:



                grep "DISPLAY" ~/.bashrc ~/.profile ~/.bash_profile ~/bash.login 
                ~/.bash_aliases /etc/bash.bashrc /etc/profile
                /etc/profile.d/* /etc/environment 2> /dev/null


                There are indeed two Xorg processes, which is expected behavior, so this should not be an issue in itself.



                Also, the .Xauthority file does not seem to be necessary.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jan 3 at 13:38









                terdon

                65.1k12138218




                65.1k12138218










                answered Jan 3 at 12:57









                slhckslhck

                724629




                724629






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1106533%2fcant-start-gui-programs-via-command-line-due-to-wrong-display-variable%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Human spaceflight

                    Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

                    張江高科駅