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

1k views Asked by At

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

There are 1 answers

1
George Ivanov On

it's about selinux context almost following example 6 from http://www.freedesktop.org/software/systemd/man/systemd-nspawn.html

you have to change the container context and then run it with the proper one:

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

after issuing the second command you'd be able to change password. Right after CTRL+]]] you can issue the usual "systemd-nspawn -bD /srv/container" and boot you container.