Skip to content

systemd-resolved.service: Couldn't add UID/GID reference to unit, proceeding without: Device or resource busy #9702

Closed

Description

systemd version the issue has been seen with

239-7 in Debian unstable.

Used distribution

Debian unstable. I filed a bug report to the downstream as
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=904335,
and I was suggested there reporting to the upstream.

Expected behaviour you didn't see

We don't see systemd[1]: systemd-resolved.service: Couldn't add UID/GID reference to unit, proceeding without: Device or resource busy

Unexpected behaviour you saw

The static user systemd-resolve in /etc/passwd and DynamicUser=yes give the following journal log.

Jul 23 12:02:57 debian-unstable systemd[1]: systemd-resolved.service: Couldn't add UID/GID reference to unit, proceeding without: Device or resource busy

Changing DynamicUser=yes to DynamicUser=no fixes the problem.

To the down stream bug report, @mbiebl wrote:

DynamicUser also takes care of setting up the runtime directory. Not
sure if we can safely set that to false.
In any case, systemd should gracefully deal with the fact that a system
user has been allocated statically.

Steps to reproduce the problem
See above.

Activity

  1. filbranden commented on Jul 23, 2018

    @filbranden
    Contributor

    DynamicUser also takes care of setting up the runtime directory. Not sure if we can safely set that to false.

    This has since been fixed by #9586, which creates the users statically and sets permissions of the runtime directories accordingly, even though DynamicUser still ships as "yes" for these units...

    It's safe to turn them off now, I'm doing that on Fedora due to another issue with SELinux compatibility...

    Cheers,
    Filipe

  2. reopened this on Jul 23, 2018
  3. mbiebl commented on Jul 23, 2018

    @mbiebl
    Contributor

    No, this issue is not fixed. With a statically allocated user this error message should not show up.

  4. filbranden commented on Jul 24, 2018

    @filbranden
    Contributor

    @mbiebl So, one option would be to set DynamicUser=no on the downstream package... As long as you have #9586 backported, that should be a safe setting.

  5. mbiebl commented on Jul 24, 2018

    @mbiebl
    Contributor

    @filbranden why? Using DynamicUser=yes and a statically allocated system user is documented to work. It also turns on a couple of other flags (like PrivateTmp) which we actually want

  6. yuwata commented on Jul 25, 2018

    @yuwata
    Member

    BTW, I have not seen this message. Is this shown only when selinux is enabled?

  7. yuwata commented on Jul 25, 2018

    @yuwata
    Member

    @ryutaroh-matsumoto The message is shown even when AppArmor is disabled?

  8. mbiebl commented on Jul 25, 2018

    @mbiebl
    Contributor

    @yuwata I can reproduce the problem in a pristine Debian buster qemu VM. SELinux is not enabled, disabling AppArmor makes no difference

  9. mbiebl commented on Jul 25, 2018

    @mbiebl
    Contributor

    Interestingly, this only happens for resolved. timesyncd and networkd (which also have a statically allocated system user and DynamicUser=yes) don't show this error message.

  10. 5 remaining items

  11. yuwata commented on Jul 26, 2018

    @yuwata
    Member

    @filbranden Hmm.

    $ id systemd-resolve
    uid=988(systemd-resolve) gid=981(systemd-resolve) groups=981(systemd-resolve)
    $ cat /etc/group | grep 988
    unbound:x:988:
    

    But still I cannot reproduce this...

  12. yuwata commented on Jul 26, 2018

    @yuwata
    Member

    GID 102 was allocated by systemd-network... So gid_is_valid() will accept it...

    gid_is_valid() just checks the value in a range, and not checks whether the group exists or not.

  13. filbranden commented on Jul 26, 2018

    @filbranden
    Contributor

    Maybe try daemon-reload?

    There's two log lines with systemd-resolved.service: User lookup succeeded: uid=102 gid=102 and only the second one has gid=102... Maybe it's going through a separate code path that triggers it? (There's one code path that assumes numeric ids and runs parse_uid...)

  14. yuwata commented on Jul 26, 2018

    @yuwata
    Member

    Oh, finally, I reproduce this. Adding ExecStartPost= causes this.

  15. yuwata commented on Jul 26, 2018

    @yuwata
    Member

    Hmm. So, the problem is that only UID is stored in the storage socket...

  16. yuwata commented on Jul 26, 2018

    @yuwata
    Member

    Fix is waiting in #9720.

  17. added
    bug 🐛
    on Jul 26, 2018
  18. added a commit that references this issue on Jul 26, 2018
    25a1df7
  19. added a commit that references this issue on Oct 31, 2018
    7b21067
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛pid1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions