OpenWRT in Proxmox LXC container - shows RAM size from host instead of guest

I am running OpenWRT in a Proxmox LXC container as described there and I noticed, that the Luci interface shows the total RAM from the host (2 GB) instead of just the 128 MB which are given to the guest.

128 MB assigned via Proxmox:

root@pve0:~# cat /etc/pve/lxc/101.conf
arch: amd64
cores: 2
hostname: pve0-owrt
memory: 128
net0: name=eth0,bridge=vmbr1,firewall=1,hwaddr=ca:0a:6c:43:bc:93,type=veth
net1: name=eth1,bridge=vmbr0,firewall=1,hwaddr=13:3F:F7:68:8D:A6,type=veth
onboot: 1
ostype: unmanaged
rootfs: local-lvm:vm-101-disk-1,size=264M
swap: 128
unprivileged: 1

2023-11-25_11-22-40_pve0_-Proxmox_Virtual_Environment–_Mozilla_Firef

Luci shows 2 GB total memory:

Meminfo shows the right values:

root@pve0-owrt:~# cat /proc/meminfo
MemTotal:         131072 kB
MemFree:           88104 kB
MemAvailable:     111244 kB
Buffers:               0 kB
Cached:            23140 kB
SwapCached:            0 kB
Active:            31624 kB
Inactive:           5812 kB
Active(anon):      14348 kB
Inactive(anon):      944 kB
Active(file):      17276 kB
Inactive(file):     4868 kB
Unevictable:           0 kB
Mlocked:           25416 kB
SwapTotal:        131072 kB
SwapFree:         131060 kB
Zswap:                 0 kB
Zswapped:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:         14300 kB
Mapped:                0 kB
Shmem:               992 kB
KReclaimable:      72148 kB
Slab:                  0 kB
SReclaimable:          0 kB
SUnreclaim:            0 kB
KernelStack:       14416 kB
PageTables:        28376 kB
SecPageTables:         0 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     3100236 kB
Committed_AS:    8079684 kB
VmallocTotal:   34359738367 kB
VmallocUsed:       50504 kB
VmallocChunk:          0 kB
Percpu:             1696 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
FileHugePages:         0 kB
FilePmdMapped:         0 kB
Unaccepted:            0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB
DirectMap4k:      151404 kB
DirectMap2M:     1945600 kB

htop also shows the correct values:

Why is Luci showing the hosts RAM size instead of the guests one?
@vgaetera do you actually experience the same with your tests via libvirt?

This is a general problem of LXCs and it depends on how the according tool in the guests retrieves the RAM information.
It looks luci does it on another way as cat /proc/meminfo or htop.

https://www.zabbix.com/forum/zabbix-troubleshooting-and-problems/419835-lxc-container-bad-memory-value-with-agent

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.