Renumbering CPU Cores in LXC Containers on Ubuntu 22.04

I have installed LXC on a server running Ubuntu 22.04 and created an LXC container. I allocated cores 7-12 to it through LXC configurations.

The issue I’m facing is that these cores are named 7-12 inside the LXC as well, whereas I need them to appear as 0-5 inside the container.

Previously, I didn’t have this issue on Ubuntu 16.04.

Make sure that you have LXCFS installed and working. This should normally get /proc/cpuinfo to only show those correct cores (and I believe also renumber them).

That said, there is no way to fully re-number cores/threads, you’ll always see the actual value in /proc/self/status or under /sys. That’s just how the kernel works.