Bug#868269: Regression from jessie to stretch in handling of %u, %U, %s, and %h

Josh Triplett josh at joshtriplett.org
Sun Sep 10 01:18:35 BST 2017

On Sun, Sep 10, 2017 at 01:43:09AM +0200, Michael Biebl wrote:
> On Thu, 13 Jul 2017 15:09:29 -0700 Josh Triplett <josh at joshtriplett.org>
> wrote:
> > Package: systemd
> > Version: 233-10
> > Severity: normal
> > 
> > I'm not suggesting a change here, but I do think this could use
> > documentation in the release notes and NEWS.Debian file.
> > 
> > Commit 79413b673b45adc98dfeaec882bbdda2343cb2f9 in systemd 228 (between
> > jessie and stretch) effectively broke/disabled the %u, %U, %s and %h
> > specifiers in units.  I ran into this with a local unit that used %u,
> > which went from expanding to the value of User to expanding to "root".
> > It took quite a bit of investigating to figure out the cause.
> > 
> > At a minimum, I would suggest adding something to the stretch release
> > notes about this, as well as a NEWS.Debian entry.
> > 
> > You might also consider, in your next stretch-proposed-updates upload,
> > including the same NEWS.Debian entry.
> While I'm a bit wary of the inflationary use of NEWS.Debian, I'd be ok
> with adding a NEWS entry if one was provided in this case.
> Josh, would you be willing to write such a text?

Sure. How does this look?

systemd 228 changed the behavior of the %u, %U, %s, and %h specifiers.
They were previously documented as returning the user name, numeric user
ID, shell, and home directory of the user configured to run a unit.
However, PID 1 cannot safely perform lookups in the username database,
due to NSS; thus, these directives already did not work consistently for
non-root users. In particular, %u and %U would only resolve whichever of
a name or UID was configured via the User= directive.

In systemd 228 and later, these directives always return the information
for the user running systemd (root for the system instance), not the
unit's configured user. Units shipped by Debian do not use these
directives. Please update any local units that use these directives.

For instanced units that use the instance name as the user, substitute
that instance name for %u. For other units, substitute the appropriate
information directly, or run a script at launch time that looks up the
desired information.

More information about the Pkg-systemd-maintainers mailing list