NokiaTube | New address | Mode Phone | On high quality
Skip to content

nixos-install --channel nixos-unstable --flake ... gets killed by the kernel for OOM'ing #16808

Open

Description

@cplir-c

Platform

Raspberry Pi 4b, 4GB

Install Media:

Additional information

  • Somehow I used the little extra space in the / partition, maybe by running nix-shell -p neovim
  • I was out of space on the built-in / ext4 partition, which also ran /nix/store and /tmp.
  • I tried mounting a new btrfs partition of 12 GB with the contents of /nix/store (copied during mkfs) on top of /nix/store, but I still had errors (maybe from the /tmp being full?), and it wouldn't let me unmount it because that's the entire system, so I had to reboot.
  • I tried to do a GC with nix-store --gc, and it failed because of disk space
  • I tried mounting a tmpfs on /tmp-new, cp'ing systemd's files over there, and then bind mounting /tmp-new to /tmp, and it helped some but not enough...
  • I unwisely decided to delete /nix/var/nix/db/db.sqlite, thinking that a command could regenerate it from the nix store
  • It turns out such a command doesn't seem to exist, and I even found a stackoverflow post saying to do a nixos-install at that point (it was about someone having a corrupted database instead of deleting it).
  • I reorganize my btrfs partition so there's a subvolume for its /, /home, and /nix
  • I mount the btrfs partition on /mnt
  • Having pointed the basic wrapper-flake at nixos-unstable, I run nixos-install --flake, and it does nothing.
  • I am confused, and read the nixos-install --help.
  • It says --flake takes a flake argument.
  • I try using the host system's config a couple times (I'd generated and edited it in /etc/nixos, and then copied it to /mnt/etc/nixos)
  • Eventually I realize that I should pass /mnt/etc/nixos instead?
  • At some point in that, I get an inscrutible error about it looking for a flake in /mnt/home and not finding one, and then it gives up. The only place I had put a /home was in my filesystem configuration in hardware-configuration.nix, and as the other subvolume in /mnt. The default subvolume was /.
  • I find a file in ~/.nix on the host system that looks like it points to the local unpacked nixos-image-sd-card-26.11pre1105037.1c89083e451e-aarch64-linux as a channel or something? I don't touch it because I don't know the format, and nix-channel looks like it wanted to rebuild the system.
  • When I try to do a nixos-install using the --flake switch, it tries to copy something that looks like the above channel to my new installation, but says it doesn't exist. At one point I tried copying that store path over manually, but I think that didn't work either.
  • When I try to do a nixos-install without --flake, it seems to want to use local store paths ? I forget how that errors.
  • When I try to do a nixos-install --channel nixos-unstable --flake /mnt/etc/nixos/#${HOSTNAME} (with the right hostname for my flake configuration), it says copying channel... and slowly talks about many renames, starting with coq-packages being deprecated in favor of rocq-packages. The memory usage grows pretty quickly, until the kernel oom-kills the nix process.
    • What channel is it trying to copy?
    • What is the correct form for a channel? (I know it's in the docs, but this should be part of or linked from the error that isn't there...)

Output

Not easily copyable because the machine does not have a windowing system yet.
Should I copy logs of some kind? The system is still setup.

Checklist

  • checked [latest Nix manual] ([source])
    • Checked for what?
  • checked [open installer issues and pull requests] for possible duplicates
    • Too many hits for "nixos-install oom", but no title describing the same thing?
  • reviewed the [contributing guide]

Activity

  1. xokdvium commented on Nov 12, 2026

    @xokdvium
    Contributor

    I'm not 100% sure this belongs in the nix repo at this point? This is NixOS installer, not Nix installer related. So maybe try getting this filed in nixpkgs repo too?

  2. NaN-git commented on Nov 12, 2026

    @NaN-git
    Contributor

    @cplir-c This does not seem to be a nix issue. When I encounter OOM issues on my RPi then I just reduce the number of parallel builds and threads per build. You can check whether adding --cores 1 to the nixos-install command helps.

  3. cplir-c commented on Nov 12, 2026

    @cplir-c
    Author

    I didn't know that nixos-install was an "installer" -- I thought an installer would be more interactive, or at least fall back on it like in other distributions with install scripts I've used (Fedora Kinoite, Alpine).

    There's a few things here that're nix itself:

    • nix-store --gc needing storage to garbage collect when plenty of RAM was available
      • No fallback for /tmp or /usr/tmp (like mounting a /usr/tmp) when it's full and RAM is available
    • No way to recover or regenerate the database (very possibly not easily solvable)
    • Inscrutable SQL insert failure message on any operation after the database is deleted (yes, it's because the database is deleted, but how does that impact the operations, especially ones that continue?)

    Also, I had to pkill --sig sigkill a few nix processes, and they must've left their locks in place, because they seemingly just checked if it was still there every second or two (looking at top), and didn't emit any warnings or anything. I ended up deleting /nix/var/nix/db/big-lock and /nix/var/nix/gc.lock when no nix processes were running, so it could continue?

  4. cplir-c commented on Nov 12, 2026

    @cplir-c
    Author

    @cplir-c This does not seem to be a nix issue. When I encounter OOM issues on my RPi then I just reduce the number of parallel builds and threads per build. You can check whether adding --cores 1 to the nixos-install command helps.

    Thanks, I'll try this!

  5. xokdvium commented on Nov 12, 2026

    @xokdvium
    Contributor

    nix-store --gc needing storage to garbage collect when plenty of RAM was available

    This is unavoidable because sqlite.

    very possibly not easily solvable

    Entirely impossible, at least in the current store model where references are other metadata is only available in the database. For references, there's no way to recover those as those are only known from the context.

    I think all the above issues have their corresponding issues though.

  6. xokdvium commented on Nov 12, 2026

    @xokdvium
    Contributor

    This is unavoidable because sqlite.

    Note that there's already a hack to pre-reserve some spare space on disk that could get freed up when GC-ing in a full-disk situation although it doesn't work on some filesystems AFAIK.

  7. cplir-c commented on Nov 12, 2026

    @cplir-c
    Author

    The backing filesystem was ext4.

    If that's it, this issue can probably be closed.
    Could one of you link me to where I can report nixos-install issues? (I don't know what nixpkgs package contains it)

    Oh right!
    A couple of ideas:

    • If the failed nix-shell cleaned up after itself after failing from disk space, then I wouldn't have stayed out of disk space... is that a feature request already?
    • If the GC could use a ramdisk to rebuild the store and database (probably on request), I think that would work... but at that point a nixos-install or -rebuild would probably be the intended solution. And it still might not quite help on my pi enough (3.8 GB nix store & root partition, 4GB ram).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions