Raspberry Pi: First `rebuild switch` hangs on `gcc ... ruby`

Hello,

New to NixOS but been using RPis for a few years and have some experience with a handful of Linux distros.

I had nixos running on an RPi 3b for a couple weeks and decided to see what a “fresh reinstall” looked like, since my understanding is that one of the big advantages of nixos is reproducibility of a system based essentially just the configuration.nix.

  • backed up my full SD card just in case
  • copied /etc/nixos/*.nix to another computer
  • followed the NixOS on ARM instructions to download a fresh aarch64 build of 20.03 (seems to be passing)
  • verified the hash on the download
  • flashed this to my SD card
  • booted (seems fine)
  • start sshd and change root passwd
  • copy over my backed up *.nix
  • sudo nixos-rebuild switch test

Here, it hangs on a step that looks like gcc trying to compile ruby. I’ve let it run overnight, rebooted, even reflashed the SD card and tried again, every time it hangs here.

gcc -c -I. -I/nix/store/ay3n1j1gf2n3gyqrafwm38wp1m048wrm-ruby-2.6.6/include/ruby-2.6.0 -I/nix/store/ay3n1j1gf2n3gyqrafwm38wp1m048wrm-ruby-2.6.6/include/ruby-2.6.0/aarch64-linux -DRUBY_VERSION=26 -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -I/nix/store/jw03x2qw8mhag52xwr4xnqq6pdyjw1n2-glib-2.62.4-dev/include -I/nix/store/jw03x2qw8mhag52xwr4xnqq6pdyjw1n2-glib-2.62.4-dev/include/glib-2.0 -I/nix/store/q8w0nyhx2acvcgx7kkdfps0wmgvvz3dj-glib-2.62.4/lib/glib-2.0/include -I/nix/store/l5bx9mxi69zaydl6q79bb3lq5dvbd8n5-gtk+3-3.24.13-dev/include/gtk-3.0 -I/nix/store/wrn2xwn6hlzjrpnn8182bj77a21jmh0a-atk-2.34.1-dev/include/atk-1.0 -I/nix/store/l4q6142p28jjaicwfa70lwnxr26phal6-cairo-1.16.0-dev/include/cairo -I/nix/store/yld0m23fal83ysampmh09r4w5v9vk0s4-freetype-2.10.1-dev/include/freetype2 -I/nix/store/yld0m23fal83ysampmh09r4w5v9vk0s4-freetype-2.10.1-dev/include -I/nix/store/lkih64gvysch2lzzxbgzc0fd355ybm0z-gdk-pixbuf-2.40.0-dev/include/gdk-pixbuf-2.0 -I/nix/store/yks37jgp165c1nshh7awd58l67xja2cy-pango-1.44.7-dev/include/pango-1.0 -I/nix/store/ycjgh2pb91y89nij4z2jf5pycgrkr4ah-harfbuzz-2.6.4-dev/include/harfbuzz   -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1        -o objects/if_ruby.o if_ruby.c

What is going wrong? And should it be downloading from the aarch64 binary cache instead of compiling from source here?

Many thanks in advance!

Huh, maybe I’m using the wrong image?

What’s the difference between these two:

?

I’m using the first one.

I guess those two are just two names for the same image? I thought they may be different since the latter has an extra -aarch64 in the name, but the downloaded images seem to have the same naming scheme (just a different build number).

Tried both of these with no dice, also hangs on nixos-rebuild switch (or test).

Working now, with no particularly interesting changes. ¯\_(ツ)_/¯

The only things I did differently:

  • Installed the 1943.de493bd7492 build, which didn’t work (hung at the same place as above)
  • Removed my /etc/nixos/*.nix files and instead used nixos-generate-config to get something generic
  • Ran sudo nixos-rebuild switch --upgrade, which worked
  • Reboot
  • Then the default boot target wouldn’t boot? Hung on boot screen at waiting for kernel or something like that
  • Ran sudo nixos-rebuild switch --upgrade, again, which worked
  • Reboot (with default boot target) which now worked for some reason
  • Reinstall my /etc/nixos/*.nix and remove /etc/nixos/hardware.nix (which I hadn’t used previously)
  • Ran sudo nixos-rebuild switch --upgrade, again, which worked this time (no hang at ruby)
  • Reboot

Everything is back to normal now. No idea why.