-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Do not set memory limits for Cgroup v2 "memory.swap.max: permission denied" #10371
Comments
I think you need to configure those in the Kernel settings, when running on Debian ? Currently we only check for "memsw.limit_in_bytes", but not for "memory.swap.max" There should be a similar check to the one for cgroups v1, also for the new cgroups v2. |
|
I ran into this problem today too, also after a restart, before which everything was working fine. Making the GRUB changes listed in the docs linked by @afbjorklund made it work. Thank you! Edit: now that I'm thinking about it, I reinstalled Minikube because I thought maybe I needed to update to a new version, so it makes sense that I needed to follow the post-install instructions. Edit 2: maybe part of the trouble here is that the error message did not contain the message indicated in the docs, "Your kernel does not support cgroup swap limit capabilities". Maybe the error message could be updated to be closer to that, or the docs could include a sample of the error message we encountered. |
Older versions of Docker (before 20.10) did not support cgroups v2. The kernel setting is the same, though. It's something specific to Debian, others have it on by default...
Yes. In this section: https://github.com/kubernetes/minikube/blob/v1.17.1/pkg/drivers/kic/oci/oci.go#L157_L161 |
I confirm it's working now with the changes suggested on https://docs.docker.com/engine/install/linux-postinstall/#your-kernel-does-not-support-cgroup-swap-limit-capabilities |
I confirm this is a problem that affects users with cgroup2 and one thing we could do on minikube side is NOT applying memory limits for cgroup v2 until it is fixed and also point them to the docs on Docker website to fix their cgroup
|
Basically they haven't configured their Docker installation "properly" (alternatively you could say that their Linux vendor chose to disable some of the kernel capabilities for them, by default) |
Seems like it is now an error with Docker, like it was in Podman, so we should just avoid the flag. It was ignored, anyway... WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap. |
this PR ://github.com//pull/10507 didnt fully fix we need to check for cat /sys/fs/cgroup/memory/memory.limit_in_bytes |
Pretty sure I misunderstood the settings, as well. Not specifiying swap means that you want swap...
https://thorsten-hans.com/limit-memory-for-docker-containers As far as I know, memory.limit_in_bytes is available by default and it was memswap that was toggled ? But I don't have a system to reproduce this, worked OK on Debian Sid. |
The current checks were explicitly only to check for the boot parameter of Debian/Ubuntu: // memory subsystem checks and adjustments
if resources.Memory != 0 && resources.Memory < linuxMinMemory {
return warnings, fmt.Errorf("Minimum memory limit allowed is 6MB")
}
if resources.Memory > 0 && !sysInfo.MemoryLimit {
warnings = append(warnings, "Your kernel does not support memory limit capabilities or the cgroup is not mounted. Limitation discarded.")
resources.Memory = 0
resources.MemorySwap = -1
}
if resources.Memory > 0 && resources.MemorySwap != -1 && !sysInfo.SwapLimit {
warnings = append(warnings, "Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.")
resources.MemorySwap = -1
}
if resources.Memory > 0 && resources.MemorySwap > 0 && resources.MemorySwap < resources.Memory {
return warnings, fmt.Errorf("Minimum memoryswap limit should be larger than memory limit, see usage")
}
if resources.Memory == 0 && resources.MemorySwap > 0 && !update {
return warnings, fmt.Errorf("You should always set the Memory limit when using Memoryswap limit, see usage")
} cgroups v1 mountPoint, ok := cgMounts["memory"]
if !ok {
warnings = append(warnings, "Your kernel does not support cgroup memory limit")
return warnings
}
info.MemoryLimit = ok
info.SwapLimit = cgroupEnabled(mountPoint, "memory.memsw.limit_in_bytes")
if !info.SwapLimit {
warnings = append(warnings, "Your kernel does not support swap memory limit")
} cgroups v2 if _, ok := controllers["memory"]; !ok {
warnings = append(warnings, "Unable to find memory controller")
return warnings
}
info.MemoryLimit = true
info.SwapLimit = true Not check for some weird system with /sys/fs/cgroup/memory but without /sys/fs/cgroup/memory/memory.limit_in_bytes |
Noticed a funky detail on podman, as well... $ sudo podman run --memory 256m --memory-swap -1 busybox true
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x15ee61e]
goroutine 1 [running]:
github.com/containers/podman/v2/cmd/podman/common.getMemoryLimits(0xc00035cc00, 0x27d8da0, 0x1b05550, 0x17, 0xc000594868)
cmd/podman/common/specgen.go:153 +0x33e
github.com/containers/podman/v2/cmd/podman/common.FillOutSpecGen(0xc00035cc00, 0x27d8da0, 0xc0002b9f20, 0x2, 0x6, 0x0, 0x18ab660)
cmd/podman/common/specgen.go:430 +0xda6
github.com/containers/podman/v2/cmd/podman/containers.run(0x2748b80, 0xc0002b9f20, 0x2, 0x6, 0x0, 0x0)
cmd/podman/containers/run.go:171 +0x46f
github.com/spf13/cobra.(*Command).execute(0x2748b80, 0xc000138020, 0x6, 0x6, 0x2748b80, 0xc000138020)
vendor/github.com/spf13/cobra/command.go:850 +0x47c
github.com/spf13/cobra.(*Command).ExecuteC(0x275c140, 0xc000130010, 0x18d6c80, 0x280b340)
vendor/github.com/spf13/cobra/command.go:958 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
vendor/github.com/spf13/cobra/command.go:895
github.com/spf13/cobra.(*Command).ExecuteContext(...)
vendor/github.com/spf13/cobra/command.go:888
main.Execute()
cmd/podman/root.go:92 +0xec
main.main()
cmd/podman/main.go:36 +0x92 💥 Reported as |
I'm running into this issue again after my system OS updated, but I'm not sure what exactly was updated.
System Settings says
Attempted: Output:
Followed the post-install steps, which solved this problem for me before: https://docs.docker.com/engine/install/linux-postinstall/#your-kernel-does-not-support-cgroup-swap-limit-capabilities. Confirmed that Happy to open new bug and/or provide new information, but this seemed like the same error message so I thought I'd reuse this bug. |
I think the latest Google Linux updates to cgroups v2, and there was a regression in how minikube handles that. |
@awan1 I noticed you're using minikube 1.17.1, which is a full version old now. Can you try upgrading to v1.18.1 and see if that helps? It's working on my rodete machine. |
Have you tried the fix indicated above? |
Also working on my machine as well on v1.18.1
|
@sharifelgamal great catch - updating to minikube v1.18.1 made |
Steps to reproduce the issue:
3.
minikube start --driver=docker
failsFull output of failed command:
Full output of
minikube start
command used, if not already included:Command:
minikube start --driver=docker
:Optional: Full output of
minikube logs
command:The text was updated successfully, but these errors were encountered: