Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nixos-install not work combined with system.etc.overlay.enable #364006

Closed
benys opened this issue Dec 10, 2024 · 7 comments · Fixed by #364239
Closed

Nixos-install not work combined with system.etc.overlay.enable #364006

benys opened this issue Dec 10, 2024 · 7 comments · Fixed by #364239
Labels
0.kind: bug Something is broken

Comments

@benys
Copy link

benys commented Dec 10, 2024

Describe the bug

nixos-install is not compatible with system.etc.overlay enabled.
In my opinion during executing:

echo "remounting /etc..."
tmpMetadataMount=$(mktemp --directory -t nixos-etc-metadata.XXXXXXXXXX)
mount --type erofs -o ro ${config.system.build.etcMetadataImage} $tmpMetadataMount
# Mount the new /etc overlay to a temporary private mount.
# This needs the indirection via a private bind mount because you
# cannot move shared mounts.
tmpEtcMount=$(mktemp --directory -t nixos-etc.XXXXXXXXXX)
mount --bind --make-private $tmpEtcMount $tmpEtcMount
mount --type overlay overlay \
--options lowerdir=$tmpMetadataMount::${config.system.build.etcBasedir},${etcOverlayOptions} \
$tmpEtcMount

Enviroment varialbe TMPDIR is pointed to absolute path "root path" not "chrooted path".

Installation failed because of:

installing the boot loader...
remounting /etc...
mktemp: failed to create directory via template ‘/mnt/tmp.c4Gagx63Wy/nixos-etc-metadata.XXXXXXXXXX’: No such file or directory
mount: /nix/store/0fi088xpw8irvwzk64byvk9jb21v39vz-etc-metadata.erofs: can't find in /etc/fstab.
mktemp: failed to create directory via template ‘/mnt/tmp.c4Gagx63Wy/nixos-etc.XXXXXXXXXX’: No such file or directory
mount: bad usage
Try 'mount --help' for more information.
mount: overlay: can't find in /etc/fstab.
findmnt: can't read /proc/mounts: No such file or directory
Moving mount
Mounting beneath top mount
Success | move-mount.c: 443: main: Invalid number of arguments 1
umount: failed to parse /proc/self/mountinfo: No such file or directory
umount: : umount failed: No such file or directory.
rmdir: failed to remove '': No such file or directory
findmnt: can't read /proc/mounts: No such file or directory
Activation script snippet 'etc' failed (1)
warning: /root/.nix-defexpr/channels exists, but channels have been disabled.
warning: /nix/var/nix/profiles/per-user/root/channels exists, but channels have been disabled.
Due to https://github.com/NixOS/nix/issues/9574, Nix may still use these channels when NIX_PATH is unset.
Delete the above directory or directories to prevent this.
Error: Failed to parse os-release

Steps To Reproduce

Steps to reproduce the behavior:

  1. I check out https://git.sr.ht/~r-vdp/nixos-config/ configuration
  2. sudo nix --experimental-features "nix-command flakes" run 'github:nix-community/disko' -- --mode disko --flake "path://$PWD#hostname"
  3. sudo nixos-install --root /mnt --flake .#hostname --impure

Expected behavior

nixos-install should work normaly

Additional context

A few months ago, installation worked (on my current computer).

Metadata

Nixos run from installation disc:

 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.61, NixOS, 24.05 (Uakari), 24.05.6668.e8c38b73aeb2`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.8`
 - channels(root): `"nixos-24.05.6668.e8c38b73aeb2"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Notify maintainers

@r-vdp is your configuration :-) maybe you can check it

@benys benys added the 0.kind: bug Something is broken label Dec 10, 2024
@r-vdp
Copy link
Contributor

r-vdp commented Dec 10, 2024

Interesting. I've only used nixos-anywhere with this config.
It's definitely a bug if this doesn't work though.

@benys
Copy link
Author

benys commented Dec 10, 2024

I also tried "nixos-anywhere" I received similar result :-( (with remote execution)

@r-vdp
Copy link
Contributor

r-vdp commented Dec 10, 2024

Ah OK, I probably didn't reinstall any machine since I switched to using the overlay then.

@Mic92
Copy link
Member

Mic92 commented Dec 10, 2024

Weird that we don't have /proc inside the chroot?

umount: failed to parse /proc/self/mountinfo: No such file or directory

@benys
Copy link
Author

benys commented Dec 11, 2024

Yes I can confirm, that /proc doesn't exist inside the chroot.

Also command:
nix run 'nixpkgs#nixos-anywhere' -- -L --flake '.#hostname' --option pure-eval false [email protected]
returns:

copying path '/nix/store/f41fq6in6vsp4dl5klkmds311fndl33j-libreoffice-24.8.3.2-wrapped' from 'https://cache.nixos.org'...
copying path '/nix/store/8p1kpfcj4jl9l62q5madwm4qph57214r-mbrola-3.3' from 'https://cache.nixos.org'...
copying path '/nix/store/jwm74hh1fi0qi9yp7b5y0ss2vcc928gj-espeak-ng-1.51.1' from 'https://cache.nixos.org'...
copying path '/nix/store/nnkxa3x44gyinb6ikl86dawsk6q26ba8-speech-dispatcher-0.11.5' from 'https://cache.nixos.org'...
copying path '/nix/store/2lgkm1632il4nms286azmrqy7hbadcyy-libreoffice-24.8.3.2-wrapped' from 'https://cache.nixos.org'...
### Installing NixOS ###
Pseudo-terminal will not be allocated because stdin is not a terminal.
Warning: Permanently added 'xxx.xxx.xxx.xxx' (ED25519) to the list of known hosts.
installing the boot loader...
remounting /etc...
mktemp: failed to create directory via template ‘/mnt/tmp.uat5RdJJaS/nixos-etc-metadata.XXXXXXXXXX’: No such file or directory
mount: /nix/store/4kvn6bs0wgbngsq5bxhc8xv6yhf7bz9b-etc-metadata.erofs: can't find in /etc/fstab.
mktemp: failed to create directory via template ‘/mnt/tmp.uat5RdJJaS/nixos-etc.XXXXXXXXXX’: No such file or directory
mount: bad usage
Try 'mount --help' for more information.
mount: overlay: can't find in /etc/fstab.
findmnt: can't read /proc/mounts: No such file or directory
Moving mount
Mounting beneath top mount
Success | move-mount.c: 443: main: Invalid number of arguments 1
umount: failed to parse /proc/self/mountinfo: No such file or directory
umount: : umount failed: No such file or directory.
rmdir: failed to remove '': No such file or directory
findmnt: can't read /proc/mounts: No such file or directory
Activation script snippet 'etc' failed (1)
Error: Failed to parse os-release

Caused by:
    0: Failed to read /etc/os-release
    1: No such file or directory (os error 2)

@r-vdp
Copy link
Contributor

r-vdp commented Dec 11, 2024

Could you try again with the above PR?

@r-vdp
Copy link
Contributor

r-vdp commented Dec 11, 2024

Closing this as a duplicate of #319533

@r-vdp r-vdp closed this as completed Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants