Use swap memory of host on Ubuntu22.04

Hi, I found that my instance on Ubuntu22.04 can not use swap memory of host, when I set limits.memory config.
I found some reply on this topic (, @Stephane said that

The likely difference between your systems is the use of cgroup2 on 22.04.
The swap is still present and will be used, but its reporting is the issue.

Downgrading to cgroup1 would definitely be interesting to try.

Today, should I Downgrading to cgroup1 if I want to use swap memory of host on Ubuntu22.04?

I upgrade my host system version because I want to use docker in unprivileged instance.(

I found some confusing phenomenon:
when I set instance limits.memory.swap=false, it can use swap

when limits.memory.swap=true, it can not use swap.

same as this topic:

This is fixed in lxd 5.16 (currently in latest/candidate snap channel).


Yes, lxd 5.16 fix this problem, thank you. :smile:

1 Like