Unable to login as user to a (copied) container


#1

Quick background, I was running Fedora Server 28 (Server A) and using LXC containers via Snap. Later on decided to migrate to Ubuntu 18.04 (server edition) and henceforth copied the containers (15 of them) to another (different) backup machine running Ubuntu 18.04 (server edition) (Server C) (running default repository version of LXC) via lxc copy from Server A. Everything was copied (including profile) without any issues.

Now, I have replaced OS in Server A with Ubuntu 18.04 and it is using the default repository version of LXC as well (3.0.2). I copied all the containers from Server C back to Server A. They come back up without any issues but the problem is I cannot login as a user into any of these containers. I was able to do so before, effortlessly but not anymore.

Following is the error message I get after running, lxc exec nginx -- sudo --login --user my_user_name

sudo: error in /etc/sudo.conf, line 0 while loading plugin "sudoers_policy"
sudo: /usr/lib/sudo/sudoers.so must be owned by uid 0
sudo: fatal error, unable to load plugins

And here’s the config of container nginx,

From the looks of it, I am guessing that there’s permission issues but not sure how to fix it and/or where to begin troubleshooting. Sorry for my naivety but I am just getting started with LXC (homelab being my test bed)!


#2

Have you tried su instead since you should already be root when using lxc exec? lxc exec nginx -- su --login my_user_name


#3

No, not yet. Will do so once I have access to the server (on road as of now). However, I did try logging in as root and that worked just fine.

I believe I ran following and it worked,
lxc exec nginx -- /bin/bash


#4

Ran the command and ended up getting following warning,

su: Authentication failure
(Ignored)

I can login but ls -la shows all files are nobody:nogroup and so I am guessing the user mapping is messed up?! Any idea about fixing this?