Fix rbw-agent launching from systemd services
The rbw unlock systemd services were failing to launch the rbw-agent daemon due to two issues: 1. Missing RBW_AGENT environment variable - rbw looks for this variable to locate the agent binary, falling back to PATH lookup. Systemd user services have minimal environments without the necessary PATH. 2. Default KillMode=control-group - when the oneshot service completed, systemd was killing all processes in the cgroup including the daemonized agent. Fixed by: - Setting RBW_AGENT environment variable to explicit agent binary path - Using KillMode=process to only kill the main process, allowing the spawned agent daemon to persist after service completion
This commit is contained in:
@@ -90,7 +90,11 @@ in
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.rbw}/bin/rbw unlock";
|
||||
Environment = "PATH=${pkgs.rbw}/bin:/run/current-system/sw/bin";
|
||||
Environment = "RBW_AGENT=${pkgs.rbw}/bin/rbw-agent";
|
||||
# KillMode = "process" prevents systemd from killing the rbw-agent daemon
|
||||
# when this oneshot service completes. The agent is spawned by rbw unlock
|
||||
# and needs to persist after the service exits.
|
||||
KillMode = "process";
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
@@ -105,7 +109,11 @@ in
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.rbw}/bin/rbw unlock";
|
||||
Environment = "PATH=${pkgs.rbw}/bin:/run/current-system/sw/bin";
|
||||
Environment = "RBW_AGENT=${pkgs.rbw}/bin/rbw-agent";
|
||||
# KillMode = "process" prevents systemd from killing the rbw-agent daemon
|
||||
# when this oneshot service completes. The agent is spawned by rbw unlock
|
||||
# and needs to persist after the service exits.
|
||||
KillMode = "process";
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "suspend.target" ];
|
||||
|
||||
Reference in New Issue
Block a user