为什么 LXC-create 返回错误“sudo.conf 应该为 0”?

为什么 LXC-create 返回错误“sudo.conf 应该为 0”?

我尝试创建一个非特权容器,但没有任何效果按预期进行。

这是我的代码: 遵循该教程

#!/bin/bash

sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get -y install lxc uidmap
sudo sh -c 'echo 1 > /sys/fs/cgroup/cpuset/cgroup.clone_children'
sudo sh -c 'echo 1 > /proc/sys/kernel/unprivileged_userns_clone'
sudo usermod --add-subuids 100000-165536 $USER
sudo usermod --add-subgids 100000-165536 $USER
sudo chmod +x $HOME

mkdir -p ~/.config/lxc/

echo "lxc.network.type = veth
lxc.network.link = lxcbr0
lxc.network.flags = up
lxc.network.hwaddr = 00:16:3e:xx:xx:xx
lxc.id_map = u 0 100000 65536
lxc.id_map = g 0 100000 65536
" > ~/.config/lxc/default.conf

sudo sh -c "echo '$USER veth lxcbr0 10' > /etc/lxc/lxc-usernet"

lxc-create -t download -n c1 -- -d ubuntu -r trusty -a amd64

这是一次又一次的结果:

...
Unpacking the rootfs
sudo: /etc/sudo.conf is owned by uid 65534, should be 0
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
sudo: /etc/sudo.conf is owned by uid 65534, should be 0
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

---
You just created an Ubuntu container (release=trusty, arch=amd64, variant=default)

To enable sshd, run: apt-get install openssh-server

For security reason, container images ship without user accounts
and without a root password.

Use lxc-attach or chroot directly into the rootfs to set a root password
or create user accounts.
sudo: /etc/sudo.conf is owned by uid 65534, should be 0
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

我做错了什么?

首先,我认为 systemD 出了问题,并安装了 libpam-systemd 作为解决方案。但最终不是那样:'( 我被困住了

相关内容