"Could not find uid in /etc/subuid" when run as root

Steps to reproduce

sudo su
./rbm/rbm build gcc --target nightly --target torbrowser-linux-x86_64

Occurs on both Ubuntu Groovy and Debian Buster.

Expected results

Build of gcc should succeed.

Observed results

Using file /home/user/Downloads/tor-browser-build/out/mmdebstrap-image/container-image_ubuntu-base-20.04.1-base-amd64.tar.gz

Using file /home/user/Downloads/tor-browser-build/projects/mmdebstrap-image/mmdebstrap-no-user-ns.patch

Error: /home/user/Downloads/tor-browser-build/tmp/rbm-CrHraG/rbm-containers/36cd4e289c8d2b2e4583cea9c9ca94cdafd886880501b8e6a2671ce2a8fef72a is not a directory
Error: Error starting remote:



Error: Could not find uid in /etc/subuid

Error: failed to set uidmap

Other notes

I believe this bug was introduced during the switch from runc to rootless containers. Building as a non-root user works fine.

Support for building as root is useful because Cirrus VM's run the build script as root.

I'm not sure if this is an RBM bug or a tor-browser-build bug; feel free to move this to the RBM repo if you think it belongs there.