I’m confused on
snap set-quota, respectively how to make it work. I followed the quote-groups documentation and it all works, quota groups are there and I can assign snaps.
However, the quota gropus seems to have no impact. When I set an intentionally low quota like
sudo snap set-quota lowmemory --memory=64MB
sudo snap set-quota one-cpu --cpu=1x5%
and assign them to e.g. the Firefox snap e.g.
sudo snap set-quota one-cpu firefox it seems to have no impact.
snap quota one-cpu shows that everything is assigned, but the Firefox still is able to use more CPU and memory than it should be allowed to do.
Do I miss something or are any additional steps necessary?
I use Ubuntu 22.04 with Kernel 6.2 and currently snapd 2.60.4
I’ve been there too. The reason is that quota groups apply to snap services only, not regular programs. At least that’s what the web documentation says. And indeed, if you try to explicitly add a snap program to a quota group, such as
firefox.firefox, you get an error stating
firefox.firefox is not a service.
Adding a whole snap to the quota group means quotas will apply to all services within that snap, but if the snap doesn’t contain any service, it’s as good as doing nothing.
The first command even seems incomplete due to the desired request.
I think he wanted to do this instead.
sudo snap set-quota lowmemory --memory=64MB --cpu=1x5% firefox
He created the group without adding any snaps, but I think that works too and you can add snaps later.
Anyway for the specific case of Firefox it’s completely useless since the firefox snap doesn’t contain any services, hence it has no component to apply resource quotas to.