diff --git a/meta-oniro-core/classes/oniro-image.bbclass b/meta-oniro-core/classes/oniro-image.bbclass
index 8dfe0afc7e65eaec55db2cd02ebdb8945d8e2c07..7dcb5a1f643e87891b0fa3e30d2b2571613219c0 100644
--- a/meta-oniro-core/classes/oniro-image.bbclass
+++ b/meta-oniro-core/classes/oniro-image.bbclass
@@ -138,5 +138,17 @@ python deploy_boot_artifacts_to_rootfs() {
                          os.path.join(rootfs_dir, dst_path))
         run_cmd(install_cmd)
 }
-
 ROOTFS_POSTPROCESS_COMMAND += "deploy_boot_artifacts_to_rootfs;"
+
+python () {
+    d.appendVar('ROOTFS_POSTPROCESS_COMMAND', ' clean_backup_files; ')
+}
+python clean_backup_files () {
+    # Cleanup other backup files generated by shadow-utils not covered by the
+    # sort_passwd existing rootfs postcommand.
+    # https://gitlab.eclipse.org/eclipse/oniro-core/oniro/-/issues/772
+    import rootfspostcommands
+    for file in ['subuid', 'subgid']:
+        filename = os.path.join(d.expand('${IMAGE_ROOTFS}${sysconfdir}'), file)
+        rootfspostcommands.remove_backup(filename)
+}