diff --git a/meta-oniro-core/classes/oniro-image.bbclass b/meta-oniro-core/classes/oniro-image.bbclass
index f0107711e3b49b5ae942c2aac85655b6d9562d24..d5131692b02f600be524c25e823a72566b5cfc00 100644
--- a/meta-oniro-core/classes/oniro-image.bbclass
+++ b/meta-oniro-core/classes/oniro-image.bbclass
@@ -141,5 +141,16 @@ 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.
+    import rootfspostcommands
+    for file in ['subuid', 'subgid']:
+        filename = os.path.join(d.expand('${IMAGE_ROOTFS}${sysconfdir}'), file)
+        rootfspostcommands.remove_backup(filename)
+}