systemd-nspawn on fedora 21 - can't set root password

时间:2015-06-15 15:01:48

标签: systemd fedora-21

I'm trying to use systemd-nspawn but when I launch it and try to login as root - it still asks for a password. They've mentioned turning off auditing - which I've done.

My cmd line says audit=0 at the end.

$ cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.19.7-200.fc21.x86_64 root=/dev/mapper/fedora_localhost-root ro rd.lvm.lv=fedora_localhost/swap rd.lvm.lv=fedora_localhost/root rhgb audit=0 quiet

(This is fedora 21) Using these docs https://fedoraproject.org/wiki/Features/SystemdLightweightContainers

When I try to change the password it tells me I have a auth token manipulation error.

$ sudo systemd-nspawn -D /srv/eq1 
Spawning container eq1 on /srv/eq1.
Press ^] three times within 1s to kill container.
-bash-4.3# passwd
Changing password for user root.
New password: 
Retype new password: 
passwd: Authentication token manipulation error
-bash-4.3# 

1 个答案:

答案 0 :(得分:0)

这是关于selinux的背景 几乎遵循http://www.freedesktop.org/software/systemd/man/systemd-nspawn.html

中的示例6

您必须更改容器上下文,然后使用正确的上下文运行它:

chcon system_u:object_r:svirt_sandbox_file_t:s0:c0,c1 -R /srv/container
systemd-nspawn -L system_u:object_r:svirt_sandbox_file_t:s0:c0,c1 -D /srv/container

发出第二个命令后,您就可以更改密码了。在CTRL +]]之后,您可以发出通常的“systemd-nspawn -bD / srv / container”并启动容器。