#1137093 invoke-run: chdir to /home/$USER for user services? (discussion)

Package:
runit
Source:
runit
Description:
system-wide service supervision
Submitter:
Lorenzo Puliti
Date:
2026-05-19 12:41:02 UTC
Severity:
normal
#1137093#5
Date:
2026-05-19 12:38:12 UTC
From:
To:
By default in runit the service runs inside the service directory,
which would be /etc/service/foo for system-wide (root) services and
/home/$USER/.service/foo for user services;
In runit 2.3.1-3 I changed invoke-run to automatically chdir to
/home/$USER for user-services (uid>=1000 and /home/$USER is found),
to be consistent with systemd --user behaviour and try to fix issues like
the one reported in #1032368 [1] (krunner)

Then I realized that many rusncripts have things like
'sv d .' or use pwd, try to include conf file or looks for
dirs inside the service directory and in general there is the
expectation that those files/dirs are in the current working directory,
so I reverted the change in 2.3.1-4.

Right now I suspect only a tiny subset of user services needs to
chdir to /home/$USER to work properly (other might rely on some
$XDG_ var to find conf files, but we provide those with runit-user-session)
so it's better to just use chpst to chdir in the exec line, when it's needed.

the krunner issue in #1032368 might be fixed by chdir the dbus@user user service
runscript (still to be tested); in general, as long as the number of user services
that needs to chdir is low, I prefer to chdir in each rusncript; if the number of
such runscripts becomes too high the I'll consider reverting the revert (chdir in
invoke-run)

I'll leave this open until there is an estimate of the number of user services
that needs to chdir

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1032368