Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure all output goes to stderr #2146

Merged
merged 3 commits into from
Sep 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions judge/create_cgroups.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ JUDGEHOSTUSER=@DOMJUDGE_USER@
CGROUPBASE=@judgehost_cgroupdir@

print_cgroup_instruction () {
echo ""
echo "$1" >&2
echo "" >&2
echo "To fix this, please make the following changes:
1. In /etc/default/grub, add 'cgroup_enable=memory swapaccount=1' to GRUB_CMDLINE_LINUX_DEFAULT.
On modern distros (e.g. Debian bullseye and Ubuntu Jammy Jellyfish) which have cgroup v2 enabled by default,
Expand All @@ -24,16 +25,14 @@ for i in cpuset memory; do
mkdir -p $CGROUPBASE/$i
if [ ! -d $CGROUPBASE/$i/ ]; then
if ! mount -t cgroup -o$i $i $CGROUPBASE/$i/; then
echo "Error: Can not mount $i cgroup. Probably cgroup support is missing from running kernel. Unable to continue."
print_cgroup_instruction
print_cgroup_instruction "Error: Can not mount $i cgroup. Probably cgroup support is missing from running kernel. Unable to continue."
ankon marked this conversation as resolved.
Show resolved Hide resolved
fi
fi
mkdir -p $CGROUPBASE/$i/domjudge
done

if [ ! -f $CGROUPBASE/memory/memory.limit_in_bytes ] || [ ! -f $CGROUPBASE/memory/memory.memsw.limit_in_bytes ]; then
echo "Error: cgroup support missing memory features in running kernel. Unable to continue."
print_cgroup_instruction
print_cgroup_instruction "Error: cgroup support missing memory features in running kernel. Unable to continue."
fi

chown -R $JUDGEHOSTUSER $CGROUPBASE/*/domjudge
Expand Down
Loading