Can't change password in LXC

I’m following this guide for setting up a Leap 15.0 container on Tumbleweed:
https://doc.opensuse.org/documentation/leap/virtualization/html/book.virt/cha.lxc.html

The last step of setting up the rootfs doesn’t work:
root # echo “root:YOURPASSWD” | chpasswd -R */PATH/TO/ROOTFS
*Nothing happens after entering this line, there is no error message either. It does work locally though (echo “root:mypassword” | chpasswd)

This worked now:

root # chroot /PATH/TO/ROOTFS sh -c “echo ‘$USER:$PASS’ | chpasswd”