root user cannot run 'su' command - lxc container

Victor_240

New Member
Sep 26, 2024
2
0
1
Hello,

I have an unprivileged lcx container where I changed the UID mapping in the file /etc/pve/lxc/101.conf. The file looks like this now:

lxc.idmap: u 0 0 1
lxc.idmap: u 1 100000 65535
lxc.idmap: g 0 0 1
lxc.idmap: g 1 100000 65535
lxc.cgroup2.devices.allow: c 10:200 rwm

While I managed to get access to the mounted folder I was aiming for, I can't run any su command. I can't even change user with su - user.
When I try to run su - <user> I get:
su: cannot set groups: Operation not permitted

When I try to run sudo sysctl vm.swappiness=10, I get:
sudo: error in /etc/sudo.conf, line 0 while loading plugin "sudoers_policy"
sudo: /usr/libexec/sudo/sudoers.so must be owned by uid 0
sudo: fatal error, unable to load plugins

Is there something I can do to rectify this?
 
I have an unprivileged lcx container where I changed the UID mapping in the file /etc/pve/lxc/101.conf.
Why have you done this? If you did this after the container was created, you may need to shift all uid/gids from the hypervisor to match your new mapping,