NixOS / NixOS/nixpkgs

poor interaction between nixos/lib/make-ext4-fs.nix and sdImage.expandOnBoot leads to failure on first boot

Open
#435,489 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0.kind: bug 2.status: stale
Dominant language
Nix
Stars
26.2k
Forks
20.1k
PR merge metrics
PR metrics pending

Description

depending on the files included in the rootfs (adding a lot of small files via installer/cd-dvd/channel.nix for example), make-ext4-fs.nix can wind up creating a disk image that only has 68 inodes free

setup-etc.pl then fails to create critical things like /etc/systemd
and AFTER that failed, sdImage.expandOnBoot then expands things, and now it has plenty of free space

then systemd explodes due to no default.target and the machine hangs

nix build github:cleverca22/rpi-nixos-example/broken#packages.aarch64-linux.sdImage should reproduce a broken image with only 68 inodes free

moving the rootfs expand earlier (either initrd, or an activate script) would be one solution to the problem
changing make-ext4-fs.nix to leave more free space is another

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with nix build github:cleverca22/rpi-nixos-example/broken#packages.aarch64-linux.sdImage. Start by reading lib/make-ext4-fs.nix, sdImage.expandOnBoot, installer/cd-dvd/channel.nix, and setup-etc.pl to trace inode allocation and expansion order. Done means the image creates /etc/systemd and default.target before systemd starts, and the first boot succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux
Domain
build-system, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.