【问题标题】:Centos cgconfig fails to startCentos cgconfig 启动失败
【发布时间】:2017-04-01 12:51:59
【问题描述】:

我需要在我的一台服务器上安装 docker,每当我尝试启动 docker 服务时,它都会因为 cgconfig 而失败。 cgconfig 抛出如下错误:

Starting cgconfig service: Error: cannot mount cpu to /cgroup/cpu: No such file or directory
/sbin/cgconfigparser; error loading /etc/cgconfig.conf: Cgroup mounting failed
Failed to parse /etc/cgconfig.conf or /etc/cgconfig.d      [FAILED]

我正在使用以下 /etc/cgconfig.conf 文件运行 CentOS 6.5 Final:

mount {
    cpuset  = /cgroup/cpuset;
    cpu     = /cgroup/cpu;
    cpuacct = /cgroup/cpuacct;
    memory  = /cgroup/memory;
    devices = /cgroup/devices;
    freezer = /cgroup/freezer;
    net_cls = /cgroup/net_cls;
    blkio   = /cgroup/blkio;
}

感谢任何回复

【问题讨论】:

  • 你解决了吗?

标签: linux configuration centos docker sysadmin


【解决方案1】:

要在较新版本的 CentOS 上使用 cgroups,您需要安装 libcgrouplibcgroup-tools

$ sudo yum install libcgroup
$ sudo yum install libcgroup-tools

创建群组使用cgcreate,例如:

$ sudo cgcreate -g memory,cpu,blkio,cpuset:userlimited

要验证/etc/cgconfig.conf 是否正确,请使用cgconfigparser

$ cgconfigparser -l /etc/cgconfig.conf

详情查看:https://wiki.archlinux.org/index.php/cgroups

注意:在 CentOS 6 及更早版本中,只需安装libcgroup

【讨论】:

    【解决方案2】:

    此错误可能是由于您使用的内核是使用 cgroup_disable=memory 和/或 /etc/cgconfig.conf 启动的 包含“memory=/cgroup/memory”,在您的情况下,您可以通过在 cgconfig.conf 中注释掉“memory = /cgroup/memory”来解决此问题。

    您也可以参考12 了解更多信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-04-04
      • 2017-10-22
      • 1970-01-01
      • 1970-01-01
      • 2014-07-02
      • 2021-04-13
      • 1970-01-01
      相关资源
      最近更新 更多