Super -> exec vs Alt-F2 -> exec have different environment

Bug #1433013 reported by Dimitri John Ledkov
26
This bug affects 3 people
Affects Status Importance Assigned to Milestone
gnome-session (Ubuntu)
Fix Released
Medium
Marco Trevisan (Treviño)
Xenial
Fix Released
Undecided
Marco Trevisan (Treviño)
upstart (Ubuntu)
Fix Released
Medium
Dimitri John Ledkov
Trusty
Confirmed
Medium
Unassigned
Utopic
Won't Fix
Medium
Unassigned
Vivid
Won't Fix
Medium
Unassigned
Xenial
Fix Released
Undecided
Dimitri John Ledkov

Bug Description

upstart in user session manages environmental variables and most things have them, however Alt-f2 started processes lack them.

[Impact]
Some environment variables are missing from apps that are launcher from Alt+f2 command lens, or in general with dbus-activation (an example might be gnome-terminal, global menu not working).

[Test case]
Super Key -> "xterm" -> Enter -> env | grep SSH

it should return something like:
SSH_AUTH_SOCK=/run/user/$UID/keyring-<random-stuff>/ssh

Alt+F2 -> "xterm" -> Enter -> env | grep SSH

The returned values should match the results got from the xterm instance that has been ran from unity dash application lens (the one opened with Super).

The same should be checked for the variable XDG_MENU_PREFIX

Before this fix happened we had this result:
  via Super Key -> the environment is correct
  via Alt-F2 -> it is not

[Regression potential]

Nothing known. Some variables could be overridden, but this is expected.

Related branches

summary: - upstart user session variables are not in dbus activated processes
+ Super -> exec vs Alt-F2 -> exec have different environment
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

So further experimentation revealed that we should be keeping the DBUS activation environment up to date with all the initctl set-env calls.

Thus initctl set-env calls should call into org.freedesktop.DBus.UpdateActivationEnvironment in the user session upstart case.

Changed in upstart (Ubuntu):
importance: Undecided → Medium
Changed in unity-lens-applications (Ubuntu):
importance: Undecided → Medium
Changed in unity (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Iain Lane (laney) wrote :

Can you please test this with the gnome-session in vivid-proposed / wily? We think it might be the same issue.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

The branches attached solve this for me. I hope somebody from upstart team can review them.

I'll try to put a ppa out with that patch in, such that other users that are affected can also test this.

I expect to SRU this change to all stable releases.

no longer affects: unity-lens-applications (Ubuntu Trusty)
no longer affects: unity-lens-applications (Ubuntu Utopic)
no longer affects: unity-lens-applications (Ubuntu Vivid)
Changed in unity-lens-applications (Ubuntu):
status: New → Won't Fix
no longer affects: unity (Ubuntu Trusty)
no longer affects: unity (Ubuntu Utopic)
no longer affects: unity (Ubuntu Vivid)
Changed in unity (Ubuntu):
status: New → Won't Fix
Changed in unity:
status: New → Won't Fix
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in upstart (Ubuntu Trusty):
status: New → Confirmed
Changed in upstart (Ubuntu Utopic):
status: New → Confirmed
Changed in upstart (Ubuntu Vivid):
status: New → Confirmed
Changed in upstart (Ubuntu):
status: New → Confirmed
Revision history for this message
Ilya Murav'jov (muravjov-il) wrote :

Hi,

I use Trusty, use Alt-f2 to start konsole. And ssh-agent doesn't run because "set | grep SSH" is empty.
Is there a workaround for this issue?

Revision history for this message
Ilya Murav'jov (muravjov-il) wrote :

*ssh-agent doesn't work because "set | grep SSH" is empty.

Revision history for this message
ltsampros (ltsampros) wrote :

Is there any update on this issue? Is there any remedy or workaround since alt-f2 is widely used?

(After all the ssh-agent/gnome-keyring trouble this is pretty embarrassing)

Will Cooke (willcooke)
tags: added: rls-w-incoming
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

There is untested patch attached as a merge proposal here.
In essence the environment variables should be uploaded into the dbus activation environment, such that when unity launcher is dbus activated, it can launch things with same variables as the upstart jobs.

Revision history for this message
Iain Lane (laney) wrote :

I think it makes sense. DBus in wily (>= 1.9) does similar for Xsession.d managed sessions:

    # unset login-session-specifics
    unset XDG_SEAT
    unset XDG_SESSION_ID
    unset XDG_VTNR

    # tell dbus-daemon --session (and systemd --user, if running)
    # to put the Xsession's environment in activated services'
    # environments
    dbus-update-activation-environment --verbose --systemd --all

You probably want to blacklist those same variables.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Yeah, agree...

The fix works, but having some blacklist of variables would be nice.

tags: added: rls-w-notfixing
removed: rls-w-incoming
Mathew Hodson (mhodson)
no longer affects: unity-lens-applications (Ubuntu)
affects: unity → ubuntu-translations
no longer affects: ubuntu-translations
no longer affects: unity (Ubuntu)
Changed in upstart (Ubuntu Trusty):
importance: Undecided → Medium
Changed in upstart (Ubuntu Utopic):
importance: Undecided → Medium
Changed in upstart (Ubuntu Vivid):
importance: Undecided → Medium
Revision history for this message
Rolf Leggewie (r0lf) wrote :

utopic has seen the end of its life and is no longer receiving any updates. Marking the utopic task for this ticket as "Won't Fix".

Changed in upstart (Ubuntu Utopic):
status: Confirmed → Won't Fix
Changed in upstart (Ubuntu):
assignee: nobody → Dimitri John Ledkov (xnox)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package upstart - 1.13.2-0ubuntu23

---------------
upstart (1.13.2-0ubuntu23) yakkety; urgency=medium

  * Cherry-pick upstream fix to publish global session variable changes to
    the dbus environment. LP: #1433013.

 -- Steve Langasek <email address hidden> Fri, 29 Apr 2016 14:38:53 -0700

Changed in upstart (Ubuntu):
status: Confirmed → Fix Released
description: updated
description: updated
Changed in gnome-session (Ubuntu):
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
Revision history for this message
Iain Lane (laney) wrote :

I uploaded gnome-session to yakkety and xenial

Changed in gnome-session (Ubuntu):
status: In Progress → Fix Committed
Changed in gnome-session (Ubuntu Xenial):
status: New → In Progress
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnome-session - 3.18.1.2-1ubuntu2

---------------
gnome-session (3.18.1.2-1ubuntu2) yakkety; urgency=medium

  * debian/patches/export_env_to_upstart.patch:
    - Export environment variables to upstart as well, if available (LP: #1433013)

 -- Marco Trevisan (Treviño) <email address hidden> Thu, 12 May 2016 14:44:19 +0100

Changed in gnome-session (Ubuntu):
status: Fix Committed → Fix Released
tags: added: desktop-trello-import
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Hello Dimitri, or anyone else affected,

Accepted gnome-session into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/gnome-session/3.18.1.2-1ubuntu1.16.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in upstart (Ubuntu Vivid):
status: Confirmed → Won't Fix
Changed in gnome-session (Ubuntu Xenial):
status: In Progress → Fix Committed
tags: added: verification-needed
tags: added: verification-done
removed: verification-needed
Changed in upstart (Ubuntu Xenial):
status: New → In Progress
assignee: nobody → Dimitri John Ledkov (xnox)
Revision history for this message
Martin Pitt (pitti) wrote :

Hello Dimitri, or anyone else affected,

Accepted upstart into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/upstart/1.13.2-0ubuntu21.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in upstart (Ubuntu Xenial):
status: In Progress → Fix Committed
tags: removed: verification-done
tags: added: verification-needed
tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnome-session - 3.18.1.2-1ubuntu1.16.04.1

---------------
gnome-session (3.18.1.2-1ubuntu1.16.04.1) xenial; urgency=medium

  [ Iain Lane ]
  * Update Vcs-Bzr for 16.04

  [ Marco Trevisan (Treviño) ]
  * debian/patches/export_env_to_upstart.patch:
    - Export environment variables to upstart as well, if available (LP: #1433013)

 -- Iain Lane <email address hidden> Fri, 13 May 2016 09:14:24 +0100

Changed in gnome-session (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Chris J Arges (arges) wrote : Update Released

The verification of the Stable Release Update for gnome-session has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package upstart - 1.13.2-0ubuntu21.1

---------------
upstart (1.13.2-0ubuntu21.1) xenial; urgency=medium

  * Cherry-pick upstream fixes to publish global session variable changes
    to the dbus environment. LP: #1433013.

 -- Dimitri John Ledkov <email address hidden> Thu, 19 May 2016 12:04:29 +0100

Changed in upstart (Ubuntu Xenial):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.