Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xfce4-notifyd is not started by dbus #106494

Closed
dminuoso opened this issue Dec 9, 2020 · 16 comments · Fixed by #136705
Closed

xfce4-notifyd is not started by dbus #106494

dminuoso opened this issue Dec 9, 2020 · 16 comments · Fixed by #136705
Labels

Comments

@dminuoso
Copy link
Contributor

dminuoso commented Dec 9, 2020

Describe the bug
xfce4-notifyd is not started by dbus in 20.09
This is verifiable by checking systemctl or just nix-shell -p libnotify --run 'notify-send It works!'

To Reproduce
Add xfce.xfce4-notifyd to systemPackages and cause a dbus restart.

This seems to be a regression between 20.03 and 20.09 (I don't have proof of this, but I'm confident this all worked before I upgraded to 20.09).

Expected behavior
That xfce4-notifyd gets picked up by dbus as per https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/system/dbus.nix#L116-L119

Notify maintainers
@worldofpeace

Metadata

λ ~/ nix-shell -p nix-info --run "nix-info -m"                                                                                                                                                                                                                                                                              ~
 - system: `"x86_64-linux"`
 - host os: `Linux 5.9.11, NixOS, 20.09.2076.ffb3aab257e (Nightingale)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.9`
 - channels(dminuoso): `"nixos-unstable-21.03pre253635.2247d824fe0, nixpkgs-unstable-21.03pre250093.0da76dab4c2, nixpkgs-20.09beta992.7badbf18c45, nixpkgs-static"`
 - channels(root): `"nixos-hardware, nixos-20.09.2076.ffb3aab257e, home-manager, nixos-unstable-21.03pre250162.34ad166a830, nixpkgs-unstable-21.03pre250093.0da76dab4c2"`
 - nixpkgs: `/home/dminuoso/.nix-defexpr/channels/nixpkgs`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
- "services/system/dbus.nix"
@dminuoso
Copy link
Contributor Author

dminuoso commented Dec 9, 2020

Updated channel, problem still appears.

λ /nix/store/ nix-shell -p nix-info --run "nix-info -m"                                                                                            /nix/store
 - system: `"x86_64-linux"`
 - host os: `Linux 5.9.12, NixOS, 20.09.2190.78dc359abf8 (Nightingale)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.9`
 - channels(dminuoso): `"nixos-unstable-21.03pre253635.2247d824fe0, nixpkgs-unstable-21.03pre250093.0da76dab4c2, nixpkgs-20.09beta992.7badbf18c45, nixpkgs-static"`
 - channels(root): `"nixos-20.09.2190.78dc359abf8, nixos-hardware, home-manager, nixos-unstable-21.03pre250162.34ad166a830, nixpkgs-unstable-21.03pre250093.0da76dab4c2"`
 - nixpkgs: `/home/dminuoso/.nix-defexpr/channels/nixpkgs`

I also see the following message in the dbus-daemon journal:

Dec 09 23:17:19 Verleihnix dbus-daemon[2148]: [session uid=1000 pid=2148] Activation via systemd failed for unit 'xfce4-notifyd.service': Unit xfce4-notifyd.service not found.

@dminuoso
Copy link
Contributor Author

dminuoso commented Dec 9, 2020

No idea why I'm seeing those errors at all.

/etc/dbus-1/session.conf does not contain xfce4-notifyd as it should.

@dminuoso
Copy link
Contributor Author

dminuoso commented Dec 9, 2020

Interestingly, if I explicitly put in services.dbus.packages = [ pkgs.xfce.xfce4-notifyd ]; the /etc/dbus-1/session.conf contains the right reference, but dbus still cant start the notifyd service:

Dec 10 00:56:41 Verleihnix dbus-daemon[2070]: [session uid=1000 pid=2070] Activating via systemd: service name='org.freedesktop.Notifications' unit='xfce4-notifyd.service' requested by ':1.33' (uid=1000 pid=7971 comm="notify-send It works! " label="kernel")
Dec 10 00:56:41 Verleihnix dbus-daemon[2070]: [session uid=1000 pid=2070] Activation via systemd failed for unit 'xfce4-notifyd.service': Unit xfce4-notifyd.service not found.
Dec 10 00:56:41 Verleihnix dbus-daemon[2070]: [session uid=1000 pid=2070] Activating via systemd: service name='org.freedesktop.Notifications' unit='xfce4-notifyd.service' requested by ':1.34' (uid=1000 pid=7971 comm="notify-send It works! " label="kernel")
Dec 10 00:56:41 Verleihnix dbus-daemon[2070]: [session uid=1000 pid=2070] Activation via systemd failed for unit 'xfce4-notifyd.service': Unit xfce4-notifyd.service not found.

@dminuoso
Copy link
Contributor Author

dminuoso commented Dec 10, 2020

If xfce4-notifyd is explicitly added to dbus.packages, there's an appropriate .service file in the system:

lrwxrwxrwx 1 root root 130 Jan  1  1970 /nix/store/h7yby2r3csqhnq7napknal3yplm2hwhn-system-path/share/dbus-1/services/org.xfce.xfce4-notifyd.Notifications.service -> /nix/store/j7kzylhr7ms7ph9ihndm8bwxl5ak4i0b-xfce4-notifyd-0.6.1/share/dbus-1/services/org.xfce.xfce4-notifyd.Notifications.service

@dminuoso
Copy link
Contributor Author

For other users stumbling on this, as a temporary workaround I'm running xfce4-notifyd from my

services.xserver.desktopManager.sessionCommands = ''
     ${pkgs.xfce.xfce4-notifyd}/lib/xfce4/notifyd/xfce4-notifyd &
'';

@veprbl veprbl added the 6.topic: xfce The Xfce Desktop Environment label Dec 10, 2020
@rzetterberg
Copy link
Member

I updated from 20.03 to 20.09 yesterday without any configuration changes and I got hit with the same problem.

Here's my metadata (Yes, I'm also using lambda as shell prompt 😄)

λ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.9.16, NixOS, 20.09.2674.a058d005b3c (Nightingale)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.10`
 - channels(root): `"nixos-20.09.2674.a058d005b3c"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Also, I'm running xfce as DM (noDesktop = true; enableXfwm = false;) + Xmonad as WM.

As a workaround I created a systemd user service for xfce4-notifyd:

{ config, lib, pkgs, ... }:

with lib;

let
  cfg = config.services.xfce4-notifyd;
in
  {
    options = {
      services.xfce4-notifyd = {
        enable = mkOption {
          type    = types.bool;
          default = false;
        };

        package = mkOption {
          type    = types.package;
          default = pkgs.xfce.xfce4-notifyd;
        };
      };
    };

    config = mkIf cfg.enable {
      systemd.user.services.xfce4-notifyd = {
        description = "XFCE4 notifyd";
        requires    = [ "graphical-session.target" ];
        after       = [ "graphical-session.target" ];

        serviceConfig = {
          ExecStart    = "${cfg.package}/lib/xfce4/notifyd/xfce4-notifyd";
          Restart      = "on-failure";
          RestartSec   = "1";
        };
      };
    };
  }

And then in my configuration.nix:

{ config, lib, pkgs, ... }:

{
  imports = [
    ./xfce4-notifyd/default.nix
  ];

  services.xfce4-notifyd.enable = true;
}

Since I didn't restart my graphical session I just started it manually the first time:

systemctl --user start xfce4-notifyd

@acarrico
Copy link
Contributor

acarrico commented Mar 3, 2021

Caution: when xfce4-notifyd is down, you may hit a severe issue with xfce4-power-manager which I've reported upstream in that link.

@acarrico
Copy link
Contributor

acarrico commented Mar 3, 2021

@rzetterberg,

As a workaround I created a systemd user service for xfce4-notifyd:

Thanks, I haven't tried this method to make a systemd service before. Is there a way to restrict this to just xfce4 sessions?

@acarrico
Copy link
Contributor

acarrico commented Mar 3, 2021

Also, has anyone tracked down the change that introduced the issue?

@rzetterberg
Copy link
Member

@acarrico,

Thanks, I haven't tried this method to make a systemd service before. Is there a way to restrict this to just xfce4 sessions?

I don't think there's a streamlined way to do this, as graphical-session.target is used for all different session types.

Maybe you could change ExecStart to only run xfce4-notifyd when the environment variable DESKTOP_SESSION contain xfce.

@stale
Copy link

stale bot commented Sep 3, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Sep 3, 2021
@dminuoso
Copy link
Contributor Author

dminuoso commented Sep 4, 2021

I just looked at it again and think I found the immediate problem.

xfce4-notifyd no longer carries the dbus-1 directories around in the share directory.

λ ~/ find /nix/store/vdxhkljhr4fzzcy17y29dm4kpn5zhxgx-xfce4-notifyd-0.2.4/share -name dbus-1                                                                                      ~
/nix/store/vdxhkljhr4fzzcy17y29dm4kpn5zhxgx-xfce4-notifyd-0.2.4/share/dbus-1
λ ~/ find /nix/store/r2k5w1vzmh5g3s6sdapmnffjyq9qki9l-xfce4-notifyd-0.6.2/share -name dbus-1                                                                                      ~
λ ~/   

So this appears to be a regression at some point in 2020.

@romildo You seem to have bumped the package and done quite a bit work on xfce. Do you know what could be the cause or a fix here?

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Sep 4, 2021
@romildo
Copy link
Contributor

romildo commented Sep 4, 2021

The following configure option is available:

--enable-dbus-start-daemon
                          Start daemon via DBus instead of regular session
                          autostart. (default=no)

We can try to enable it and see if it works for you.

Note that the default (autostart session) works for me with the default NixOS configuration for Xfce.

@dminuoso
Copy link
Contributor Author

dminuoso commented Sep 5, 2021

Thanks!

@romildo
The autostart file is indeed correctly provided, but that only helps if ones WM/DE is XDG Autostart compliant. Xmonad is not, which is why I was affected, other environments might also lack XDG Autostart.

Given the pull request I managed to track down the regression:
https://gitlab.xfce.org/apps/xfce4-notifyd/-/issues/27

As for everyone else, the linked PR is a permanent fix. Autostart users should not be affected. The following is a morally correct workaround until the PR hits a nix channel in case any other users are affected by this and don't want to wait.

let
  xfceOverlay = self: super: { xfce = super.xfce // {
      xfce4-notifyd = super.xfce.xfce4-notifyd.overrideAttrs (old: {
        configureFlags = (old.configureFlags or []) ++ [ "--enable-dbus-start-daemon" ];
      });
    };
  };
in
{
  config = {
    nixpkgs.overlays = [ xfceOverlay ];
  };
}

Once PR is merged I will close this issue.

@rzetterberg
Copy link
Member

@dminuoso Nice workaround! Much cleaner than the one I suggested 👍

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/help-xfce4-notifyd-seems-to-be-a-ghost-package/21966/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants