Portage adds the 'stubby' user when installing the package. This is not compatibly with the .service file which says: User=stubby DynamicUser=yes Since the user is being added by portage, it isn't a dynamic user. So either portage should not add the user or DynamicUser should be removed or set to no. The systemd error: stubby.service: Failed to update dynamic user credentials: Invalid or incomplete multibyte or wide character
Also a second problem with it is that the systemd service sets the working directory to /var/cache/stubby (stubby recommends it having its own directory I think). But this directory does not exist. systemd error: stubby.service: Failed at step CHDIR spawning /usr/bin/stubby: No such file or directory Setting DynamicUser=no and creating /var/cache/stubby and chowning it as user stubby makes the service work.
Portage should not write anything in /var, so /var/cache/stubby should be created by the daemons supervisor, in our case, by stubby systemd unit. tmpfiles.d should create this folder with the right permissions if it does not exist or permissions doesn't match. It is apparently not the case. Maybe systemd-tmpfiles unit should be enabled and started. Is editing the service file with the following lines working? DynamicUser=no ExecStartPre=/bin/mkdir -p /var/cache/stubby ExecStartPre=/bin/chown stubby:stubby /var/cache/stubby
made a pull request https://github.com/gentoo/gentoo/pull/8920
As the github repository is in trouble, I'll also link my commits which was in the PR: https://github.com/CaseOf/gentoo/commit/3a6b27173163738b649753278a07ad02261b6434 https://github.com/CaseOf/gentoo/commit/bfb7faec82df7439a737c56121ef8b84763a8471
I made a new pull request https://github.com/gentoo/gentoo/pull/9041
fixed by https://github.com/gentoo/gentoo/pull/9041