Bitbucket Cloud: Issues with bitbucket runner throwing error related to memory swappiness and cgroup
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
This article provides solutions for resolving issues related to pipelines running on self-hosted runners, specifically addressing the error message:
Your kernel does not support memory swappiness capabilities or the cgroup is not mounted. Memory swappiness discarded.
Environment
Linux Docker (x86_64) Runner.
Cause
This issue is OS-specific or the issue with the grub configuration and not related to Bitbucket. To avoid this warning, follow the steps below to check and configure your system.
Solution
- Verify if Swappiness is Enabled on Your Host:
To verify if swappiness is enabled, use the following command:
sysctl vm.swappiness
This command will output the current value of swappiness. If the value is non-zero, it means swappiness is enabled.
If
sysctl
is not available, you can directly check the value in the/proc/sys/vm/swappiness
file:cat /proc/sys/vm/swappiness
The default value for
vm.swappiness
is typically 60.
- Enable Swappiness if Necessary:
If swappiness is not enabled, you can enable it by running the following command:
sudo sysctl vm.swappiness=60
If the issue persists after enabling swappiness, it might be related to the OS and its GRUB configuration. For example, if your self-hosted runner is hosted on Ubuntu 22.04, you need to modify the GRUB configuration as follows:
- Modify GRUB Configuration:
Edit the GRUB configuration file, typically located at /etc/default/grub:
vi /etc/default/grub
Add or append the following lines in the file:
GRUB_CMDLINE_LINUX_DEFAULT="cgroup_enable=memory swapaccount=1" GRUB_CMDLINE_LINUX="cgroup_enable=memory cgroup_memory=1 systemd.unified_cgroup_hierarchy=0"
For additional information, you can refer to the discussion on enabling memory cgroups in Ubuntu: Enabling Memory Cgroup in Ubuntu 20.04