How to use acct inside container

I’d like to account cpu usage by user using standart acct (apt install acct) but it does not work inside continer (unpriveleged) with error

# sa -im
                                 sa: ERROR -- print_stats_nicely called with num_calls == 0

How to fix it?


Have you compiled LXCFS and enabled the switch for per container CPU stats ?

The OP just posted a question about IPvlan, so he is running snap LXD. Are you sure it’s possible to use a custom lxcfs with snap lxd ?

Yeah pretty sure you can, ive managed to mount the new lxcfs into a container to get cpu load avs

Also he said cpu ussage nothing about ipvlan

I’m new to lxc/lxd.

Should I use specific version of LXCFS?
Which exactly?

And yes, I’m using LXD 3.14 from edge snap.

You cant load average per container without the new lxcfs unless im wong @stgraber?

Yeah, that’s right, there are no stable versions of lxcfs shipping with that option.
The version in the edge snap would be sufficient but the feature isn’t enabled there either and obviously you shouldn’t be running edge in any kind of production environment.

@brauner is about to release LXC 3.2, maybe we can do a LXCFS 3.1 at the same time?

1 Like

@stgraber How to enable this feature? I think it is cap_sys_pacct.

It seems ok to me to use edge.


Is it possible now with lxd 3.15?

Should I enable something to container to be able to use acct as sa -im inside?