cgexec 不继承 LD_LIBRARY_PATH

cgexec 不继承 LD_LIBRARY_PATH

我的/etc/cgconfig.conf文件包括

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;
}

# make sure this cgroup cannot run more than 100%
group proc1 {
        perm {
                task {
                        uid = jmichael;
                        gid = hpcfadmins;
                } admin {
                        uid = jmichael;
                        gid = hpcfadmins;
                }
        }
        cpu {
                cpu.cfs_quota_us = "1000000";
                cpu.cfs_period_us = "1000000";
        }
}

group proc2 {
        cpu {
                cpu.cfs_quota_us = "2000000";
                cpu.cfs_period_us = "1000000";
        }
}

我注意到,在运行cgexec -g cpu:proc1 myCode.sh(包含使用特定版本编译的二进制文件gcc) 时,它会抱怨库。经过进一步调查,我发现它env给出的结果与不同cgexec -g cpu:proc1 env。具体来说,LD_LIBRARY_PATH它不包含在版本的输出中cgexec

我如何cgexec继承我的LD_LIBRARY_PATH

作为一个简单的测试,请注意以下命令的结果:

$ env | grep 'LD_LIBRARY_PATH' | sed 's/=.*//'
LD_LIBRARY_PATH
$ cgexec -g cpu:proc1 env | grep 'LD_LIBRARY_PATH' | sed 's/=.*//'
$

相关内容