After installing merge-usr in a fresh container (tested in both podman/docker containers), trying to run it results in a stack trace: # merge-usr INFO: Migrating files from '/bin' to '/usr/bin' WARNING: Skipping symlink '/bin/awk' INFO: Replacing '/bin' with a symlink to 'usr/bin' Traceback (most recent call last): File "/usr/lib/python-exec/python3.10/merge-usr", line 282, in <module> sys.exit(main()) File "/usr/lib/python-exec/python3.10/merge-usr", line 277, in main if not mu.run(): File "/usr/lib/python-exec/python3.10/merge-usr", line 236, in run os.rename(src, tmp) OSError: [Errno 18] Invalid cross-device link: '/bin' -> '/tmp2k2_7hc0' An environment to reproduce should be as simple as `docker run --volume /var/db/repos:/var/db/repos -it gentoo/stage3` and emerging merge-usr. A perfect fix would be to simply use a container that already has the proper layout, but merge-usr should probably support this case anyway in the meantime. Can't generate merged-usr images without such stages everywhere anyway.
This seems to be due to the directories existing on differing overlayfs layers. I guess a simple: # mv /bin /tmpbin # mv /tmpbin /bin Will get them into the same layer, and then merge-usr is able to continue.
merge-usr is calling rename("/bin", "/tmp2k2_7hc0") there. Have you tested that "mv" command? If it actually works, please strace it so we can see what system calls mv is making. I suspect it is doing a recursive copy, followed by a recursive delete.
Also, please provide the contents of /proc/self/mountinfo from a process running in the container.
Created attachment 826729 [details] mv.strace Requested strace output
Created attachment 826731 [details] /proc/self/mountinfo
Relevant reading: https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html#renaming-directories
Could you please test the bug879091-dir-rename branch? https://github.com/floppym/merge-usr/tree/bug879091-dir-rename
That works for me, thank you!
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=29e8109a12a05e6fa7020c3778adf549444c94c8 commit 29e8109a12a05e6fa7020c3778adf549444c94c8 Author: Mike Gilbert <floppym@gentoo.org> AuthorDate: 2022-11-02 20:10:55 +0000 Commit: Mike Gilbert <floppym@gentoo.org> CommitDate: 2022-11-02 20:10:55 +0000 sys-apps/merge-usr: add 4, drop 3 Closes: https://bugs.gentoo.org/879091 Signed-off-by: Mike Gilbert <floppym@gentoo.org> sys-apps/merge-usr/Manifest | 2 +- sys-apps/merge-usr/{merge-usr-3.ebuild => merge-usr-4.ebuild} | 0 2 files changed, 1 insertion(+), 1 deletion(-)