Cannot enable gnome remote desktop (no pkexec)

Hello,

I’m trying to enable gnome remote desktop (remote login), but I get this:

gnome-control-center[21119]: Failed to enable RDP server: GDBus.Error:org.freedesktop.DBus.Error.Failed: Failed enabling gnome-remote-desktop.service: Failed to execute child process “pkexec” (No such file or directory)

I’m sure that pkexec is available in my system.

which pkexec
/run/wrappers/bin/pkexec

How can I solve this?

NixOS does not expose PATH to services, and because of that, even though your shell PATH contains pkexec, the PATH for gnome-remote-desktop.service does not.

I imagine a simple solution where you tack Environment=PATH=/run/wrappers/bin would probably work fine. This seems like it should probably be reported as a bug, so that the module can actually carry this fix.

Temporary solution:

sudo systemctl edit gnome-remote-desktop-configuration.service --runtime

adding these lines:

[Service]
Environment=PATH=/run/wrappers/bin
Environment=SHELL=/run/current-system/sw/bin/bash

Then

sudo systemctl daemon-reload

sudo systemctl restart gnome-remote-desktop-configuration.service

After restart the service, I can enable the remote desktop service.

Even after restarting, gnome remote desktop will still automatically start.

Is OP even using the module? Have you set services.gnome.gnome-remote-desktop.enable = true; in your config, or are you trying to enable it through the GUI?

(That setting should be automatically enabled if services.desktopManager.gnome.enable is true and you haven’t done anything else very surprising, so maybe you have it without having explicitly set it. You can check with nixos-option services.gnome.gnome-remote-desktop.enable — see what the Value: is.)

I have set these options:

  services.gnome.gnome-remote-desktop.enable = true;
  # This are to enable remote desktop support in GNOME.
  systemd.services.gnome-remote-desktop = {
    wantedBy = [ "graphical.target" ];
  };
  systemd.user.services.gnome-remote-desktop = {
    wantedBy = [ "gnome-session.target" ];
  };

My PC is aarch64-linux, does this matter?

Shouldn’t.

Before you started customizing the configuration service, what happened when you tried to connect from a client?

Before I started customizing the configuration service, the remote desktop is disabled. It will not listen :3389 and I cannot connect to it.