www.cendio.com
Bug 5065 - All sessions on Ubuntu >= 13.10 should be started using upstart.
: All sessions on Ubuntu >= 13.10 should be started using upstart.
Status: CLOSED FIXED
: ThinLinc
Desktop environment
: 4.1.1
: PC Unknown
: P2 Normal
: 4.2.0
Assigned To:
:
:
: 5074 5077
: 4483
  Show dependency treegraph
 
Reported: 2014-04-03 07:33 by
Modified: 2014-05-05 15:52 (History)
Acceptance Criteria:


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From cendio 2014-04-03 07:33:43
When starting an xfce session locally on Ubuntu 13.10 the session is initiated
using upstart (init --user) which start session related services:

  ├─lightdm─┬─Xorg───{Xorg}
     │         ├─lightdm─┬─init─┬─applet.py───{applet.py}
     │         │         │      ├─at-spi-bus-laun─┬─dbus-daemon
     │         │         │      │                 └─3*[{at-spi-bus-laun}]
     │         │         │      ├─at-spi2-registr───{at-spi2-registr}
     │         │         │      ├─bamfdaemon───3*[{bamfdaemon}]
     │         │         │      ├─dbus-daemon
     │         │         │      ├─deja-dup-monito───2*[{deja-dup-monito}]
     │         │         │      ├─gconfd-2
     │         │         │      ├─gvfs-afc-volume───2*[{gvfs-afc-volume}]
     │         │         │      ├─gvfs-gphoto2-vo───{gvfs-gphoto2-vo}
     │         │         │      ├─gvfs-mtp-volume───{gvfs-mtp-volume}
     │         │         │      ├─gvfs-udisks2-vo───2*[{gvfs-udisks2-vo}]
     │         │         │      ├─gvfsd───{gvfsd}
     │         │         │      ├─gvfsd-trash───2*[{gvfsd-trash}]
     │         │         │      ├─nm-applet───2*[{nm-applet}]
     │         │         │      ├─notify-osd───2*[{notify-osd}]
     │         │         │      ├─polkit-gnome-au───2*[{polkit-gnome-au}]
     │         │         │      ├─sh───xfce4-session─┬─Thunar───2*[{Thunar}]
     │         │         │      │                   
├─xfce4-panel─┬─panel-2-actions───2*[{panel-2-actions}]
     │         │         │      │                    │            
├─panel-6-systray───2*[{panel-6-systray}]
     │         │         │      │                    │            
└─3*[{xfce4-panel}]
     │         │         │      │                   
├─xfdesktop───3*[{xfdesktop}]
     │         │         │      │                    ├─xfwm4───2*[{xfwm4}]
     │         │         │      │                    └─3*[{xfce4-session}]
     │         │         │      ├─ssh-agent
     │         │         │      ├─tumblerd───4*[{tumblerd}]
     │         │         │      ├─update-notifier─┬─package-system-───fuser
     │         │         │      │                 └─3*[{update-notifier}]
     │         │         │      ├─2*[upstart-dbus-br]
     │         │         │      ├─upstart-event-b
     │         │         │      ├─upstart-file-br
     │         │         │      ├─window-stack-br
     │         │         │      ├─xfce4-appfinder
     │         │         │      ├─xfce4-volumed───{xfce4-volumed}
     │         │         │      ├─xfconfd
     │         │         │      ├─xfsettingsd───{xfsettingsd}
     │         │         │      ├─xscreensaver
     │         │         │      ├─xterm───bash
     │         │         │      ├─zeitgeist-daemo───{zeitgeist-daemo}
     │         │         │      └─zeitgeist-datah───4*[{zeitgeist-datah}]
     │         │         └─{lightdm}

Starting xfc4-session is not enough and we need to do this like when we
starting a unity on Ubuntu >= 13.10 to get all functionality. See bug #4483 for
information about the tl-unity script.
------- Comment #1 From cendio 2014-04-09 10:33:44 -------
I've now dug around and I believe I have a clear picture of the situation. The
problem can be divided into two parts, only one of which is Ubuntu specific:

a) Desktop environments and applications are getting more dependent on being
started from a display manager. They expect certain environment variables to be
set that indicate which desktop environment is being used[1]. ThinLinc does not
set these and that's a general issue that we need to look at.

b) The display manager can start things directly, or via the Xsession script.
This fact is even documented by Debian, and hence Ubuntu. However Debian and
Ubuntu rely rather heavily on the assumption that Xsession will be used. Before
Ubuntu 13.10 you could still ignore Xsession, but now most desktop environment
fail to start without the magic in there. Hence the unity bug and this bug.

[1] Why this isn't set by the desktop environment itself is beyond me...
------- Comment #2 From cendio 2014-04-09 10:58:23 -------
For the first problem, we need to start setting these environment variables:

    DESKTOP_SESSION
    XDG_SESSION_DESKTOP
    XDG_CURRENT_DESKTOP

(there is also XDG_SESSION_TYPE and XDG_SESSION_CLASS, but they are not
connected to the desktop environment so we should probably handle those
differently)

Now the big problem is that those variables are strongly connected to the
session definitions in /usr/share/xsessions[1]. But in ThinLinc we've
completely ignored that mechanism in favour of our own profile selector. We
need to bridge that gap somehow.

I see two approaches:

a1) We duplicate the information from these files into new fields in our
profiles.

a2) We create a link between the profile entry and the relevant xsessions file.
The profile selector can then fetch any info it needs from there. We could even
replace cmdline and testcmd with information gathered.


The big difference between these two is how reliant we'll be on these files on
the system. We'll never be independent of them as the whole point is that we
need the information in there.

So the question is what is the risk that a xsessions file is missing or broken
even when the desktop environment is installed? I would guess that risk is low
as there is so much that depends on the exact naming and attributes of these
files.


[1] And possibly some other paths. Some info:

https://lists.debian.org/debian-devel/2004/05/msg00410.html
------- Comment #3 From cendio 2014-04-09 11:26:45 -------
The second problem is more annoying, but fortunately Ubuntu specific (for now).
However, if you dig around there is only some of the magic that is absolutely
required:

 - Ubuntu requires some extra environment variables. Primarily for Unity, but
also for Gnome and LXDE.

 - For some desktop environments, the session is started via upstart instead of
directly. The file /etc/upstart-xsessions lists which these are.

Solving this relies on having a) solved already. Once that is in place though
we can:

 - Have a script in xstartup.d that looks at the connected xsessions file for
the selected ThinLinc profile and set those environment variables that Ubuntu
craves.

 - Have tl-run-profile replicate the upstart magic and change the command to
upstart if the connected xsessions file is in upstart-xsessions.

This however heavily favours the a2) solution above as we lose control over
which command will actually be executed. upstart will look at the environment
files we set and independently read the xsessions file to determine what to
execute. What we have as cmdline in profiles.hconf is irrelevant in that case.
------- Comment #4 From cendio 2014-04-09 11:27:28 -------
Note that upstart also requires sbin to be in $PATH. See bug 5074.
------- Comment #5 From cendio 2014-04-09 11:35:27 -------
(In reply to comment #2)
> For the first problem, we need to start setting these environment variables:
> 
>     DESKTOP_SESSION
>     XDG_SESSION_DESKTOP
>     XDG_CURRENT_DESKTOP
> 

bug 5077

> (there is also XDG_SESSION_TYPE and XDG_SESSION_CLASS, but they are not
> connected to the desktop environment so we should probably handle those
> differently)

bug 5078 (not setting it as a dependency though as it isn't critical for this
bug)
------- Comment #6 From cendio 2014-04-15 17:03:21 -------
Upstart magic sorted out in r28866 and r28867.

Tester should verify all desktop environments available on Ubuntu.
------- Comment #7 From cendio 2014-04-25 07:14:10 -------
(In reply to comment #6)
> Upstart magic sorted out in r28866 and r28867.
> 
> Tester should verify all desktop environments available on Ubuntu.

Test the following environments:

Xfce
KDE
Gnome
Cinnamon
Mate
------- Comment #8 From cendio 2014-04-25 08:14:26 -------
(In reply to comment #7)
> (In reply to comment #6)
> > Upstart magic sorted out in r28866 and r28867.
> > 
> > Tester should verify all desktop environments available on Ubuntu.
> 
> Test the following environments:
>
> Xfce
> KDE
> Gnome
> Cinnamon
> Mate

The above mentioned desktop environments including Unity has been tested using
ThinLinc build 4332 on Ubuntu 13.10, no oddities has been detected and the
environments are correctly started. Those environments available in
/etc/upstart-xsessions starts up using upstart. Cinnamon and Mate which doesn't
exists in the upstart-xsessions file starts without upstart.

For each desktop I started a few applications, surfed the web, copied files
using graphical filemanager and clicked around in panel menus.. No problems
detected except when using a Cinnamon session. 

When I click a menu in Cinnamon session, the whole desktop locks up, however I
verified that this also happens when running cinnamon on the console. So its
not ThinLinc related.
------- Comment #9 From cendio 2014-04-25 08:30:46 -------
(In reply to comment #8)
> (In reply to comment #7)
> > (In reply to comment #6)
> > > Upstart magic sorted out in r28866 and r28867.
> > > 
> > > Tester should verify all desktop environments available on Ubuntu.
> > 
> > Test the following environments:
> >
> > Xfce
> > KDE
> > Gnome
> > Cinnamon
> > Mate
> 
> The above mentioned desktop environments including Unity has been tested using
> ThinLinc build 4332 on Ubuntu 13.10, no oddities has been detected and the
> environments are correctly started. Those environments available in
> /etc/upstart-xsessions starts up using upstart. Cinnamon and Mate which doesn't
> exists in the upstart-xsessions file starts without upstart.
> 
> For each desktop I started a few applications, surfed the web, copied files
> using graphical filemanager and clicked around in panel menus.. No problems
> detected except when using a Cinnamon session. 
> 
> When I click a menu in Cinnamon session, the whole desktop locks up, however I
> verified that this also happens when running cinnamon on the console. So its
> not ThinLinc related.

Related cinnamon bug:

https://bugs.launchpad.net/ubuntu/+source/cinnamon/+bug/1266336