Running VNC server on Ubuntu Desktop 18.04 by creating new sessions












3















I would like to create a VNC server that runs gnome-shell environment, the same as the default UI in the console, separate from the console session (so that the console cannot see anything).



I tried vnc4server and tightvncserver, neither worked. No matter how I configured xstartup, gnome-session just won't run. I did manage to run Xfdm and gnome-panel in the same way. When I try to connect to the VNC server I get only grey screen. However I can confirm that the vnc server worked because I can run programs in it by setting DISPLAY and XAUTHORITY.



Is there a way to get ubuntu-desktop running in a new X session, separate from the console session? Preferably on a VNC server?



Steps I created the vnc server:




  1. Install a completely new Ubuntu 18.04 LTS Desktop.

  2. Install tightvncserver.

  3. Run vncserver to configure and kill it.


  4. Change ~/.vnc/xstartup and append:



    export STARTUP="/usr/bin/gnome-session --session=ubuntu --disable-acceleration-check"
    $STARTUP



  5. Run vncserver.


  6. Connect to the VNC server with any VNC client. Only grey screen is shown.

  7. Configure DISPLAY and XAUTHORITY and run gedit. The VNC session sees an incomplete gedit window.










share|improve this question

























  • Do you insist on using VNC? With xpra it should be easier to get there.

    – Sebastian Stark
    May 2 '18 at 18:28











  • If it's not VNC then I'd prefer a protocol that works over a slow Internet connection, and has clients on all operating systems - Android, Windows, etc. xpra seems to forward X connections which is not what I want.

    – He WenYang
    May 2 '18 at 23:40
















3















I would like to create a VNC server that runs gnome-shell environment, the same as the default UI in the console, separate from the console session (so that the console cannot see anything).



I tried vnc4server and tightvncserver, neither worked. No matter how I configured xstartup, gnome-session just won't run. I did manage to run Xfdm and gnome-panel in the same way. When I try to connect to the VNC server I get only grey screen. However I can confirm that the vnc server worked because I can run programs in it by setting DISPLAY and XAUTHORITY.



Is there a way to get ubuntu-desktop running in a new X session, separate from the console session? Preferably on a VNC server?



Steps I created the vnc server:




  1. Install a completely new Ubuntu 18.04 LTS Desktop.

  2. Install tightvncserver.

  3. Run vncserver to configure and kill it.


  4. Change ~/.vnc/xstartup and append:



    export STARTUP="/usr/bin/gnome-session --session=ubuntu --disable-acceleration-check"
    $STARTUP



  5. Run vncserver.


  6. Connect to the VNC server with any VNC client. Only grey screen is shown.

  7. Configure DISPLAY and XAUTHORITY and run gedit. The VNC session sees an incomplete gedit window.










share|improve this question

























  • Do you insist on using VNC? With xpra it should be easier to get there.

    – Sebastian Stark
    May 2 '18 at 18:28











  • If it's not VNC then I'd prefer a protocol that works over a slow Internet connection, and has clients on all operating systems - Android, Windows, etc. xpra seems to forward X connections which is not what I want.

    – He WenYang
    May 2 '18 at 23:40














3












3








3


3






I would like to create a VNC server that runs gnome-shell environment, the same as the default UI in the console, separate from the console session (so that the console cannot see anything).



I tried vnc4server and tightvncserver, neither worked. No matter how I configured xstartup, gnome-session just won't run. I did manage to run Xfdm and gnome-panel in the same way. When I try to connect to the VNC server I get only grey screen. However I can confirm that the vnc server worked because I can run programs in it by setting DISPLAY and XAUTHORITY.



Is there a way to get ubuntu-desktop running in a new X session, separate from the console session? Preferably on a VNC server?



Steps I created the vnc server:




  1. Install a completely new Ubuntu 18.04 LTS Desktop.

  2. Install tightvncserver.

  3. Run vncserver to configure and kill it.


  4. Change ~/.vnc/xstartup and append:



    export STARTUP="/usr/bin/gnome-session --session=ubuntu --disable-acceleration-check"
    $STARTUP



  5. Run vncserver.


  6. Connect to the VNC server with any VNC client. Only grey screen is shown.

  7. Configure DISPLAY and XAUTHORITY and run gedit. The VNC session sees an incomplete gedit window.










share|improve this question
















I would like to create a VNC server that runs gnome-shell environment, the same as the default UI in the console, separate from the console session (so that the console cannot see anything).



I tried vnc4server and tightvncserver, neither worked. No matter how I configured xstartup, gnome-session just won't run. I did manage to run Xfdm and gnome-panel in the same way. When I try to connect to the VNC server I get only grey screen. However I can confirm that the vnc server worked because I can run programs in it by setting DISPLAY and XAUTHORITY.



Is there a way to get ubuntu-desktop running in a new X session, separate from the console session? Preferably on a VNC server?



Steps I created the vnc server:




  1. Install a completely new Ubuntu 18.04 LTS Desktop.

  2. Install tightvncserver.

  3. Run vncserver to configure and kill it.


  4. Change ~/.vnc/xstartup and append:



    export STARTUP="/usr/bin/gnome-session --session=ubuntu --disable-acceleration-check"
    $STARTUP



  5. Run vncserver.


  6. Connect to the VNC server with any VNC client. Only grey screen is shown.

  7. Configure DISPLAY and XAUTHORITY and run gedit. The VNC session sees an incomplete gedit window.







gnome remote-desktop vnc 18.04






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 2 '18 at 15:57







He WenYang

















asked May 2 '18 at 15:05









He WenYangHe WenYang

26115




26115













  • Do you insist on using VNC? With xpra it should be easier to get there.

    – Sebastian Stark
    May 2 '18 at 18:28











  • If it's not VNC then I'd prefer a protocol that works over a slow Internet connection, and has clients on all operating systems - Android, Windows, etc. xpra seems to forward X connections which is not what I want.

    – He WenYang
    May 2 '18 at 23:40



















  • Do you insist on using VNC? With xpra it should be easier to get there.

    – Sebastian Stark
    May 2 '18 at 18:28











  • If it's not VNC then I'd prefer a protocol that works over a slow Internet connection, and has clients on all operating systems - Android, Windows, etc. xpra seems to forward X connections which is not what I want.

    – He WenYang
    May 2 '18 at 23:40

















Do you insist on using VNC? With xpra it should be easier to get there.

– Sebastian Stark
May 2 '18 at 18:28





Do you insist on using VNC? With xpra it should be easier to get there.

– Sebastian Stark
May 2 '18 at 18:28













If it's not VNC then I'd prefer a protocol that works over a slow Internet connection, and has clients on all operating systems - Android, Windows, etc. xpra seems to forward X connections which is not what I want.

– He WenYang
May 2 '18 at 23:40





If it's not VNC then I'd prefer a protocol that works over a slow Internet connection, and has clients on all operating systems - Android, Windows, etc. xpra seems to forward X connections which is not what I want.

– He WenYang
May 2 '18 at 23:40










2 Answers
2






active

oldest

votes


















1














Finally I found the solution.



The Gnome session doesn't seem to work on VNC X servers, but an Xvfb will work.
The idea is to create an Xvfb for the session and use x11vnc for VNC:



Xvfb :1 -screen 0 1280x720x24


Then spawn GNOME environment:



DISPLAY=:1 gnome-shell --replace


Finally use x11vnc to create an VNC server for Xvfb:



x11vnc -display :1





share|improve this answer































    0














    Make sure that you unset the DBUS_SESSION_BUS_ADDRESS at the beginning of the xstartup script.



    Here is a snip of mine that have gnome-session started properly. However, the only issue so far is that the color scheme of the terminal is not properly applied, but VNC runs fine :)



    #!/bin/sh
    MODE="GNOME"
    unset DBUS_SESSION_BUS_ADDRESS
    if [ -e "$HOME/.Xresources" ]
    then
    xrdb "$HOME/.Xresources"
    fi

    if [ "GNOME" = "$MODE" ]
    then
    if which gnome-session > /dev/null
    then
    gnome-session --session=ubuntu &
    else
    MODE=""
    fi
    fi





    share|improve this answer


























    • MODE=" should be MODE="" , UN-terminated quotes. syntax error.

      – Dan
      Sep 27 '18 at 5:27











    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%2f1031147%2frunning-vnc-server-on-ubuntu-desktop-18-04-by-creating-new-sessions%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Finally I found the solution.



    The Gnome session doesn't seem to work on VNC X servers, but an Xvfb will work.
    The idea is to create an Xvfb for the session and use x11vnc for VNC:



    Xvfb :1 -screen 0 1280x720x24


    Then spawn GNOME environment:



    DISPLAY=:1 gnome-shell --replace


    Finally use x11vnc to create an VNC server for Xvfb:



    x11vnc -display :1





    share|improve this answer




























      1














      Finally I found the solution.



      The Gnome session doesn't seem to work on VNC X servers, but an Xvfb will work.
      The idea is to create an Xvfb for the session and use x11vnc for VNC:



      Xvfb :1 -screen 0 1280x720x24


      Then spawn GNOME environment:



      DISPLAY=:1 gnome-shell --replace


      Finally use x11vnc to create an VNC server for Xvfb:



      x11vnc -display :1





      share|improve this answer


























        1












        1








        1







        Finally I found the solution.



        The Gnome session doesn't seem to work on VNC X servers, but an Xvfb will work.
        The idea is to create an Xvfb for the session and use x11vnc for VNC:



        Xvfb :1 -screen 0 1280x720x24


        Then spawn GNOME environment:



        DISPLAY=:1 gnome-shell --replace


        Finally use x11vnc to create an VNC server for Xvfb:



        x11vnc -display :1





        share|improve this answer













        Finally I found the solution.



        The Gnome session doesn't seem to work on VNC X servers, but an Xvfb will work.
        The idea is to create an Xvfb for the session and use x11vnc for VNC:



        Xvfb :1 -screen 0 1280x720x24


        Then spawn GNOME environment:



        DISPLAY=:1 gnome-shell --replace


        Finally use x11vnc to create an VNC server for Xvfb:



        x11vnc -display :1






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered May 12 '18 at 12:52









        He WenYangHe WenYang

        26115




        26115

























            0














            Make sure that you unset the DBUS_SESSION_BUS_ADDRESS at the beginning of the xstartup script.



            Here is a snip of mine that have gnome-session started properly. However, the only issue so far is that the color scheme of the terminal is not properly applied, but VNC runs fine :)



            #!/bin/sh
            MODE="GNOME"
            unset DBUS_SESSION_BUS_ADDRESS
            if [ -e "$HOME/.Xresources" ]
            then
            xrdb "$HOME/.Xresources"
            fi

            if [ "GNOME" = "$MODE" ]
            then
            if which gnome-session > /dev/null
            then
            gnome-session --session=ubuntu &
            else
            MODE=""
            fi
            fi





            share|improve this answer


























            • MODE=" should be MODE="" , UN-terminated quotes. syntax error.

              – Dan
              Sep 27 '18 at 5:27
















            0














            Make sure that you unset the DBUS_SESSION_BUS_ADDRESS at the beginning of the xstartup script.



            Here is a snip of mine that have gnome-session started properly. However, the only issue so far is that the color scheme of the terminal is not properly applied, but VNC runs fine :)



            #!/bin/sh
            MODE="GNOME"
            unset DBUS_SESSION_BUS_ADDRESS
            if [ -e "$HOME/.Xresources" ]
            then
            xrdb "$HOME/.Xresources"
            fi

            if [ "GNOME" = "$MODE" ]
            then
            if which gnome-session > /dev/null
            then
            gnome-session --session=ubuntu &
            else
            MODE=""
            fi
            fi





            share|improve this answer


























            • MODE=" should be MODE="" , UN-terminated quotes. syntax error.

              – Dan
              Sep 27 '18 at 5:27














            0












            0








            0







            Make sure that you unset the DBUS_SESSION_BUS_ADDRESS at the beginning of the xstartup script.



            Here is a snip of mine that have gnome-session started properly. However, the only issue so far is that the color scheme of the terminal is not properly applied, but VNC runs fine :)



            #!/bin/sh
            MODE="GNOME"
            unset DBUS_SESSION_BUS_ADDRESS
            if [ -e "$HOME/.Xresources" ]
            then
            xrdb "$HOME/.Xresources"
            fi

            if [ "GNOME" = "$MODE" ]
            then
            if which gnome-session > /dev/null
            then
            gnome-session --session=ubuntu &
            else
            MODE=""
            fi
            fi





            share|improve this answer















            Make sure that you unset the DBUS_SESSION_BUS_ADDRESS at the beginning of the xstartup script.



            Here is a snip of mine that have gnome-session started properly. However, the only issue so far is that the color scheme of the terminal is not properly applied, but VNC runs fine :)



            #!/bin/sh
            MODE="GNOME"
            unset DBUS_SESSION_BUS_ADDRESS
            if [ -e "$HOME/.Xresources" ]
            then
            xrdb "$HOME/.Xresources"
            fi

            if [ "GNOME" = "$MODE" ]
            then
            if which gnome-session > /dev/null
            then
            gnome-session --session=ubuntu &
            else
            MODE=""
            fi
            fi






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 12 at 4:08

























            answered Jun 8 '18 at 14:40









            twangtwang

            12




            12













            • MODE=" should be MODE="" , UN-terminated quotes. syntax error.

              – Dan
              Sep 27 '18 at 5:27



















            • MODE=" should be MODE="" , UN-terminated quotes. syntax error.

              – Dan
              Sep 27 '18 at 5:27

















            MODE=" should be MODE="" , UN-terminated quotes. syntax error.

            – Dan
            Sep 27 '18 at 5:27





            MODE=" should be MODE="" , UN-terminated quotes. syntax error.

            – Dan
            Sep 27 '18 at 5:27


















            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%2f1031147%2frunning-vnc-server-on-ubuntu-desktop-18-04-by-creating-new-sessions%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?

            張江高科駅