Questions tagged [cgroups]

Linux cgroups (control groups) allow limiting and accounting for resources on a system, including CPU, memory, and block I/O.

Filter by
Sorted by
Tagged with
0
votes
0answers
23 views

cgroup v2 host/guest cpu/memory limit discovery

Say there is a systemd-nspawn machine guest container running with cpu and memory limits imposed by the host systemd service cgroup configuration. Short of exposing/mounting host's /sys/fs/cgroup tree ...
1
vote
0answers
24 views

How can I learn why kswapd has very low page reclaim efficiency?

Problem/context I have a (managed) Postgres 10.16 instance running on Fedora 32 in a systemd-nspawn container. Periodically, I see a big spike in "system" CPU usage in our metrics, ...
2
votes
0answers
32 views

How do I send signal to all processes in a cgroup?

kill $(< /sys/fs/cgroup/freezer/<name>/tasks ) works, but looks clumsy, produces a warning if cgroup is empty and may hit command line length limit. pkill -F does not accept cgroup tasks file ...
0
votes
0answers
13 views

Create systemd subgroup on boot (cgroups v1)

I would like to create a subdirectory under the systemd cgroup automatically every boot (Ex. /sys/fs/cgroup/systemd/mycgroup) Is there a way to do this? For the other cgroup controllers, this can be ...
0
votes
0answers
16 views

Ubuntu slows down, then freezes - causes, solving (with CGROUPS) and prevention

I'm using Ubuntu 20.04 and sometimes it happens from a second to the other the system gets slower and slower and eventually freezes entirely. My top candidates causing that are Kaspersky, Spotify, MS ...
0
votes
0answers
15 views

systemd cgroups v2 - limit ram for normal users, don't limit root

I'm trying to limit total memory used by all (normal) users together to say 80%. For this I set MemoryHigh=80% on user.slice. That works fine except this limit is also imposed on root user and I'd ...
1
vote
0answers
28 views

“No space left on device” with cgroups v2 writing empty string to `cpuset.cpus`

I'm using Linux 5.11 in the unified cgroups v2 configuration. Following cgroups-v2.rst, I'm trying to reset cpuset assignment of a non-root cgroup (to make it inherit the parent's cpuset). According ...
0
votes
0answers
28 views

Why there is a /sys/fs/cgroup/systemd/ folder on my Alpine based container?

I am a bit confused about why there is a /sys/fs/cgroup/systemd/ entry inside my alpine container (no systemd installed). On the docker host I can find my container under /sys/fs/cgroup/systemd/docker/...
0
votes
1answer
42 views

Make a binary to always run in a cgroup

I want to make sure a binary located at certain path is always run as part of a certain cgroup. Everything I found so far involves running the binary through some special command (e.g. with systemd-...
1
vote
0answers
50 views

How can I restrict the network access of a systemd service?

I have a custom systemd service which I want to restrict to the local interface. On ctrl.blog systemd application firewalls examples I found that it should be possible to achieve this using only the ...
0
votes
0answers
8 views

Why Cgroups release_agent file runs as executable?

I know the relation between the notify_on_release and the release_agent file but I didn't understand that why when notify_on_release is 1, the path inside the release_agent file runs as binary? What ...
2
votes
0answers
35 views

Why memory in /proc/cgroup is different from the total I calculate from file system?

There are two methods to get the total of memory cgroup, calculate it from file system like find /sys/fs/cgroup/memory -type d | wc -l or cat /proc/cgroups. But I find that the two methods get ...
0
votes
2answers
49 views

The service cgconfig won't start because it cannot be found

I am trying to create a cgroup hierarchy by following this tutorial I installed the libcgroup package using dnf install libcgroup and the installation was successful. I tried to check the status of ...
1
vote
0answers
23 views

iptables cgroup filter not matching

I need to make sure only specific services can access my vpn's virtual interface. From what I can tell, using iptables to filter based on process cgroup membership is the cleanest way to do that. So, ...
1
vote
0answers
26 views

Limit GPU Resource to a particular process

The ulimit command can limit the memory to a process in the Linux machine. Similarly, is there any command in Linux to run a process with limited GPU resource. For example, I have a 64 GB GPU machine, ...
2
votes
0answers
48 views

Running command under systemd slice works for root, but not user

I'm trying to execute a command under some resource limits. This correctly limits my-bin to just 1 CPU core. I'm able to verify with htop. $ sudo systemd-run -p AllowedCPUs=0 -- ./my-bin However, ...
0
votes
1answer
118 views

How do I use cgroups in fstab instead of default /sys/fs/cgroup from systemd?

I want to mount my cgroups from fstab instead of allowing systemd to mount them at /sys/fs/cgroup. I have my fstab written with targets such as /cgroup/cpu, /cgroup/blkio.. etc. When I boot up, the ...
0
votes
0answers
22 views

File changes made during execution of shell script on overlay filesystem are not visible before the shell script exits?

I have been experimenting with Docker and how some of the options of docker run ..., e.g. --privileged, may be abused for container-to-host escapes. The following cgroup_escape.sh script abuses the ...
0
votes
0answers
126 views

CloudLinux 7 with Docker - problem with cgroup devices.list

I have server with CloudLinux and I am trying to run Docker. I installed Docker Engine using official docs for CentOS (https://docs-stage.docker.com/engine/install/centos/). Docker version 20.10.2, ...
0
votes
0answers
27 views

Set resource limit per user dynamically

I'm managing a server with 32G of RAM and potentially n user, let's say for example 4. Available RAM per user should be dynamically set by number of user processes running. User 1 login to the server. ...
0
votes
0answers
63 views

Runit chpst vs cgroups

What is the relationship between cgroups and Runit's chpst? Which should I use, or both? Does chpst use cgroups? cgroups restrictions apply to child processes; does this apply to chpst? Is either one ...
0
votes
1answer
201 views

How do I list properties with `systemctl`?

You can set a property with systemctl using, set-property UNIT PROPERTY=VALUE... Sets one or more properties of a unit But how do I find the properties that can be set? I'm looking for a list-...
1
vote
0answers
34 views

Hide HOST resources from a docker container [duplicate]

I have a linux server with 100GB of RAM & 56Cores, I run a docker container with limit in Memory and CPU and I use cgroups too (I limited Memory & CPU to 50GB & 20Cores). With all that ...
0
votes
0answers
110 views

Creating a cgroup2 controller, getting: echo: write error: No such file or directory

When I try to create a pids controller in cgroup2, I get bash: echo: write error: No such file or directory What am I doing wrong, # cd /sys/fs/cgroup/unified # mkdir newgroup # cd newgroup/ # echo '...
0
votes
2answers
69 views

Why, after unmounting cgroup v1, do I still have empty directories under /sys/fs/cgroup?

I just unmounted cgroup version 1, leaving just a single cgroup2 mount on my system. $ mount | grep -i cgroup tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,size=4096k,nr_inodes=1024,mode=...
0
votes
1answer
39 views

How can I find the compile options of systemd?

If I want to find out the compile options of cgroup (version 1 or version 2), such as the systemd.unified_cgroup_hierarchy it was compiled with, how can I find this?
0
votes
1answer
28 views

How can I unmount cgroup version 1?

How can I remove cgroup version 1 mount points such that I only cgroup version 2 in my /sys/fs/?
0
votes
1answer
42 views

How can I find what is using cgroup version 1?

My kernel supports cgroup and cgroup2 and both of them are mounted. I'm interested in finding out if any of the applications I am running are using the legacy cgroup version 1? Is there anyway to ...
0
votes
1answer
79 views

What specifies the version of cgroups (cgroups or cgroups2) used by the distro?

I'm running on Debian. When I run mount | grep -i cgroup, I see, tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,size=4096k,nr_inodes=1024,mode=755) cgroup2 on /sys/fs/cgroup/unified type ...
1
vote
1answer
61 views

Linux cgroups: task vs pid?

What is the difference between a task and a pid? Inside of the /sys/fs/cgroup there a file called tasks which lists just pids, $ ls /sys/fs/cgroup/*/tasks /sys/fs/cgroup/blkio/tasks /sys/fs/...
1
vote
0answers
20 views

Learning about cgroups and namespace [closed]

Does anyone know of a good way of learn about cgroups and namespaces. Most Linux books do not seem to cover this topic for some reason or the other. In particular I want to be able to control ...
0
votes
1answer
213 views

cgroups v2: cgroup controllers not delegated to non-privileged users on CentOS Stream (8)

I am currently trying to configure my more or less fresh installation of CentOS Stream (8) to delegate cgroup controllers to non-privileged users. However, I fail at this and I've searched the web for ...
3
votes
0answers
30 views

Which namespaces are the executable specified by `release_agent` executed in, when the last task leaves the cgroup?

Reading the documentation for Linux cgroups, I've come across the notify_on_release flag and how it relates to release_agent, i.e. the kernel runs the executable specified by release_agent, if ...
0
votes
0answers
11 views

Allow a service to run a command in a different slice

I have a service which spawns subprocesses. Those processes should have restricted resources (specifically maximum memory). The service is running as a non-root user. Is there a way that I can create ...
0
votes
1answer
181 views

How can I find out what version of cgroups I have?

Apparently the kernel supports a cgroups1 and cgroups2. How can I find which version I have?
0
votes
0answers
33 views

Prevent any one process from hogging CPU/RAM causing lock-up?

It's happened to me a few times that something has started to consume a crazy amount of CPU or RAM, making the system unusable to me even to kill it; so my only option is a (physical) reboot. A couple ...
2
votes
0answers
43 views

Placing the entire Xserver and GUI inside a cgroup/slice?

With the intent to guarantee a minimum amount of cpu cycles to keep the desktop environment smooth and snappy, Questions: Is it doable? Would this be a good idea? How would you go about doing this? ...
0
votes
0answers
96 views

Systemd memory limit seems to not consider all memory used by process

I have a systemd service configured like this: [Unit] Description=High Performance Advanced Proxy for MySQL After=network.target [Service] Type=forking RuntimeDirectory=proxysql ExecStart=/usr/bin/...
1
vote
1answer
305 views

how do I check if system is using cgroupv1?

docker can only use cgroupv1, but fedora by default only use cgroupv2. How do I check if system is cgroupv1 compatible? So far answer in this question can only determine if cgroupv2 is installed. But ...
0
votes
0answers
64 views

what is the best way to remove unused cgroups?

I have a master process that creates so many child processes on demand and jail each of them with a cgroup (say cpu cgroup). What is the best way to remove the unused cgroup hirearchy. Currently i am ...
0
votes
0answers
80 views

Handling USER_HZ and the output from cpuacct.usage

I am writing a program that is supposed help run foreign code "safely". I also want to get the memory utilization and CPU compute time for the foreign code so I thought I would use cgroups. ...
0
votes
0answers
18 views

Two interfaces, mark packets to balance connections based on process groups, packets not forwarded

I hope that someone can help me since I spent almost entire evening trying to deal with packet marking and routing. I have two interfaces: eno2 and wlo1. I want eno2 to be the default interface and ...
1
vote
1answer
88 views

Using cgroups and nice with respect to the same process - does the order matter? What is the correct syntax?

I created a CGROUP on my desktop called background. The purpose of this group is to run all my sysadmin scripts within its CPU limit of 10%. The group is created on every reboot with the following ...
0
votes
0answers
234 views

Can't change cgroup settings, receive an error “no such file or directory”

Trying to work with Cgroups v2 on Debian Linux 9 Stretch. # uname -r 4.9.0-7-amd64 # uname -a Linux mycomp 4.9.0-7-amd64 #1 SMP Debian 4.9.110-1 (2018-07-05) x86_64 GNU/Linux As described in Linux ...
0
votes
1answer
23 views

How to install cgroup man pages on Fedora?

I want to install cgroup man pages on Fedora, but I can't find any package that contains it.
0
votes
0answers
38 views

Syntax for using systemd-run to limit CPU and memory usage of multiple processes?

I would like to use Linux control groups (cgroups) to limit CPU and RAM usage of multiple processes. If the processes are Process 1 and Process 2 with child process Process 2 Sub, would this be the ...
0
votes
1answer
730 views

cgroups: how to detach a process from cgroup

I have created a cgroup mygroup in my system and running a process under it cgexec -g memory,cpu:groupname/mygroup someprocess Now after some time when i feel there is no need to worry about the cpu ...
0
votes
1answer
40 views

Can you create your own top-level cgroup?

The docs seem to suggest this should work # mkdir /sys/fs/cgroup/mytest # mount -t cgroup mytest /sys/fs/cgroup/mytest mount: /sys/fs/cgroup/mytest: mytest already mounted or mount point busy. What ...
1
vote
1answer
154 views

Sharing a Partition Between Windows and Linux Throws Permission Errors

I created a new partition in Windows 10 formatted as Fat32, so that I could work with files located in one place despite being logged into my MX Linux installation or Windows 10. While logged into ...
1
vote
0answers
21 views

Why does “some” line have higher delay that “full” one due to memory pressure?

I have the following stats: cat /sys/fs/cgroup/user.slice/memory.pressure some avg10=0.00 avg60=0.00 avg300=0.00 total=1954777 full avg10=0.00 avg60=0.00 avg300=0.00 total=1626895 The documentation ...

1
2 3 4 5 6