You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu24.04部署DOMjudge时cgroup内存特性缺失问题求助

Ubuntu 24.04部署DOMjudge JudgeHost时cgroup内存功能缺失问题

问题详情

在Ubuntu 24.04上部署DOMjudge的JudgeHost组件时,出现以下错误:

错误:运行中的内核缺少cgroup内存功能支持,无法继续

已完成以下操作但问题未解决:

  • 在/etc/default/grub的GRUB_CMDLINE_LINUX_DEFAULT中添加参数cgroup_enable=memory swapaccount=1 systemd.unified_cgroup_hierarchy=0
  • 执行sudo update-grub
  • 多次重启系统

相关系统输出

  1. 内核启动参数(cat /proc/cmdline):
BOOT_IMAGE=/boot/vmlinuz-6.8.0-48-generic root=UUID=0df047a9-dd1e-4d30-a9f0-dfce8fbc340c ro cgroup_enable=memory swapaccount=1 systemd.unified_cgroup_hierarchy=0
  1. sudo update-grub执行结果:
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.8.0-48-generic
Found initrd image: /boot/initrd.img-6.8.0-48-generic
Found linux image: /boot/vmlinuz-6.8.0-47-generic
Found initrd image: /boot/initrd.img-6.8.0-47-generic
Found linux image: /boot/vmlinuz-6.8.0-45-generic
Found initrd image: /boot/initrd.img-6.8.0-45-generic
Found memtest86+ 64bit EFI image: /boot/memtest86+x64.efi
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done
  1. 当前/etc/default/grub相关配置:
GRUB_CMDLINE_LINUX_DEFAULT="cgroup_enable=memory swapaccount=1 systemd.unified_cgroup_hierarchy=0"

排查与解决方案

1. 确认cgroup v1内存控制器挂载状态

执行命令检查内存控制器是否正常挂载:

mount | grep cgroup

正常输出应包含cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)。若缺失,手动挂载:

sudo mount -t cgroup cgroup /sys/fs/cgroup/memory -o memory

2. 验证swapaccount功能是否生效

执行命令查看swap统计功能状态:

cat /sys/fs/cgroup/memory/memory.swapaccount

输出为1表示功能正常;若为0,需确认内核是否开启CONFIG_MEMCG_SWAP和CONFIG_MEMCG_SWAP_ENABLED配置(Ubuntu默认内核已开启,自定义内核需检查编译选项)。

3. 检查systemd对cgroup的配置

编辑/etc/systemd/system.conf,确保以下配置项正确设置:

DefaultControllers=memory cpuset cpu cpuacct io hugetlb pids rdma misc
DefaultMemoryAccounting=yes

修改后执行sudo systemctl daemon-reload并重启系统。

4. 确认cgroup v1内存限制文件存在

DOMjudge JudgeHost依赖cgroup v1的memory.limit_in_bytes文件,执行命令检查:

ls /sys/fs/cgroup/memory/ | grep memory.limit_in_bytes

若文件缺失,尝试加载相关内核模块:

sudo modprobe cgroupparser

5. 备选方案:切换至cgroup v2

若cgroup v1配置始终无效,可尝试启用cgroup v2:

  1. 修改/etc/default/grub,将systemd.unified_cgroup_hierarchy=0改为systemd.unified_cgroup_hierarchy=1
  2. 执行sudo update-grub并重启系统
  3. 确认cgroup v2启用:mount | grep cgroup2

内容的提问来源于stack exchange,提问作者Innovation Lab

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.15 21:04:54