mv: Behavior different from gnu when moving directory symbolic links (nixos-rebuild switch fails)
Hey, (as we were talking on #help on Discord) I think we might actually have a bug here. (edit: well, we do - it was reproduced)
When I try rebuilding switch my NixOS system, even using the gnu ln (due to #6350) I still stumble on that mv error making the switch fail. See: https://github.com/LuNeder/nixos-config/blob/62092e522557eebe13946f5fa5a4b16b53faa6e0/new-new-log-file
This mv: cannot move '/run/wrappers/bin-tmp' to '/run/wrappers/bin': Directory not empty error does not happens when using the gnu mv. Hardcoding the script to use gnu mv makes the nixos-rebuild switch successful! See: https://github.com/LuNeder/nixos-config/blob/324f1bc4d3180e8b6485a765c1b8c21360972c99/log-file-but-fixed-maybe
I once again made those scripts print the stat (and ls) of the stuff it’s messing with, before and after the mv command (uutils only has the before, because mv fails).
- Uutils: https://github.com/LuNeder/nixos-config/blob/62092e522557eebe13946f5fa5a4b16b53faa6e0/log-stat-mv
- Gnu: https://github.com/LuNeder/nixos-config/blob/324f1bc4d3180e8b6485a765c1b8c21360972c99/log-stat-mv-gnu
If it helps with the troubleshooting, here’s the complete script in which the problematic mv is located: https://github.com/LuNeder/nixos-config/blob/62092e522557eebe13946f5fa5a4b16b53faa6e0/suid-strt-troubleshoot#L168
Additionally, just like on the 6350 case, both /run/… paths are symbolic links to directories. And just like on that case, this problem does not happens at boot (when /run/wrappers/bin probably doesn’t exist yet) - it only happens when switching on a booted system (when that path does exist).
This affects any mv -T [anything] symlink-to-dir operation.