New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"WARNING: No {swap,memory} limit support" Ubuntu LTS (Precise) #4250

Closed
steakknife opened this Issue Feb 19, 2014 · 20 comments

Comments

Projects
None yet
5 participants
@steakknife
Copy link
Contributor

steakknife commented Feb 19, 2014

WARNING: No swap limit support
WARNING: No memory limit support

What are the kernel make config vars or other lxc configure'd bits that need to happen for this to work?

@steakknife

This comment has been minimized.

Copy link
Contributor Author

steakknife commented Feb 19, 2014

Kernel config as shipped with Ubuntu LTS amd64 server 12.04.4 (Precise):

https://gist.github.com/9101773

linux-image-3.11.0-15-generic -> linux-image-generic-lts-saucy

@steakknife

This comment has been minimized.

Copy link
Contributor Author

steakknife commented Feb 19, 2014

Oh nuts, is it...

#CONFIG_MEMCG_SWAP_ENABLED is not set -> WARNING: No swap limit support

and

# CONFIG_MEMCG_KMEM is not set -> WARNING: No memory limit support

@tianon

This comment has been minimized.

Copy link
Member

tianon commented Feb 19, 2014

This used to be in our documentation, but has since been removed! I'm PRing to add it back now. In the meantime, see http://docs.docker.io/en/v0.6.3/installation/kernel/#memory-and-swap-accounting-on-debian-ubuntu (which will tell you how to fix this)

@steakknife

This comment has been minimized.

Copy link
Contributor Author

steakknife commented Feb 19, 2014

TL;DR: add cgroup_enable=memory swapaccount=1 to kernel boot options to enable both swap and memory accounting

  1. /etc/default/grub:

    GRUB_CMDLINE_LINUX_DEFAULT="cgroup_enable=memory swapaccount=1"
    
  2. then sudo grub-update && sudo reboot

EDIT, Cred: thanks @tianon

(test it first on the grub boot cli before changing grub files)

Fix for swap limiting only, per http://cateee.net/lkddb/web-lkddb/MEMCG_SWAP_ENABLED.html:

Tested, but for some reason, the "WARNING: No memory limit support" is also gone.

Is Docker correct or is Linux activating both features?

@steakknife

This comment has been minimized.

Copy link
Contributor Author

steakknife commented Feb 19, 2014

@tianon Beat you to it, kinda. Needs to be tested to verify which is actually true. (Both types of limiting are actually happening.)

@steakknife

This comment has been minimized.

Copy link
Contributor Author

steakknife commented Feb 19, 2014

Also thanks for getting on top of it.

@steakknife

This comment has been minimized.

Copy link
Contributor Author

steakknife commented Feb 19, 2014

Btw, validated, cookie-cutter install scripts for Ubuntu LTS server 12.04.4 amd64.

https://gist.github.com/steakknife/9094991

@tianon

This comment has been minimized.

Copy link
Member

tianon commented Feb 20, 2014

Yes, it turns out that swapaccount=1 is the one the kernel actually cares about for pulling in the proper module. cgroup_enable=memory is for badly-written init scripts like libvirt's (whose cgroups mounting might happen before cgroup-lite or our own, so will interfere with us): http://sources.debian.net/src/libvirt/1.2.1-1/debian/libvirt-bin.init#L25

@tianon

This comment has been minimized.

Copy link
Member

tianon commented Feb 20, 2014

See also #4251. :)

@steakknife

This comment has been minimized.

Copy link
Contributor Author

steakknife commented Feb 20, 2014

🍰

On the host box:

Memory accounting

cat /sys/fs/cgroup/memory/lxc/{{full_container_id}}/memory.usage_in_bytes
cat /sys/fs/cgroup/memory/lxc/{{full_container_id}}/memory.limit_in_bytes

Swap accounting

cat /sys/fs/cgroup/memory/lxc/{{full_container_id}}/memory.memsw.usage_in_bytes
cat /sys/fs/cgroup/memory/lxc/{{full_container_id}}/memory.memsw.limit_in_bytes

Memory usage limits are workin' because the OOM killer inside the container works with a low (sorta-documented flag) '-m=1048576' (in bytes).

For posterity, so people writing Nagios checks and collectd stuff will know.

swapaccount=1 only removes BOTH warnings.

Incorrect detection or does Linux enable both features?

cgroup_enable=memory only still shows WARNING: No swap limit support: Correct.

References: https://stackoverflow.com/questions/20096632/limit-memory-on-a-docker-container-doesnt-work (ah, but it does ;)

@steakknife

This comment has been minimized.

Copy link
Contributor Author

steakknife commented Feb 20, 2014

@tianon I'll happily let you take credit, no charge. ;-P

To the other thread, it applies to every Linice kernel distro.

Closing as the PR is good, thanks. 📗 FTW

@frank-dspeed

This comment has been minimized.

Copy link

frank-dspeed commented Sep 15, 2016

@steakknife plz change your answer from grub-update && * to update-grub

sudo grub-update
sudo: grub-update: command not found

sudo update-grub
Generating grub configuration file ...

@agilob

This comment has been minimized.

Copy link

agilob commented Jan 24, 2018

A month ago I this this bug on raspbian, now I got this on debian server. This should be sorted out by docker or Debian :<

@thaJeztah

This comment has been minimized.

Copy link
Member

thaJeztah commented Jan 25, 2018

What’s there to sort out? It’s a configuration option; Docker warns that that configuration option wasn’t set in the kernel

@agilob

This comment has been minimized.

Copy link

agilob commented Jan 25, 2018

On raspbian it caused some images couldn't start at all. I don't remember which ones, but fixing the warning fixed issue with them. Instances were crashing with no error.

@frank-dspeed

This comment has been minimized.

Copy link

frank-dspeed commented Jan 25, 2018

@thaJeztah i think that can be ignored i am using also rasb pi's in production envs the problem is between monitor and chair.
@agilob little tip for your pi setup https://blog.hypriot.com
they offer a kubernetes enabled pi setup out of the box that will fit your needs i think.

@agilob

This comment has been minimized.

Copy link

agilob commented Jan 25, 2018

@frank-dspeed

the problem is between monitor and chair.

Nope, a lot people have this problem and currently the top voted solution is to keep Docker out of date

https://stackoverflow.com/questions/47520693/raspbian-docker-error-response-from-daemon-cgroups-memory-cgroup-not-supporte/47692112

asked | 1 month ago
viewed | 1,443 times

@frank-dspeed

This comment has been minimized.

Copy link

frank-dspeed commented Jan 25, 2018

@agilob Another solution is to add cgroup_enable=memory cgroup_memory=1 in /boot/cmdline.txt at the end of the line and reboot.

so this is not a new issue simply enable it !

@agilob

This comment has been minimized.

Copy link

agilob commented Jan 25, 2018

I'm not saying that a new issue, I'm saying this issue is starting to hit mainstream. A month ago I hit that on raspbian (you can see my comment on the SO question), this week I had the same thing on Debian OVH dedicated server. Docker should talk with other people (debian?) to put this config by default or docker installation script should put this config.

@thaJeztah

This comment has been minimized.

Copy link
Member

thaJeztah commented Jan 25, 2018

It looks like you commented on the wrong issue then, and likely were looking for #35587;

The problem you're describing was an issue in Docker 17.11, which used a pre-release of containerd 1.0 that enforced memory accounting to be enabled instead of just warning. That issue was fixed in containerd/containerd#1803, which is included in the containerd 1.0.0 release. Docker 17.12 and up ship with containerd 1.0.x, so won't have this problem.

Docker 17.11 is an "edge" (monthly) release, which reached end-of-life in December, so if you're still running into this, it means you're running a version of Docker that is no longer supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment