[Buildroot] error during cpio build failing to rm

Ben Dooks ben at fluff.org
Fri Mar 11 17:13:25 UTC 2022


I'm getting the following error with upstream buildroot:

rm: refusing to remove '.' or '..' directory: skipping '/home/ben/project/buildrot/output/build/buildroot-fs/cpio/target/run/..'
rm: refusing to remove '.' or '..' directory: skipping '/home/ben/project/buildrot/output/build/buildroot-fs/cpio/target/tmp/..'
make: *** [fs/cpio/cpio.mk:74: /home/ben/project/buildroot/output/images/rootfs.c

I've temprarily fixed this with:

diff --git a/fs/common.mk b/fs/common.mk
index 45beb5ae7b..6bb993663f 100644
--- a/fs/common.mk
+++ b/fs/common.mk
@@ -186,7 +186,7 @@ $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): $$(ROOTFS_$(2)_DEPENDENCIES)

        $$(foreach hook,$$(ROOTFS_$(2)_PRE_GEN_HOOKS),\

	                $$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)$$(sep))
			-       echo "rm -rf $$(TARGET_DIR)/run/* $$(TARGET_DIR)/run/.[^.]* $$(TARGET_DIR)/tmp/* $$(TARGET_DIR)/tmp/.[^.]*" >> $$(FAKEROOT_SCRIPT)
			+       echo "rm -rf $$(TARGET_DIR)/run/* $$(TARGET_DIR)/tmp/*" >> $$(FAKEROOT_SCRIPT)
			        $$(call PRINTF,$$(ROOTFS_REPRODUCIBLE)) >> $$(FAKEROOT_SCRIPT)
				        $$(call PRINTF,$$(ROOTFS_SELINUX)) >> $$(FAKEROOT_SCRIPT)
					        $$(call PRINTF,$$(ROOTFS_$(2)_CMD)) >> $$(FAKEROOT_SCRIPT)

It looks like this was introduced in 5e78e7e97d772124f0d31653aca33731abe5b4db

Author: Norbert Lange <nolange79 at gmail.com>
Date:   Sat Jun 6 00:48:57 2020 +0200

    fs: clean the volatile /run and /tmp directories
    

Any ideas on how to fix properly?


-- 
Ben Dooks, ben at fluff.org, http://www.fluff.org/ben/

Large Hadron Colada: A large Pina Colada that makes the universe disappear.




More information about the buildroot mailing list