Can't login on systemd-nspawn container running Fedora 37

I ran the following commands:

# btrfs subvolume create /var/lib/machines/fedora-37
# dnf --releasever=36 -y --best --setopt=install_weak_deps=False --disablerepo=* --enablerepo=fedora,fedora-modular,updates,updates-modular --installroot=/var/lib/machines/fedora-36/ \
install -y dhcp-client dnf fedora-release glibc glibc-langpack-en glibc-langpack-de iputils less ncurses passwd systemd systemd-networkd systemd-resolved vim-default-editor
# systemd-nspawn -D /var/lib/machines/fedora-36 passwd
# mkdir /etc/systemd/nspawn
# vim /etc/systemd/nspawn/fedora-36.nspawn
# nmcli con add type bridge ifname vbr6s0

Trying to get in

systemd-nspawn -D /var/lib/machines/fedora-36 -b
...
[  OK  ] Finished systemd-update-utmp-runlevel.service - Record Runlevel Change in UTMP.

Fedora Linux 36 (Thirty Six)
Kernel 6.0.12-200.fc36.x86_64 on an x86_64 (pts/0)

fedora-36 login: root

Fedora Linux 36 (Thirty Six)
Kernel 6.0.12-200.fc36.x86_64 on an x86_64 (pts/0)

fedora-36 login: 

The password prompt never appears.

I’m having the same behaviour simply running sudo systemd-nspawn -bi fedora.raw on a Ubuntu 24.04 where “fedora.raw” has been generated by sudo mkosi with this configuration:

​ [Distribution]
​ Distribution=fedora
​ Release=40
​ [Output]
​ Format=disk
​ Output=fedora
​ [Content]
​ Packages=dnf,iproute,iputils,nano,systemd,systemd-resolved
​ RootPassword=1234

What’s happening?!!
Thanks!

I found this thread on google when encountering the same problem with my setup. I solved it by making sure I installed the util-linux package which provides the login command.