Skip to content

[241] "No such process" when starting user instance with hidepid=2 and cgroupv2 #12955

@yadutaf

Description

@yadutaf

systemd version the issue has been seen with

241

Used distribution

Yocto, with an additional "-Ddefault-hierarchy=unified" build flag

Expected behaviour you didn't see

user@xxxx.service should start

Unexpected behaviour you saw

user@xxxx.service is in state failed with the following logs

root@machine:~# systemctl status user@xxxx.service
● user@xxxx.service - User Manager for UID xxxx
   Loaded: loaded (/lib/systemd/system/user@.service; static; vendor preset: enabled)
   Active: failed (Result: protocol) since Thu 2019-07-04 09:00:23 UTC; 2min 28s ago
     Docs: man:user@.service(5)
  Process: 1433 ExecStart=/lib/systemd/systemd --user (code=exited, status=1/FAILURE)
 Main PID: 1433 (code=exited, status=1/FAILURE)
      CPU: 5ms

Jul 04 09:00:23 machine systemd[1]: Starting User Manager for UID xxxx...
Jul 04 09:00:23 machine systemd[1433]: Failed to determine supported controllers: No such process
Jul 04 09:00:23 machine systemd[1433]: Failed to allocate manager object: No such process
Jul 04 09:00:23 machine systemd[1]: user@xxxx.service: Failed with result 'protocol'.
Jul 04 09:00:23 machine systemd[1]: Failed to start User Manager for UID xxxx.
Jul 04 09:00:23 machine systemd[1]: user@xxxx.service: Consumed 5ms CPU time.

Steps to reproduce the problem

  1. mount -oremount,gid=4,hidepid=2 /proc
  2. /bin/loginctl enable-linger user-xxxx

We are using the "unified" hierarchy, not sure whether it makes any difference

Workaround

This can be worked-around by adding SupplementaryGroups=4 to

(Original hint from https://github.com/pld-linux/systemd/blob/master/proc-hidepid.patch)

But, in this case, all user processes created by systemd user instance have the supplementary group 4, which reduces the usefulness of the 'hidepid=2' feature. It does not however affect sessions opened via SSH so that there is still some benefit :)

Is there any way to avoid propagating the supplementary group to the child processes or, is there a way to avoid needing the patch at least on the user@.service (which I believe, would 'fix' the 'leak') ? I'd naively imagine that the user instance could query the system instance for the info it needs :)

Thanks,

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions