diff --git a/meta/classes-recipe/image.bbclass b/meta/classes-recipe/image.bbclass
index 1e3c784ec930..12c0478f1cc5 100644
--- a/meta/classes-recipe/image.bbclass
+++ b/meta/classes-recipe/image.bbclass
@@ -50,7 +50,7 @@ IMAGE_INSTALL_DEBUGFS ?= ""
 
 # These packages will be removed from a read-only rootfs after all other
 # packages have been installed
-ROOTFS_RO_UNNEEDED ??= "update-rc.d base-passwd shadow ${VIRTUAL-RUNTIME_update-alternatives} ${ROOTFS_BOOTSTRAP_INSTALL}"
+ROOTFS_RO_UNNEEDED ??= "update-rc.d base-passwd shadow shadow-uidmap libsubid ${VIRTUAL-RUNTIME_update-alternatives} ${ROOTFS_BOOTSTRAP_INSTALL}"
 
 # packages to install from features
 FEATURE_INSTALL = "${@' '.join(oe.packagegroup.required_packages(oe.data.typed_value('IMAGE_FEATURES', d), d))}"
diff --git a/meta/recipes-extended/shadow/shadow_4.20.3.bb b/meta/recipes-extended/shadow/shadow_4.20.3.bb
index 683a284aad13..c1e621288ac3 100644
--- a/meta/recipes-extended/shadow/shadow_4.20.3.bb
+++ b/meta/recipes-extended/shadow/shadow_4.20.3.bb
@@ -174,7 +174,7 @@ do_install:append:class-target() {
 	oe_runmake -C ${B}/man DESTDIR="${D}" sbindir="${base_sbindir}" usbindir="${sbindir}" install-man
 }
 
-PACKAGES =+ "${PN}-base"
+PACKAGES =+ "${PN}-base ${PN}-uidmap libsubid"
 FILES:${PN}-base = "\
     ${base_bindir}/login.shadow \
     ${base_bindir}/su.shadow \
@@ -186,6 +186,21 @@ FILES:${PN}-base = "\
 "
 RDEPENDS:${PN} += "${PN}-base"
 
+# The subordinate id tools, on their own for images that need user namespaces
+# without the rest of shadow's setuid tools - Debian's uidmap and libsubid.
+FILES:${PN}-uidmap = "\
+    ${bindir}/newuidmap \
+    ${bindir}/newgidmap \
+    ${bindir}/getsubids \
+    ${sysconfdir}/subuid \
+    ${sysconfdir}/subgid \
+"
+RDEPENDS:${PN} += "${PN}-uidmap"
+
+FILES:libsubid = "${libdir}/libsubid.so.*"
+# A stable name, so ROOTFS_RO_UNNEEDED can list it across soname bumps.
+DEBIAN_NOAUTONAME:libsubid = "1"
+
 inherit update-alternatives
 
 ALTERNATIVE_PRIORITY = "200"
