【问题标题】:systemd-nspawn on fedora 21 - can't set root passwordfedora 21 上的 systemd-nspawn - 无法设置 root 密码
【发布时间】:2015-06-15 15:01:47
【问题描述】:

我正在尝试使用 systemd-nspawn,但是当我启动它并尝试以 root 身份登录时 - 它仍然要求输入密码。他们提到关闭审计 - 我已经这样做了。

我的 cmd 行最后说 audit=0。

$ 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

(这是 fedora 21)使用这些文档https://fedoraproject.org/wiki/Features/SystemdLightweightContainers

当我尝试更改密码时,它告诉我我遇到了身份验证令牌操作错误。

$ 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# 

【问题讨论】:

    标签: systemd fedora-21


    【解决方案1】:

    这是关于 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”并引导您的容器。

    【讨论】:

    • 我禁用了 selinux 并遇到同样的错误。
    猜你喜欢
    • 1970-01-01
    • 2018-06-02
    • 1970-01-01
    • 2019-09-21
    • 2020-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多