Skip to content

systemd-nspawn ignores ENV UNIFIED_CGROUP_HIERARCHY=no when -U is used #4181

@eliasp

Description

@eliasp

Submission type

  • Bug report

systemd version the issue has been seen with

Latest git/master (dd83526)

Used distribution

Gentoo, Kernel 4.5.0

In case of bug report: Expected behaviour you didn't see

systemd-nspawn taking the environment variable UNIFIED_CGROUP_HIERARCHY=no into account when running as service (instance of [email protected]).

In case of bug report: Unexpected behaviour you saw

In #4173 (comment) it was suggested to use UNIFIED_CGROUP_HIERARCHY=no to workaround the described issue. While this works fine when manually executing systemd-nspawn, it doesn't seem to have any effect when running it as service.

In case of bug report: Steps to reproduce the problem

  • Create /etc/systemd/system/[email protected]/issue-4008.conf:

    [Service]
    Environment=UNIFIED_CGROUP_HIERARCHY=no
    
  • Reload configuration changes: systemctl daemon-reload

  • Start service: systemctl start systemd-nspawn@dev-web-00000000

  • Inspect the status:

    [email protected] - Container dev-web-00000000
      Loaded: loaded (/usr/lib/systemd/system/[email protected]; disabled; vendor preset: disabled)
    Drop-In: /etc/systemd/system/[email protected]
            └─issue-4008.conf
    Active: active (running) since Mon 2016-09-19 09:49:51 CEST; 1h 40min ago
      Docs: man:systemd-nspawn(1)
    Main PID: 22294 (systemd-nspawn)
      Status: "Container running."
       Tasks: 2 (limit: 16384)
      Memory: 808.0K
         CPU: 27ms
      CGroup: /machine.slice/[email protected]
              ├─22294 /usr/bin/systemd-nspawn --quiet --keep-unit --boot --link-journal=try-guest --network-veth -U --settings=override --machine=dev-web-00000000
              └─22304 /lib/systemd/systemd
    
    Sep 19 09:49:51 moria systemd-nspawn[22294]: Detected virtualization systemd-nspawn.
    Sep 19 09:49:51 moria systemd-nspawn[22294]: Detected architecture x86-64.
    Sep 19 09:49:51 moria systemd-nspawn[22294]: [1B blob data]
    Sep 19 09:49:51 moria systemd-nspawn[22294]: Welcome to Ubuntu 16.04 LTS!
    Sep 19 09:49:51 moria systemd-nspawn[22294]: [1B blob data]
    Sep 19 09:49:51 moria systemd-nspawn[22294]: Failed to read AF_UNIX datagram queue length, ignoring: No such file or directory
    Sep 19 09:49:51 moria systemd-nspawn[22294]: Failed to create /machine.slice/[email protected]/init.scope control group: Permission denied
    Sep 19 09:49:51 moria systemd-nspawn[22294]: Failed to allocate manager object: Permission denied
    Sep 19 09:49:51 moria systemd-nspawn[22294]: [!!!!!!] Failed to allocate manager object, freezing.
    Sep 19 09:49:51 moria systemd-nspawn[22294]: Freezing execution.
    

Further Notes

  • systemctl show systemd-nspawn@dev-web-00000000 | grep Environment correctly shows the variable being set: Environment=UNIFIED_CGROUP_HIERARCHY=no
  • Same goes for strings /proc/22294/environ | grep UNIFIED_CGROUP_HIERARCHY: UNIFIED_CGROUP_HIERARCHY=no

So it seems systemd-nspawn behaves differently when it comes to handling the environment variable UNIFIED_CGROUP_HIERARCHY when started as service vs. being started manually on the command line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Programming errors, that need preferential fixingcgroupsnspawn

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions