Skip to content

gnome3 loses contents of "default" profile #48255

Closed

Description

@peti

My NixOS system has plenty of packages installed in /nix/var/nix/profiles/default. This used to work fine, i.e. the GNOME3 desktop always found those applications. After the recent switch to gdm, however, I regularly log in and all those applications have disappeared from the applications menu. At that point, the only thing that appears to help is to reboot the machine. Once the machine has restarted, all applications from that profile are visible again.

I use a current version of nixos-unstable @ 0a7e258.

Activity

  1. added
    6.topic: GNOME
    0.kind: regression
    on Oct 12, 2018
  2. jtojnar commented on Oct 12, 2018

    @jtojnar
    Member

    I would say that has something to do with the way environment variables are set. I think I experience the same issue after restarting display-manager.service.

    cc @hedning, @oxij who touched that code in #45784

  3. oxij commented on Oct 12, 2018

    @oxij
    Member
  4. jtojnar commented on Oct 12, 2018

    @jtojnar
    Member

    I do not think the PR broke that, I encountered the issue when restarting DM long before it was merged. I would suspect GDM did not launch the profile script in some cases.

  5. hedning commented on Oct 12, 2018

    @hedning
    Contributor

    I've encountered this (or a variation at least).

    Logging out and then in will sometimes result in a gnome session with a bad PATH IIRC, this breaks any desktop files which depends on the Exec being in the path. I've never encountered it on first login, only after logging in on the console I think. I believe variables like XDG_DATA_DIRS looked correct.

    I suspected it was a wayland issue, as I first saw the behavior after switching to my wayland branch. But I guess it only surfaced due to me logging in and out a lot.

    Tried to trigger it in a VM using console/ssh log in and this seems to do the trick:

    1. start a VM with gdm and gnome
    2. start a gnome session from gdm
    3. log in with ssh as the same user as the gnome session
    4. log out from the gnome session (this can take a while for some reason)
    5. log in again from gdm

    This should result in a bad path variable. Looking up PATH in /proc/pid/environ I'm getting this (XDG_DATA_DIRS looks okay):

    PATH=/nix/store/d4qqpjqisrrb4mpny4bap55i0f0pkcld-gdm-3.28.3/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin
    

    Logging out of the gnome session and then killing the ssh connection seems to fix the issue again. It looks like the ssh login needs to be active while logging out to trigger the issue.

    So pretty strange.

  6. hedning commented on Oct 14, 2018

    @hedning
    Contributor

    OK, I think I've figured things out somewhat. Reverting #45784 does indeed fix the issue. Using lightdm also avoids it.

    The main ingredients:

    • GDM imports a base environment for the user from systemd (ie. systemctl --user show-environment)
    • If an variable taken from systemd is already set in GDM's environment it won't take effect. Which is the case for PATH.
    • Gnome sessions exports its environment to systemd
    • ssh/console log in persists the systemd --user process

    So logging into a gnome session will populate the systemd user environment including __NIXOS_SET_ENVIRONMENT_DONE=1. Logging out of the gnome session while the same user is logged in with eg. ssh won't clear the systemd environment. Launching a new session will then have a good environment, but GDM comes in and clobbers PATH making the bug manifest.

    I'd say the main problem here is GDM clobbering PATH.

  7. hedning commented on Oct 14, 2018

    @hedning
    Contributor
  8. hedning commented on Oct 15, 2018

    @hedning
    Contributor

    The easiest fix might be to patch gdm to reset __NIXOS_SET_ENVIRONMENT_DONE when setting up the base environment for a new session. This has the benefit of redoing the environment in case the system have been rebuilt compared to eg. just fixing PATH. (I have a working patch for this).

    An alternative would be to run /etc/set-environment manually in xsession-wrapper, but that will just force us to patch gnome-session when adding wayland support, so I don't quite see the point.

    Reworking #45784 is possible, but might get kinda ugly. It would probably require us to force a reset of the environment when setting up login shells. That was the direction I took when making the shell environment fix in the first place, but the whole thing got quite complicated resulting the simpler fix.

    Any preferences?

  9. moved this to Done in GNOMEon Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: regression6.topic: GNOME

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions