Archive:Getting Started/Run/Nested Session: Difference between revisions

    From KDE TechBase
    m (Reverted edits by KennethMartinez (talk) to last revision by AnneW)
     
    (13 intermediate revisions by 5 users not shown)
    Line 1: Line 1:
    {{Template:I18n/Language Navigation Bar|Getting_Started/Run/Nested_Session}}
    __NOINDEX__
     
    <languages />


    == Nested KDE 4 Session ==
        {|align="center"
        |[[image:Snapshot1.png|right|thumb|200px|Nested]]
        |}


    Instead of using a full-blown new virtual X for developing software you can use Xephyr to embed your KDE 4 session into your working KDE 3 or other X11 environment.
    == Nested KDE 4 Session == <!--T:1-->


    You can also do this with xnest, but as xnest cannot handle extensions like Render many people prefer Xephyr.
        <!--T:2-->
    {|class="tablecenter"
        |[[image:Snapshot1.png|right|thumb|350px|Nested]]
        |}


    {{Note|1=In some cases Xephyr/xnest will make the keyboard not work correctly because of [https://bugs.freedesktop.org/show_bug.cgi?id=19365 bug:19365]. The workaround is to run KDE on a standalone X as described below.}}
    <!--T:3-->
    Instead of using a full-blown new X session for developing software you can use ''Xephyr'' to run your development build of KDE 4 in a session parallel to your normal working session.  


    If you want to get a minimal KDE session up and running, just launch Xephyr (available in Kubuntu as xserver-xephyr; Gentoo users compile x11-base/xorg-server with USE="kdrive"):
    <!--T:4-->
    You can also do this with ''xnest'', but as xnest cannot handle extensions like ''Render'' many people prefer Xephyr.


    Xephyr :1 -extension GLX &
    <!--T:5-->
    {{Note|1=In some cases Xephyr/xnest will make the keyboard work incorrectly because of [https://bugs.freedesktop.org/show_bug.cgi?id=19365 bug:19365]. The workaround is to run KDE on a standalone X as described below.}}


    You can now launch KDE:
    <!--T:6-->
    Assuming you setup your build environment following the instructions in [[Getting_Started/Build/Environment]], simply put the following script in {{path|~/kde/src/run_kde_nested}}.


    <code bash>
    <!--T:7-->
    su - $USER
    <syntaxhighlight lang="bash">
    #!/bin/bash
    Xephyr :1 -screen 1024x768 &
    sleep 3
    export DISPLAY=:1
    export DISPLAY=:1
    /path/to/kde4/bin/startkde-modified &
    dbus-launch $KDEDIR/bin/startkde
    </code>
    </syntaxhighlight>
     
    startkde-modified is a copy of the startkde-script which includes the following lines on the top:


    <code bash>
    <!--T:8-->
    export KDEDIR=`kde4-config --prefix`
    Make this file executable. Entering the {{path|~/kde/src}} directory should set up the required environment variables, so do that before running the script.
    export LD_LIBRARY_PATH=$KDEDIR/lib
    export PATH=$KDEDIR/bin/:$PATH
    export KDEHOME=~/.kde4
    </code>


    You can also use Xephyr with KDM via the Xdmcp protocol and simply a new KDE 4 session to KDM.
    <!--T:9-->
    You can also use Xephyr with KDM via the ''Xdmcp'' protocol and simply a new KDE 4 session to KDM.
       
       
    On Kubuntu, you can enable it by changing
    On Kubuntu, you can enable it by changing


    <code ini>
    <!--T:10-->
    <syntaxhighlight lang="ini">
    [Xdmcp]
    [Xdmcp]
    # Whether KDM should listen to incoming XDMCP requests.
    # Whether KDM should listen to incoming XDMCP requests.
    # Default is true
    # Default is true
    Enable=false
    Enable=false
    </code>
    </syntaxhighlight>


    <!--T:11-->
    in {{path|/etc/kde3/kdm/kdmrc}} to
    in {{path|/etc/kde3/kdm/kdmrc}} to


    <code ini>
    <!--T:12-->
    <syntaxhighlight lang="ini">
    [Xdmcp]
    [Xdmcp]
    # Whether KDM should listen to incoming XDMCP requests.
    # Whether KDM should listen to incoming XDMCP requests.
    # Default is true
    # Default is true
    Enable=true
    Enable=true
    </code>
    </syntaxhighlight>


    and adjust your {{path|/etc/kde3/kdm/Xaccess}} to allow your local machine access. Additionally you should make sure to set up a port blocking policy on all external interfaces for the Xdmcp port if you are doing this on a laptop or a PC in an untrusted environment.
    <!--T:13-->
    Adjust your {{path|/etc/kde3/kdm/Xaccess}} to allow your local machine access. Additionally you should make sure to set up a port blocking policy on all external interfaces for the Xdmcp port if you are doing this on a laptop or a PC in an untrusted environment.
       
       
    If you are done, simply launch Xephyr:
    If you are done, simply launch '''Xephyr''':
       
       
    Xephyr -query localhost :1 -host-cursor -screen 1024x768&
    <code>Xephyr -query localhost :1 -host-cursor -screen 1024x768&</code>


    <!--T:14-->
    where <tt>-host-cursor</tt> tries to reuse the host's cursor and <tt>-screen</tt> sets the screen dimensions.
    where <tt>-host-cursor</tt> tries to reuse the host's cursor and <tt>-screen</tt> sets the screen dimensions.


    <!--T:15-->
    {{Note| If you get lots of refused connection errors, you might want to use the -ac option of Xephyr. When I tried to launch an application into the Xephyr instance, but I received 3-4 "No protocol specified", after finally saying "could not connect to X Server :1". The below code fixed it for me. It only happens when I am crossing users though, as opposed to doing it all in my main user.}}
    {{Note| If you get lots of refused connection errors, you might want to use the -ac option of Xephyr. When I tried to launch an application into the Xephyr instance, but I received 3-4 "No protocol specified", after finally saying "could not connect to X Server :1". The below code fixed it for me. It only happens when I am crossing users though, as opposed to doing it all in my main user.}}


    Xephyr -ac :1&
    <!--T:16-->
    <code>Xephyr -ac :1&</code>


    Another option to try if you get lots of refused connection errors is you may need to grant assess to your kde-devel user to your X server.  As root or using sudo execute:
    <!--T:17-->
    Another option to try if you get lots of refused connection errors is you may need to grant access to your kde-devel user to your X server.  Do that using:


    xhost +local:kde-devel
    <!--T:18-->
    <code>xhost +local:kde-devel</code>


    <!--T:19-->
    If you do not have Xephyr, you can also use Xnest:
    If you do not have Xephyr, you can also use Xnest:


    Xnest -ac :1& export DISPLAY=:1
    <!--T:20-->
    <code>Xnest -ac :1& export DISPLAY=:1</code>


    <BR>
     
    <!--T:21-->
    -----
    -----
    {{improve}}
    [[User:Sping|Sping]] 00:25, 9 April 2007 (CEST)<BR>
    I use this for my start script ''nested_kde4.sh'':
    #! /bin/bash
    NESTED_KDE_DISPLAY_BACKUP=$DISPLAY
    export DISPLAY=:0
    Xephyr :1 -screen 1024x768 &
    export DISPLAY=:1
    $HOME/kde/bin/startkde-modified &
    export DISPLAY=${NESTED_KDE_DISPLAY_BACKUP}


    If you run into
    <!--T:22-->
    You may run into this error:


    "Call to lnusertemp failed (temporary directories full?).
    <!--T:23-->
       Check your installation."
    {{Output|1=Call to lnusertemp failed (temporary directories full?)
       Check your installation."}}


    try this:
    <!--T:24-->
    If so, try this:


    mkdir /var/tmp/kde-devel-kde4
    <!--T:25-->
    {{Input|1=mkdir /var/tmp/kde-devel-kde4}}


    <!--T:26-->
    The above code assumes you work with user ''kde-devel''.
    The above code assumes you work with user ''kde-devel''.
    {{Note|In most cases you have to replace ''startkde-modified'' with ''startkde''}}
    -----
    -----


    <!--T:27-->
    [[Category:KDE4]]
    [[Category:KDE4]]

    Latest revision as of 15:54, 31 July 2012



    Nested KDE 4 Session

    Nested

    Instead of using a full-blown new X session for developing software you can use Xephyr to run your development build of KDE 4 in a session parallel to your normal working session.

    You can also do this with xnest, but as xnest cannot handle extensions like Render many people prefer Xephyr.

    Note
    In some cases Xephyr/xnest will make the keyboard work incorrectly because of bug:19365. The workaround is to run KDE on a standalone X as described below.


    Assuming you setup your build environment following the instructions in Getting_Started/Build/Environment, simply put the following script in ~/kde/src/run_kde_nested.

    #!/bin/bash
    Xephyr :1 -screen 1024x768 &
    sleep 3
    export DISPLAY=:1
    dbus-launch $KDEDIR/bin/startkde
    

    Make this file executable. Entering the ~/kde/src directory should set up the required environment variables, so do that before running the script.

    You can also use Xephyr with KDM via the Xdmcp protocol and simply a new KDE 4 session to KDM.

    On Kubuntu, you can enable it by changing

    [Xdmcp]
    # Whether KDM should listen to incoming XDMCP requests.
    # Default is true
    Enable=false
    

    in /etc/kde3/kdm/kdmrc to

    [Xdmcp]
    # Whether KDM should listen to incoming XDMCP requests.
    # Default is true
    Enable=true
    

    Adjust your /etc/kde3/kdm/Xaccess to allow your local machine access. Additionally you should make sure to set up a port blocking policy on all external interfaces for the Xdmcp port if you are doing this on a laptop or a PC in an untrusted environment.

    If you are done, simply launch Xephyr:

    Xephyr -query localhost :1 -host-cursor -screen 1024x768&

    where -host-cursor tries to reuse the host's cursor and -screen sets the screen dimensions.

    Note
    If you get lots of refused connection errors, you might want to use the -ac option of Xephyr. When I tried to launch an application into the Xephyr instance, but I received 3-4 "No protocol specified", after finally saying "could not connect to X Server :1". The below code fixed it for me. It only happens when I am crossing users though, as opposed to doing it all in my main user.


    Xephyr -ac :1&

    Another option to try if you get lots of refused connection errors is you may need to grant access to your kde-devel user to your X server. Do that using:

    xhost +local:kde-devel

    If you do not have Xephyr, you can also use Xnest:

    Xnest -ac :1& export DISPLAY=:1



    You may run into this error:

    Call to lnusertemp failed (temporary directories full?)
      Check your installation."

    If so, try this:

    mkdir /var/tmp/kde-devel-kde4

    The above code assumes you work with user kde-devel.