Snap quotas fails with memory usage unavailable

I’m experimenting with quota groups, but enabling them doesn’t limit memory usage. I’m using this guide:

I start with a fresh system

pi@ubuntu:/$ sudo snap get core experimental
Key                        Value
experimental.quota-groups  true

pi@ubuntu:/$ sudo snap quotas
No quota groups defined.

I have a custom image:

pi@ubuntu:/$ snap list
Name                Version             Rev    Tracking       Publisher       Notes
core20              20220114            1331   latest/stable  canonical✓      base
network-manager     1.22.10-10          702    20/stable      canonical✓      -
pi-kernel           5.4.0-1052.58       402    20/stable      canonical✓      kernel
screenly-client     3.0.2               1238   latest/stable  screenly-brand  -
screenly-pi-gadget  1.0-screenly-armhf  84     pi3/stable     screenly-brand  gadget
snapd               2.54.3              14983  latest/stable  canonical✓      snapd

I can create a quota;

pi@ubuntu:/$ sudo snap set-quota highmem --memory=200MB
pi@ubuntu:/$ sudo snap quotas
Quota    Parent  Constraints   Current
highmem          memory=200MB  
pi@ubuntu:/$ sudo snap quota highmem
name:  highmem
  memory:  200MB
  memory:  0B

But whenever I add a snap to it, I get an error:

pi@ubuntu:/$ sudo snap set-quota highmem screenly-client
pi@ubuntu:/$ snap quotas
error: memory usage unavailable

And there is no way to see the quota anymore

pi@ubuntu:/$ snap quota highmem
error: memory usage unavailable

How can I troubleshoot this? I tried to look at dmesg, but didn’t see anything that could help me.

Please attach the journal (sudo journalctl --no-pager) and the contents of /proc/cgroups.

Here they are:


pi@ubuntu:/$ cat /proc/cgroups 
#subsys_name	hierarchy	num_cgroups	enabled
cpuset	7	1	1
cpu	2	1	1
cpuacct	2	1	1
blkio	8	1	1
memory	0	204	0
devices	5	196	1
freezer	9	3	1
net_cls	3	1	1
perf_event	10	1	1
net_prio	3	1	1
pids	4	202	1
rdma	6	1	1
Feb 09 09:11:57 ubuntu kernel: *** VALIDATE tmpfs ***
Feb 09 09:11:57 ubuntu kernel: *** VALIDATE proc ***
Feb 09 09:11:57 ubuntu kernel: cgroup: Disabling memory control group subsystem
Feb 09 09:11:57 ubuntu kernel: *** VALIDATE cgroup1 ***
Feb 09 09:11:57 ubuntu kernel: *** VALIDATE cgroup2 ***


Memory controller appears to be disabled in your setup.

1 Like

Thanks for your reply. @mborzecki

After some search I found this post.

This solution perfectly worked for Raspberry Pi3

FWIW future versions of snapd will complain if you try to use quotas but the memory controller is disabled.

1 Like