Bug 4483 - get Unity 3D running in ThinLinc
Summary: get Unity 3D running in ThinLinc
Status: CLOSED FIXED
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Desktop environment (show other bugs)
Version: 3.4.0
Hardware: PC Unknown
: P2 Normal
Target Milestone: 4.2.0
Assignee: Henrik Andersson
URL:
Keywords: hean01_tester, relnotes
Depends on: 5065
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-14 13:20 CET by Peter Åstrand
Modified: 2014-04-29 11:17 CEST (History)
0 users

See Also:
Acceptance Criteria:


Attachments
Process tree of a unity thinlinc session (10.87 KB, text/plain)
2014-01-14 08:38 CET, Henrik Andersson
Details

Description Peter Åstrand cendio 2012-11-14 13:20:35 CET
This is the Unity variant of bug 3836. Unity 2D was removed from Ubuntu 12.10:

"Unity 2D is being discontinued for the release of Ubuntu 12.10 in October 2012, as the 3D version becomes more capable of running on lower-powered hardware.[29]"

See also:

http://askubuntu.com/questions/176634/unity-2d-support-dropped-in-12-10-what-now
https://bugs.launchpad.net/ubuntu/+source/gnome-control-center/+bug/1035261

However, as many has reported, it is very slow:

Unity through llvmpipe is slow:
https://bugs.launchpad.net/ubuntu/+source/unity/+bug/1046497

Also note the NoMachine TR: http://www.nomachine.com/tr/view.php?id=TR10J02752
Comment 1 Pierre Ossman cendio 2013-04-15 12:40:35 CEST
Tested with our upgrade Mesa and Xorg and it still doesn't work. Tested on Ubuntu 13.04.
Comment 2 Aaron Sowry cendio 2013-07-10 10:05:42 CEST
It's actually possible to get a working Unity 3D desktop on 13.04 by specifying "cmdline=unity" for the profile. If you do this, things actually work surprisingly well, with performance roughly equivalent to that of Gnome Shell.

There are a few problems, however; for example, the "user" menu in the upper right-hand corner is completely empty.

We should investigate what the difference is between running "gnome-session" and "unity", and why it works for the latter but not the former.
Comment 3 Peter Åstrand cendio 2013-10-15 08:37:32 CEST
DRC about using VirtualGL for 3D desktops:

http://comments.gmane.org/gmane.comp.video.opengl.virtualgl.user/1308
Comment 4 Henrik Andersson cendio 2013-12-16 13:52:21 CET
First off, a unity session is started using 'gnome-session --session=ubuntu'

There are currently two problems identified:
 - If a user has been logged on to the console unity fails to start.
   A desktop is shown and context menu on desktop and icons are accessible,   
   however no side panel nor a top bar is visible.

 - When a successful session is started the unity-panel-services fails to start 
   and no menu will be presented to top right in topbar nor will applications
   with unity support not show their application menus in the topbar.
Comment 5 Henrik Andersson cendio 2013-12-16 16:49:58 CET
(In reply to comment #4)
> There are currently two problems identified:
>  - If a user has been logged on to the console unity fails to start.
>    A desktop is shown and context menu on desktop and icons are accessible,   
>    however no side panel nor a top bar is visible.
> 
I have pinpointed this problem down to a configuration section in dconf.

There is 2 config profiles defined in dconf, one default and one unity. And the  ~/.config/compiz-1/compizconfig/config is empty. Addding following section solves the above problem.

[gnome_session]
profile=unity
Comment 6 Henrik Andersson cendio 2013-12-19 11:20:00 CET
(In reply to comment #4)
>  - When a successful session is started the unity-panel-services fails to start 
>    and no menu will be presented to top right in topbar nor will applications
>    with unity support not show their application menus in the topbar.

After a lot of digging of how a session should be started we have found that a user session is started using upstart (init --user) which starts unity-panel-services among others for the session.

There are a few required environment variables to get 'init --user' to do its job. The following environment variables are identified and needed to get things to work.

DESKTOP_SESSION=ubuntu
SESSIONTYPE=gnome-session

Upstart configuration files for a session is available in path /usr/share/upstart/sessions. There are scripts for dbus, ssh-agent, unicast-local-avahi and many more that does not play well with a general terminal session.

Logfiles for session upstart is available in ~/.cache/upstart
Comment 7 Henrik Andersson cendio 2014-01-14 08:13:05 CET
(In reply to comment #5)
> (In reply to comment #4)
> > There are currently two problems identified:
> >  - If a user has been logged on to the console unity fails to start.
> >    A desktop is shown and context menu on desktop and icons are accessible,   
> >    however no side panel nor a top bar is visible.
> > 
> I have pinpointed this problem down to a configuration section in dconf.
> 
> There is 2 config profiles defined in dconf, one default and one unity. And the
>  ~/.config/compiz-1/compizconfig/config is empty. Addding following section
> solves the above problem.
> 
> [gnome_session]
> profile=unity

To clarify this problem:

If I create a new user with an empty home directory and logs on, on local console with a unity session compiz will be configured for the user with specific ubuntu settings. Theses settings are stored in user specific dconf database. There are two compiz profiles configured under /org/compiz, one unity and one Default. The key /org/compiz/current-profile is set to 'unity'.

If i then log on into a ThinLinc session with a user with empty home directory,
the compiz configuration is only initialized with one profile, 'unity' which also is set to current-profile. A Default profile does not exists.

So the problem seems to be that if there is a 'Default' and a 'unity' profile initialized for a user, and connecting to a ThinLinc session, Default profile is set to current-profile which breaks unity.
Comment 8 Henrik Andersson cendio 2014-01-14 08:19:10 CET
> If i then log on into a ThinLinc session with a user with empty home directory,
> the compiz configuration is only initialized with one profile, 'unity' which
> also is set to current-profile. A Default profile does not exists.
> 

After this, if i log on into local console, Default profile is still missing, so intialization of compiz profile 'Default', happens only when users has no profiles initialized and logs on onto the local console.
Comment 9 Henrik Andersson cendio 2014-01-14 08:25:33 CET
(In reply to comment #8)
> > If i then log on into a ThinLinc session with a user with empty home directory,
> > the compiz configuration is only initialized with one profile, 'unity' which
> > also is set to current-profile. A Default profile does not exists.
> > 
> 
> After this, if i log on into local console, Default profile is still missing,
> so intialization of compiz profile 'Default', happens only when users has no
> profiles initialized and logs on onto the local console.

I found that /etc/X11/Xsession.d/65compiz_profile-on-session explicitly sets compiz profile to be used within a session for xubuntu, tested this in my test wrapper script for bootstrapping a unity session and it solves the issue.
This sets the /org/compiz/current-profile to value 'unity' which solves the issue with having a 'Default' profile which was default set to current profile.

# This file is sourced by Xsession(5), not executed.
# Select unity profile if we are in the default session.
# The default profile is used otherwise.

if [ "x$DESKTOP_SESSION" = "xubuntu" ]; then
    COMPIZ_CONFIG_PROFILE="ubuntu"
    export COMPIZ_CONFIG_PROFILE
fi

Which seems to be a workaround for xubuntu, we should definitely do this in our tl-unity-3d wrapper script.
Comment 10 Henrik Andersson cendio 2014-01-14 08:38:59 CET
Created attachment 503 [details]
Process tree of a unity thinlinc session

In this attachment you see the process tree of a thinlinc session, it shows the how upstart is used for the user (init --user) and all the subprocesses it launches for the unity session itself.
Comment 11 Henrik Andersson cendio 2014-01-14 08:53:45 CET
> # This file is sourced by Xsession(5), not executed.
> # Select unity profile if we are in the default session.
> # The default profile is used otherwise.
> 
> if [ "x$DESKTOP_SESSION" = "xubuntu" ]; then
>     COMPIZ_CONFIG_PROFILE="ubuntu"
>     export COMPIZ_CONFIG_PROFILE
> fi
> 
> Which seems to be a workaround for xubuntu, we should definitely do this in our
> tl-unity-3d wrapper script.

I got confused, the check is against "x$DEKTOP_SESSION" and is not a workaround for xubuntu.
Comment 12 Henrik Andersson cendio 2014-01-14 09:36:47 CET
Wrapper script added in commits, 28295, 28297.
Profile added in commit 28296
Comment 13 Henrik Andersson cendio 2014-01-14 14:41:57 CET
(In reply to comment #12)
> Wrapper script added in commits, 28295, 28297.
> Profile added in commit 28296

Verify this changed on Ubuntu 12.04 before close.
Comment 14 Henrik Andersson cendio 2014-01-14 17:05:07 CET
(In reply to comment #12)
> Wrapper script added in commits, 28295, 28297.
> Profile added in commit 28296

Commit 28301 adds tl-unity-3d to tlmisc spec file.
Comment 15 Henrik Andersson cendio 2014-01-21 11:07:52 CET
These changes should also be tested on 12.04 LTS
Comment 16 Henrik Andersson cendio 2014-01-30 13:00:45 CET
(In reply to comment #15)
> These changes should also be tested on 12.04 LTS

The unity 3d profile is shown on 12.04 which is not supported.
Need to find a way to identify this.
Comment 17 Henrik Andersson cendio 2014-01-30 14:46:14 CET
(In reply to comment #16)
> (In reply to comment #15)
> > These changes should also be tested on 12.04 LTS
> 
> The unity 3d profile is shown on 12.04 which is not supported.
> Need to find a way to identify this.

Not supported = 13.10 uses upstart to start a session

12.04 supports starting a unity session: gnome-session --session=ubuntu which will use /usr/lib/nux/unity_is_supported to test if hw accel can be used if fail, ubuntu-2d is used as fallback.

On 12.04 upstart command 'init' doesn't have the --user argument which is used for starting a session on 13.10.

This means that we could replace tl-unity-2d / 3d  scripts with a tl-unity that tests if upstart supports session initialization. If it doesnt just start a gnome-session --session=ubuntu
Comment 18 Henrik Andersson cendio 2014-01-31 11:13:21 CET
(In reply to comment #16)
> (In reply to comment #15)
> > These changes should also be tested on 12.04 LTS
> 
> The unity 3d profile is shown on 12.04 which is not supported.
> Need to find a way to identify this.

Added additional check in commit 28353.
Comment 19 Henrik Andersson cendio 2014-01-31 12:38:17 CET
> Added additional check in commit 28353.

Commit 28354 fixes typo in previous commit.
Comment 20 Henrik Andersson cendio 2014-02-11 14:10:42 CET
> This means that we could replace tl-unity-2d / 3d  scripts with a tl-unity that
> tests if upstart supports session initialization. If it doesnt just start a
> gnome-session --session=ubuntu

Decision was mad on dev meeting to merge 3d and 3d helper script into one.
Comment 21 Henrik Andersson cendio 2014-02-11 14:10:51 CET
> This means that we could replace tl-unity-2d / 3d  scripts with a tl-unity that
> tests if upstart supports session initialization. If it doesnt just start a
> gnome-session --session=ubuntu

Decision was made on dev meeting to merge 3d and 3d helper script into one.
Comment 22 Henrik Andersson cendio 2014-02-11 14:50:21 CET
(In reply to comment #21)
> > This means that we could replace tl-unity-2d / 3d  scripts with a tl-unity that
> > tests if upstart supports session initialization. If it doesnt just start a
> > gnome-session --session=ubuntu
> 
> Decision was made on dev meeting to merge 3d and 3d helper script into one.

Fixed in commit 28401, tested on both Ubuntu 12.04 and 13.10.
Comment 23 Pierre Ossman cendio 2014-03-28 13:13:32 CET
Does not start on 14.04 Beta 2. :/
Comment 24 Pierre Ossman cendio 2014-03-28 13:15:00 CET
The log is very sparse, but it does have errors:

Executing command for profile unity: ${TLPREFIX}/libexec/tl-unity
init: logrotate pre-start process (13042) terminated with status 127
init: Failed to obtain gnome-session instance: Unknown parameter: XDG_CURRENT_DESKTOP
Comment 25 Henrik Andersson cendio 2014-03-28 13:37:24 CET
(In reply to comment #24)
> The log is very sparse, but it does have errors:
> 
> Executing command for profile unity: ${TLPREFIX}/libexec/tl-unity
> init: logrotate pre-start process (13042) terminated with status 127
> init: Failed to obtain gnome-session instance: Unknown parameter:
> XDG_CURRENT_DESKTOP

Fixed in commit 28753.
Comment 26 Pierre Ossman cendio 2014-03-31 14:17:25 CEST
There might be some issue with terminating unity sessions. I did "End existing session" which left me with "init --user" still intact as well as a whole bunch for background services. I've been unable to reproduce it though, so for now I'll just note it here.
Comment 27 Pierre Ossman cendio 2014-04-09 11:28:12 CEST
Portuguese translation in the profile stanza is wrong:

name[pt_BR]=Unity 2D
Comment 28 Peter Åstrand cendio 2014-04-13 22:13:50 CEST
(In reply to comment #27)
> Portuguese translation in the profile stanza is wrong:
> 
> name[pt_BR]=Unity 2D

r28836.
Comment 29 Pierre Ossman cendio 2014-04-15 17:03:51 CEST
Because of bug 5065, this bug got reimplemented in 28868.

Need to retest with the new implementation.
Comment 30 Henrik Andersson cendio 2014-04-29 11:17:35 CEST
(In reply to comment #29)
> Because of bug 5065, this bug got reimplemented in 28868.
> 
> Need to retest with the new implementation.

Closing this bug due to it has been tested on bug #5065 comment #8.

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