LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Containers
User Name
Password
Linux - Containers This forum is for the discussion of all topics relating to Linux containers. Docker, LXC, LXD, runC, containerd, CoreOS, Kubernetes, Mesos, rkt, and all other Linux container platforms are welcome.

Notices


Reply
  Search this Thread
Old 03-11-2022, 02:40 PM   #1
doskanoness
LQ Newbie
 
Registered: Oct 2021
Distribution: Arch Linux, Debian, OpenBSD
Posts: 14

Rep: Reputation: Disabled
Gentoo - systemd LXC containers not working under OpenRC


Hello, I created a doskanoness cgroup namespace for my LXC containers but containers with systemd don't work.
The bash script that creates namespaces:
Code:
#!/bin/bash
mountpoint -q "/sys/fs/cgroup/systemd" \
    || (mkdir -p /sys/fs/cgroup/systemd && mount -t cgroup cgroup -o none,name=systemd /sys/fs/cgroup/systemd)

for d in /sys/fs/cgroup/*; do
    f=$(basename $d)
    if [ "$f" = "unified" ]; then
        continue
    elif [ "$f" = "cpuset" ]; then
        echo 1 > $d/cgroup.clone_children;
    elif [ "$f" = "memory" ]; then
        echo 1 > $d/memory.use_hierarchy;
    fi
    mkdir -p $d/doskanoness
    chown -R doskanoness:doskanoness $d/doskanoness
done
Before editing /etc/cgroup/cgrules.conf and reboot:
Code:
doskanoness@lxc-gentoo ~ $ cat /proc/self/cgroup 
15:name=systemd:/
14:misc:/doskanoness
13:pids:/doskanoness
12:hugetlb:/doskanoness
11:net_prio:/doskanoness
10:perf_event:/doskanoness
9:net_cls:/doskanoness
8:freezer:/doskanoness
7:devices:/doskanoness
6:memory:/doskanoness
5:blkio:/doskanoness
4:cpuacct:/doskanoness
3:cpu:/doskanoness
2:cpuset:/doskanoness
1:name=openrc:/sshd
0::/ssh
doskanoness@lxc-gentoo ~ $ cat /etc/cgroup/cgrules.conf 
# /etc/cgrules.conf
#The format of this file is described in cgrules.conf(5)
#manual page.
#
# Example:
#<user>         <controllers>   <destination>
#@student       cpu,memory      usergroup/student/
#peter          cpu             test1/
#%              memory          test2/
doskanoness     misc,pids,hugetlb,net_prio,perf_event,net_cls,freezer,devices,memory,blkio,cpuacct,cpu,cpuset           doskanoness/
# End of file
doskanoness@lxc-gentoo ~ $ cat /etc/cgroup/cgred.conf 
# /etc/sysconfig/cgred.conf - CGroup Rules Engine Daemon configuration file
# 
# The four options listed below (CONFIG_FILE, LOG_FILE, NODAEMON, LOG) are
# the only valid ones.  Defining anything else in this file will cause the
# CGroup Rules Engine program to fail.  So, don't do it.

# The pathname to the configuration file for CGroup Rules Engine
CONFIG_FILE="/etc/cgroup/cgrules.conf"

# Uncomment the following line to log to specified file instead of syslog
#LOG_FILE="/var/log/cgrulesengd.log"

# Uncomment the second line to run CGroup Rules Engine in non-daemon mode
NODAEMON=""
#NODAEMON="--nodaemon"

# Set owner of cgred socket. 'cgexec' tool should have write access there
# (either using suid and/or sgid permissions or Linux capabilities).
SOCKET_USER=""
SOCKET_GROUP="cgred"

# Uncomment the second line to disable logging for CGroup Rules Engine
# Uncomment the third line to enable more verbose logging.
LOG=""
#LOG="--nolog"
#LOG="-v
and after:
Code:
doskanoness@lxc-gentoo ~ $ cat /proc/self/cgroup 
15:name=systemd:/
14:misc:/
13:pids:/
12:hugetlb:/
11:net_prio:/
10:perf_event:/
9:net_cls:/
8:freezer:/
7:devices:/
6:memory:/
5:blkio:/
4:cpuacct:/
3:cpu:/
2:cpuset:/
1:name=openrc:/sshd
0::/sshd
doskanoness@lxc-gentoo ~ $ cat /etc/cgroup/cgrules.conf 
# /etc/cgrules.conf
#The format of this file is described in cgrules.conf(5)
#manual page.
#
# Example:
#<user>         <controllers>   <destination>
#@student       cpu,memory      usergroup/student/
#peter          cpu             test1/
#%              memory          test2/
doskanoness     name=systemd,name=openrc,misc,pids,hugetlb,net_prio,perf_event,net_cls,freezer,devices,memory,blkio,cpuacct,cpu,cpuset          doskanoness/
# End of file
doskanoness@lxc-gentoo ~ $ cat /etc/cgroup/cgred.conf 
# /etc/sysconfig/cgred.conf - CGroup Rules Engine Daemon configuration file
# 
# The four options listed below (CONFIG_FILE, LOG_FILE, NODAEMON, LOG) are
# the only valid ones.  Defining anything else in this file will cause the
# CGroup Rules Engine program to fail.  So, don't do it.

# The pathname to the configuration file for CGroup Rules Engine
CONFIG_FILE="/etc/cgroup/cgrules.conf"

# Uncomment the following line to log to specified file instead of syslog
#LOG_FILE="/var/log/cgrulesengd.log"

# Uncomment the second line to run CGroup Rules Engine in non-daemon mode
NODAEMON=""
#NODAEMON="--nodaemon"

# Set owner of cgred socket. 'cgexec' tool should have write access there
# (either using suid and/or sgid permissions or Linux capabilities).
SOCKET_USER=""
SOCKET_GROUP="cgred"

# Uncomment the second line to disable logging for CGroup Rules Engine
# Uncomment the third line to enable more verbose logging.
LOG=""
#LOG="--nolog"
#LOG="-v"
doskanoness@lxc-gentoo ~ $ echo $$
2585
doskanoness@lxc-gentoo ~ $ sudo cgclassify -g name=systemd:doskanoness 2585
Error changing group of pid 2585: Success
The full output of cgrules -d: https://dpaste.com/85P8FTS5S
What should I put in /etc/cgroup/cgrules.conf to assign doskanoness cgroup to the name=systemd controller?
Thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: The rocky road to better Linux software installation: Containers, containers, containers LXer Syndicated Linux News 0 11-27-2021 10:49 AM
LXer: Everything You Need to Know about Linux Containers, Part II: Working with Linux Containers (LXC) LXer Syndicated Linux News 0 08-27-2018 01:53 PM
[SOLVED] Can't start NFS with systemd, works on OpenRC TobiSGD Linux - Server 1 07-09-2014 02:53 PM
SysVinit vs OpenRC vs systemd vs other init system cristi92b Linux - Newbie 2 01-07-2013 03:02 AM
LXer: How to use Linux containers (lxc) under Debian Squeeze LXer Syndicated Linux News 0 09-20-2011 09:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Containers

All times are GMT -5. The time now is 12:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration