Describe the bug
If there are any files under /mnt (of the target's root file system), nixos-install fails.
Steps To Reproduce
Steps to reproduce the behavior:
- Boot into NixOS live CD.
- Mount target's root partition as
/mnt.
- Mount target's boot partition as
/mnt/boot.
- Create
/mnt/mnt directory.
- Create a file under
/mnt/mnt: touch /mnt/mnt/file.
- Generate configuration files:
nixos-generate-config --root /mnt.
- Run
nixos-install.
Expected behavior
nixos-install should finish normally.
Additional context
The last lines of nixos-install's output:
installing the boot loader...
setting up /etc...
updating GRUB 2 menu...
installing the GRUB 2 boot loader on /dev/sda...
Installing for i386-pc platform.
Installation finished. No error reported.
rmdir: failed to remove '/mnt': Directory not empty
In my usage scenario I keep the NixOS configuration files on a separate partition that should be mounted as a directory under the target's /mnt, and /etc/nixos/configuration.nix is a relative symbolic link pointing to that location.
I can confirm that nixos-install on NixOS 22.05 doesn't have this issue.
I think that the culprit could be this line, and probably rmdir should be replaced by rm -r.
Notify maintainers
@rnhmjoj
@ncfavier
Metadata
[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
- system: "x86_64-linux"
- host os: `Linux 6.1.31, NixOS, 23.05 (Stoat), 23.05pre-git`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.13.3`
- channels(root): `"nixos-23.05pre-git"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
Describe the bug
If there are any files under
/mnt(of the target's root file system),nixos-installfails.Steps To Reproduce
Steps to reproduce the behavior:
/mnt./mnt/boot./mnt/mntdirectory./mnt/mnt:touch /mnt/mnt/file.nixos-generate-config --root /mnt.nixos-install.Expected behavior
nixos-installshould finish normally.Additional context
The last lines of
nixos-install's output:In my usage scenario I keep the NixOS configuration files on a separate partition that should be mounted as a directory under the target's
/mnt, and/etc/nixos/configuration.nixis a relative symbolic link pointing to that location.I can confirm that
nixos-installon NixOS 22.05 doesn't have this issue.I think that the culprit could be this line, and probably
rmdirshould be replaced byrm -r.Notify maintainers
@rnhmjoj
@ncfavier
Metadata