CPU numbers assigned to CT (container) are no longer numbered from 0

jory

Active Member
Jan 14, 2019
9
0
41
45
Hello,
I updated PVE 7 & Ubuntu CTs by apt and after reboot I can see that now CTs can see host CPU numbers.
Previously, CPU numbers in CTs were starting always from 0 and continue like 1,2,3...

CT with correct numbers:

pveversion
- pve-manager/7.3-6/723bb6ec (running kernel: 5.15.85-1-pve)
Code:
lscpu
...
  On-line CPU(s) list:   4,9
  Off-line CPU(s) list:  0-3,5-8,10-15
...

top
%Cpu0  :  1.7 us,  3.4 sy,  0.0 ni, 94.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu1  :  1.6 us,  0.0 sy,  0.0 ni, 98.4 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st

grep 'cpu[0-9][0-9]*' /proc/stat
cpu0 517650924 3894 98034010 3505234055 30614 0 2182508 0 0 0
cpu1 520293887 3295 109552118 3264765346 59503 0 1016413 0 0 0

CT with incorrect/host numbers with gaps:

pveversion
- pve-manager/7.3-4/d69b70d4 (running kernel: 5.15.83-1-pve)
Code:
lscpu
...
  On-line CPU(s) list:   4,5
  Off-line CPU(s) list:  0-3,6-11
...

top
%Cpu4  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu5  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st

grep 'cpu[0-9][0-9]*' /proc/stat
cpu4 4787238 5431 5274068 3902859349 86294 0 87470 0 0 0
cpu5 122510052 7104 10180687 3757086091 74977 0 289226 0 0 0

Issue showed me prometheus-node-exporter first. I'm using prometheus-node-exporter and grafana counting CPU "load" from idle numbers like this

100 - (avg by (job) (rate(node_cpu_seconds_total{instance=~".*vauat[0-9]:.*",mode="idle"}[1m])) * 100)

And now this CPU graph shows wrong information. All 4 nodes are same, it should show about 28%. You can see CTs on updated Proxmox hosts as green and yellow (one proxmox host have one of this kind of CT).

1716910482296.png

It is because before update I get idle numbers from prometheus-node-exporter in CT only for assigned CPUs to this CT starting with 0 (zero):

Code:
node_cpu_seconds_total{cpu="0",mode="idle"} 3.50512039e+07
node_cpu_seconds_total{cpu="1",mode="idle"} 3.264657082e+07

But now after update I get all CPUs with zeroes from within CT:

Code:
node_cpu_seconds_total{cpu="0",mode="idle"} 0
node_cpu_seconds_total{cpu="1",mode="idle"} 0
node_cpu_seconds_total{cpu="10",mode="idle"} 0
node_cpu_seconds_total{cpu="11",mode="idle"} 0
node_cpu_seconds_total{cpu="12",mode="idle"} 0
node_cpu_seconds_total{cpu="13",mode="idle"} 0
node_cpu_seconds_total{cpu="14",mode="idle"} 3.485306587e+07
node_cpu_seconds_total{cpu="2",mode="idle"} 0
node_cpu_seconds_total{cpu="3",mode="idle"} 0
node_cpu_seconds_total{cpu="4",mode="idle"} 0
node_cpu_seconds_total{cpu="5",mode="idle"} 0
node_cpu_seconds_total{cpu="6",mode="idle"} 0
node_cpu_seconds_total{cpu="7",mode="idle"} 0
node_cpu_seconds_total{cpu="8",mode="idle"} 0
node_cpu_seconds_total{cpu="9",mode="idle"} 3.412161474e+07

Can anyone explain to me what happened (I think kernel update is cause here) and how can I see CT CPUs again numbered from 0 please?
I googled and searched for this kind of issue but found some htop bugs and other threads with not exactly this issue.
I checked on PVE 8 and it's same "new" behaviour - CTs see host numbers of assigned CPUs.
 
Last edited:
Bump. No one? Or does it make sense to install prometheus-node-exporter at all to containers? Is it possible to get all linux containers data from host?