Skip to content

cgroup v2 error - "sed: write error" #308

Description

@gene-miller

The 'dind' script assumes that the dockerd process will start with pid 1.
This is often not the case when building from the dind image and this causes an error "sed: write error" on systems that use cgroup v2.

Could I suggest checking the process ID of dockerd rather than assuming it is 1 in the dind script? Something like:

# cgroup v2: enable nesting
if [ -f /sys/fs/cgroup/cgroup.controllers ]; then
	# move the init process (PID 1) from the root group to the /init group,
	# otherwise writing subtree_control fails with EBUSY.
	mkdir -p /sys/fs/cgroup/init
	DOCKERDPID=$(/usr/bin/pgrep dockerd | wc -l)
	echo $DOCKERDPID > /sys/fs/cgroup/init/cgroup.procs
	# enable controllers
	sed -e 's/ / +/g' -e 's/^/+/' < /sys/fs/cgroup/cgroup.controllers > /sys/fs/cgroup/cgroup.subtree_control
fi

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