Resource limits not being honoured Alpine linux 3.22 with Cgroups enabled

I tried creating a new container, using incus 6.14, using default install (I used the alpine-feature package). I created a new profile called “external” net where I set the # of cpus to a number of 4. New containers still see ALL cpus on the system instead of seeing just the 4. Same for memory. Not sure what to do, cgroups are loaded, and the filesystem is mounted. I made the ‘unified’ change to alpine. Any commands I need to do to print out whats giong on? I can launch things fine, I did create the profile in the gui.

name: externalnet
description: Things that are external via macvlan
devices:
  eth0:
    network: macvlan
    type: nic
  root:
    path: /
    pool: default
    size: 20GiB
    type: disk
config:
  limits.cpu: '4'
  limits.memory: 4GiB
project: default

Neither of these work. I still get TONS of cpus (on this system I have 40 which I can see in the system when I create it. Networking is macvlan and seems to work fine.

My mount options to prove cgroups are happy:

cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)

Here are my package lists:

incus-feature 6.14.0-r1
incus-feature-agent 6.12.0-r1
incus-feature-agent-openrc 6.12.0-r1
incus-feature-client 6.14.0-r1
incus-feature-openrc 6.14.0-r1
incus-feature-utils 6.14.0-r1
incus-feature-vm 6.14.0-r1
incus-ui-canonical 0.14.6-r0

They are being applied, just not getting reported back because Alpine doesn’t use /proc for those.

Set security.syscalls.intercept.sysinfo=true, that should help.

Where should I put this using the cli? I added to the vm in config section, and still see LOTS of processors. You are right, however, in that ONLY 4 were being able to be used so its not the end of the world. Is the above config option done using incus config set <vmname> security.syscalls.intercept.sysinfo=true ? I did try and powered down the machine, and still all the processors show up. Not a biggie, since its enforcing the 4 processor limit.

And thanks for your response!

stgraber@dakara:~$ incus launch images:alpine/edge a1 -c security.syscalls.intercept.sysinfo=true -c limits.cpu=2 -c limits.memory=256MiB
Launching a1
stgraber@dakara:~$ incus exec a1 sh
~ # free -m
              total        used        free      shared  buff/cache   available
Mem:            256           1         252           0           3         255
Swap:             0           0           0
~ # nproc
2
~ # 

I did launch it as per your directions. I used alpine linux 3.22 rather than edge, but it seems that either the system I am using is too old (its a vintage 2012 server) or running incus on alpine as a base os works differently. I can’t wait until your dedicated os comes out.

I also tried am alma linux container with the same results. Is there something unwise about using incus on a musl based system in bare metal? Is there a recommended os that you test on for bare metal given the strangeness I am seeing. Also the disks show the entire size of the volume.

root@alpalinux ~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 233G 1.1G 230G 1% /
none 492K 4.0K 488K 1% /dev
tmpfs 100K 0 100K 0% /dev/incus
tmpfs 100K 0 100K 0% /dev/.incus-mounts
devtmpfs 10M 0 10M 0% /dev/tty
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 6.3G 8.1M 6.3G 1% /run

which are the root filesystem. Do I need to do something to alpine HOST rather than GUEST to enable this? since I am HOSTING the guests on an alpine 3.22 bare metal?

See your separate thread

Inside a container? Yes, that’s expected. The container is just a subdirectory of the host’s filesystem, so the whole space is available if required (unless you set a quota, which is only supported in certain drivers).

$ incus launch -s zfs images:ubuntu/24.04/cloud test
$ incus exec test -- df -h /
Filesystem                Size  Used Avail Use% Mounted on
zfs0/lxd/containers/test  133G  323M  132G   1% /
$ incus config device set test root size=10GiB
$ incus exec test -- df -h /
Filesystem                Size  Used Avail Use% Mounted on
zfs0/lxd/containers/test   11G  323M   10G   4% /

And worth noting that not all storage drivers can do quotas properly.

ZFS, LVM and Ceph will both set the quota and accurately report it.
btrfs will set it but not report it.
dir will only set and report it if projquota is available on the underlying filesystem which is usually a bit of an involved process to do it (tune2fs on the unmounted filesystem usually).

Just as a follow up, Incus and alpine 3.22 on my hardware absolutely hate each other. I switched to base debian 12 and everything is stable. People wanting to use alpine beware!

As another data point, I’ve been running Incus on Alpine for months with no issues (only VMs currently; no app or system containers), but it does seem that a Debian variant is going to be best in most cases.

I suspect you’re running on more modern hardware. My unit dates from 2012 and isn’t particularly happy with EFI.

Sincerely,

THOMAS MUNN