Log the cgroups version into the debug output
The migration to cgroups v2 in Fedora 31 [1] has proved a bit stormy. This is meant to help users self-diagnose whether their problems might be originating from the use of cgroups v2. [1] https://fedoraproject.org/wiki/Changes/CGroupsV2 https://github.com/containers/toolbox/pull/309
This commit is contained in:
parent
d3e0f3df06
commit
2142cdd612
1 changed files with 25 additions and 0 deletions
25
toolbox
25
toolbox
|
@ -22,6 +22,7 @@ arguments=""
|
||||||
assume_yes=false
|
assume_yes=false
|
||||||
base_toolbox_command=$(basename "$0" 2>&3)
|
base_toolbox_command=$(basename "$0" 2>&3)
|
||||||
base_toolbox_image=""
|
base_toolbox_image=""
|
||||||
|
cgroups_version=""
|
||||||
|
|
||||||
# Based on the nameRegex value in:
|
# Based on the nameRegex value in:
|
||||||
# https://github.com/containers/libpod/blob/master/libpod/options.go
|
# https://github.com/containers/libpod/blob/master/libpod/options.go
|
||||||
|
@ -442,6 +443,24 @@ enter_print_container_not_found()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
get_cgroups_version()
|
||||||
|
(
|
||||||
|
version=1
|
||||||
|
|
||||||
|
if ! mounts=$(mount 2>&3); then
|
||||||
|
echo "$base_toolbox_command: failed to detect cgroups version: couldn't list mount points" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! (echo "$mounts" | grep "^cgroup " >/dev/null 2>&3) && (echo "$mounts" | grep "^cgroup2 " >/dev/null 2>&3); then
|
||||||
|
version=2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$version"
|
||||||
|
return 0
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
get_group_for_sudo()
|
get_group_for_sudo()
|
||||||
(
|
(
|
||||||
group=""
|
group=""
|
||||||
|
@ -2164,6 +2183,12 @@ if [ -f /run/.containerenv ] 2>&3; then
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if ! cgroups_version=$(get_cgroups_version); then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$base_toolbox_command: running on a cgroups v$cgroups_version host" >&3
|
||||||
|
|
||||||
if [ "$op" != "reset" ] 2>&3; then
|
if [ "$op" != "reset" ] 2>&3; then
|
||||||
if ! migrate; then
|
if ! migrate; then
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Reference in a new issue