[SOLVED] dmesg outside VM

Andrii

Member
Jul 6, 2016
50
0
6
40
I run the command 'dmesg' into the VM 101 and can see the logs for VM 108. Why this is possible?
20170428_57Ggs7Ir.png
 
that is not a VM, it is a container - and containers share a kernel (including the kernel's dmesg facility). you can disable access for non-root users (and thus also for unprivileged containers) by setting the sysctl kernel.dmesg_restrict to 1
 
And
Code:
sysctl -w kernel.dmesg_restrict=1
does not help for root into unprivileged container.
 
should work - please verify that you set the sysctl correctly (and that you are actually testing with an unpriv. container!)

Code:
$ echo 0 | sudo tee /proc/sys/kernel/dmesg_restrict
0
$ sudo pct enter 123
root@unprivtest:/# dmesg | head -3
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
root@unprivtest:/# exit

$ echo 1 | sudo tee /proc/sys/kernel/dmesg_restrict
1
$ sudo pct enter 123
root@unprivtest:/# dmesg | head -3
dmesg: read kernel buffer failed: Operation not permitted
root@unprivtest:/# exit
 
Found the solution
Need to add syslog errno 1 into /usr/share/lxc/config/common.seccomp
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!