nix-installers icon indicating copy to clipboard operation
nix-installers copied to clipboard

Installer breaks XDG_DATA_DIRS and PATH under Fedora 37

Open davidmehren opened this issue 2 years ago • 4 comments

I used the rpm to install Nix under Fedora 37, as this seems to be the only installer that supports SELinux. The good news: The problems I encountered seem to be not caused by SELinux :smile:

The bad news:

After a reboot, GNOME did not start. In fact, gnome-session-binary crashes:

Feb 15 19:25:47 elitebook gnome-session[4007]: gnome-session-binary[4007]: GLib-GIO-ERROR: No GSettings schemas are installed on the system
Feb 15 19:25:47 elitebook gnome-session[4007]: aborting...
Feb 15 19:25:47 elitebook audit[4007]: ANOM_ABEND auid=1000 uid=1000 gid=1000 ses=4 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=4007 comm="gnome-session-b" exe="/usr/libexe>
Feb 15 19:25:47 elitebook gnome-session-binary[4007]: GLib-GIO-ERROR: No GSettings schemas are installed on the system
                                                      aborting...
<snip>
Feb 15 19:25:47 elitebook systemd[1]: Started [email protected] - Process Core Dump (PID 4022/UID 0).
Feb 15 19:25:47 elitebook audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-coredump@5-4022-0 comm="systemd" exe="/usr/lib/>
Feb 15 19:25:47 elitebook systemd-coredump[4025]: [🡕] Process 4007 (gnome-session-b) of user 1000 dumped core.

After running gnome-session --debug manually from a tty and restarting gdm.service, I could log in. I have no idea why that fixes the issue.

While debugging the problem, I wanted to reboot my system, typing reboot into my shell, fish. It responded with reboot: command not found. That should not be the case, /usr/sbin is normally in PATH.

I then noticed that /nix/var/nix/profiles/system/bin was still in the PATH, even though I had removed it from any local config of my shell. That lead me to find /usr/lib/environment.d/nix-daemon.conf, which sets PATH and XDG_DATA_DIRS.

The critical thing, at least for GNOME crashing, seems to be that $HOME/.nix-profile/share is added to XDG_DATA_DIRS. In my case, /home/david/.nix-profile/share is a symlink to /nix/var/nix/profiles/per-user/david/profile, which does not exist. GTK apps seem to have an allergic reaction to XDG_DATA_DIRS containing nonexisting paths, at least that was I could gather from a quick internet search.

After renaming /usr/lib/environment.d/nix-daemon.conf to nix-daemon.conf.disabled and rebooting, everything was back to normal.

I have not tested if creating /nix/var/nix/profiles/per-user/david/profile also fixes the problems.

davidmehren avatar Feb 15 '23 19:02 davidmehren

the same happened to me

dnkmmr69420 avatar Apr 10 '23 15:04 dnkmmr69420

Fixed in https://github.com/nix-community/nix-installers/pull/19.

yajo avatar Jun 14 '23 07:06 yajo

You broke Arch Linux with #19. Everything launched under systemd fails with "No GSettings schemas are installed on the system". ${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/} is necessary.

pjanx avatar Jul 01 '23 16:07 pjanx

Then it will have to be fixed by other means. Possibly prepending those both paths before the final part.

yajo avatar Jul 04 '23 09:07 yajo