Skip to content

Test failures on Ubuntu containers (no cgroup mount found in mountinfo) #49

Closed

Description

@LocutusOfBorg

Hello, some tests are failing when building new version under Ubuntu.
I can presume that systemd is not installed into the build environment, but maybe it is shown as running because it runs on the host?
https://launchpadlibrarian.net/827407202/buildlog_ubuntu-resolute-amd64.golang-github-opencontainers-cgroups_0.0.4-2_BUILDING.txt.gz

=== RUN TestInvalidCgroupPath
paths_test.go:19: couldn't get cgroup root: no cgroup mount found in mountinfo
--- FAIL: TestInvalidCgroupPath (0.00s)
=== RUN TestTryDefaultCgroupRoot
paths_test.go:102: tryDefaultCgroupRoot: want "/sys/fs/cgroup", got ""
--- FAIL: TestTryDefaultCgroupRoot (0.00s)
=== RUN TestPidsSetMax
--- PASS: TestPidsSetMax (0.00s)
=== RUN TestPidsSetUnlimited
--- PASS: TestPidsSetUnlimited (0.00s)
=== RUN TestPidsStats
--- PASS: TestPidsStats (0.00s)
=== RUN TestPidsStatsUnlimited
--- PASS: TestPidsStatsUnlimited (0.00s)
FAIL
FAIL github.com/opencontainers/cgroups/fs 0.075s
=== RUN TestParseCgroupFromReader
--- PASS: TestParseCgroupFromReader (0.00s)
=== RUN TestDefaultDirPath
defaultpath_test.go:52: need cgroupv2

? github.com/opencontainers/cgroups/internal/path [no test files]
=== RUN TestNilResources
manager_test.go:40: no cgroup mount found in mountinfo
--- FAIL: TestNilResources (0.00s)
=== RUN TestNilResourcesSystemd
manager_test.go:24: requires systemd
--- SKIP: TestNilResourcesSystemd (0.00s)
FAIL
FAIL github.com/opencontainers/cgroups/manager 0.004s
=== RUN TestRangeToBits

Activity

  1. LocutusOfBorg commented on Oct 29, 2025

    @LocutusOfBorg
    Author

    Looks like it fails also in Debian under pbuilder environment

    golang-github-opencontainers-cgroups_0.0.4-2_amd64.build.txt

  2. changed the title [-]Test failures on Ubuntu containers[/-] [+]Test failures on Ubuntu containers (`no cgroup mount found in mountinfo`)[/+] on Oct 31, 2025
  3. siretart commented on Nov 4, 2025

    @siretart

    sounds like this function is not detecting the Ubuntu/Debian build environment correctly:

    cgroups/utils.go

    Lines 35 to 51 in e0c56cb

    func IsCgroup2UnifiedMode() bool {
    isUnifiedOnce.Do(func() {
    var st unix.Statfs_t
    err := unix.Statfs(unifiedMountpoint, &st)
    if err != nil {
    level := logrus.WarnLevel
    if os.IsNotExist(err) && userns.RunningInUserNS() {
    // For rootless containers, sweep it under the rug.
    level = logrus.DebugLevel
    }
    logrus.StandardLogger().Logf(level,
    "statfs %s: %v; assuming cgroup v1", unifiedMountpoint, err)
    }
    isUnified = st.Type == unix.CGROUP2_SUPER_MAGIC
    })
    return isUnified
    }

  4. kolyshkin commented on Feb 11, 2026

    @kolyshkin
    Contributor

    Well, you have to have either cgroup v1 or cgroup v2 at /sys/fs/cgroup. Currently it assumes cgroup v1 if none are found, and I guess this assumption fails on a cgroup v2 host.

    Maybe it's time to switch the default to cgroup v2 (and see another set of bugs, but what can we do?).

  5. kolyshkin commented on Feb 11, 2026

    @kolyshkin
    Contributor

    OK, some tests in here requires real cgroup v1 or cgroup v2, which is not available inside a debian/ubuntu test environment. Is there some env var I can use to skip those tests?

  6. LocutusOfBorg commented on Apr 9, 2026

    @LocutusOfBorg
    Author

    Hello, I don't know if the question was to me, but to detect the cgroup version, according to some googling, we can do:
    grep cgroup /proc/filesystems
    nodev cgroup
    nodev cgroup2

    stat -fc %T /sys/fs/cgroup/
    cgroup2fs

  7. added 2 commits that reference this issue on Nov 23, 2026
    be48d24
    c5829e5
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions