Check enabled LXC features from INSIDE container?

fdcastel

Member
Sep 28, 2021
24
3
8
Given these two LXC features (keyctl and nesting):

1724352882426.png

there is a way to programmatically query them from inside the container?



I found /sys/module/kvm_intel/parameters/nested but unfortunately it returns "Y" for both nesting=0 and nesting=1 containers.
 
Keyctl
Code:
keyctl show
nesting
Code:
sudo unshare --mount --pid --fork --mount-proc bash

The last on didn't work without nesting.
 
  • Like
Reactions: fdcastel
Thank you very much @pikey!!!



Unfortunately keyctl needs an additional package installed into container:

Bash:
# keyctl
Command 'keyctl' not found, but can be installed with:
apt install keyutils

Do you know any alternate way that doesn't require additional packages?



nesting
Code:
sudo unshare --mount --pid --fork --mount-proc bash

The last on didn't work without nesting.

Perfect! For the record, I used:

Bash:
unshare --mount --pid --fork --mount-proc true

which will return 0 (ok) if nesting is enabled and 1 (error) otherwise.
 
  • Like
Reactions: Kingneutron
> Do you know any alternate way that doesn't require additional packages?

If it's a container and you have root on the box, why not just install the package...?
 
Just being picky. You know... The less, the better. :)

Changing a system just to query a single option seems excessive. That's why I'm interested in alternative ways to get this.
 

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!