Robertof / nixos-docker-sd-image-builder

Build custom SD images of NixOS for your Raspberry Pi (or any other supported AArch64 device) in 5-20 minutes.
MIT License
214 stars 35 forks source link

R pi 3 not responding after reboot #15

Closed SuperCipher closed 4 years ago

SuperCipher commented 4 years ago

I have try this /etc/nixos/configuration.nix from https://github.com/Robertof/nixos-docker-sd-image-builder#raspberry-pi-3-and-4 and https://citizen428.net/blog/installing-nixos-raspberry-pi-3

after config I run nixos-rebuild switch nix-collect-garbage -d nixos-rebuild switch reboot

after that raspberry pi went missing from the local network no flashing green light no ethernet flashing light. try unplug and plug again still no respond.

Can anyone share their working R pi 3 config with me or suggest a way to troubleshooting Thankyou

poscat0x04 commented 4 years ago

same issue here

SuperCipher commented 4 years ago

@poscat0x04 I have try a few times with other configurations and it's work now. You don't need to run nixos-generate-config just created configuration file at /etc/nixos/configuration.nix So this is my current working configuration.

{

  system.stateVersion = "20.03";

  # NixOS wants to enable GRUB by default
  boot = {
  loader.grub.enable = false;
  loader.raspberryPi.enable = true;
  loader.raspberryPi.version = 3;
  kernelPackages = pkgs.linuxPackages_latest;
  kernelParams = ["cma=256M"];
  };

  # File systems configuration for using the installer's partition layout
  fileSystems = {
    "/" = {
      device = "/dev/disk/by-label/NIXOS_SD";
      fsType = "ext4";
    };
  };

  networking.hostName = "nixpi"; # unleash your creativity!

  environment.systemPackages = with pkgs; [
    raspberrypi-tools
    vim
    git
  ];

  users.users.pi = {
    isNormalUser = true;
    # Don't forget to change the home directory too.
    home = "/home/pi";
    # This allows this user to use `sudo`.
    extraGroups = [ "wheel" "networkmanager" ];
    # SSH authorized keys for this user.
    openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICxckLaE0uWBu327qvkGDqG1EpY7D0KeCQRu9rld/tre rpi 3" ];
  };

  security.sudo.wheelNeedsPassword = false;

  i18n.defaultLocale = "en_US.UTF-8";

  # Preserve space by sacrificing documentation and history
  documentation.nixos.enable = false;
  nix.gc.automatic = true;
  nix.gc.options = "--delete-older-than 30d";
  boot.cleanTmpDir = true;

  # Configure basic SSH access
  services.openssh = {
    enable = true;
    permitRootLogin = "yes";
    passwordAuthentication = false;
    challengeResponseAuthentication = false;
  };

  systemd.services.sshd.wantedBy = pkgs.lib.mkForce [ "multi-user.target" ];

  # Use 1GB of additional swap memory in order to not run out of memory
  # when installing lots of things while running other things at the same time.
  swapDevices = [ { device = "/swapfile"; size = 1024; } ];

}

After run nixos-rebuild switch and reboot I have to wait for 30-40 minutes before the change reflex on my R pi 3 for some reason. So when I ssh in after reboot I have to ssh as nixos (the user specified in the image builder https://github.com/Robertof/nixos-docker-sd-image-builder/blob/master/config/sd-image.nix#L10)

Robertof commented 4 years ago

Hi guys, sorry for the late response! I'm glad you sorted it out -- FWIW, the configuration you can find in the README is extremely similar to the configuration I'm using right now on my Pi 3, so I found it surprising that it wouldn't work. The only difference is that on my production system I moduralised it a bit more. You also shouldn't need any of the wantedBy overrides on the production system.

Finally note that there should be no nixos user after rebuilding unless you've accidentally included the installer configuration as well. There should just be the user you created. See this on my RPi using the mentioned config:

# grep nixos /etc/passwd
# 

(the home directory is left there though, but can be safely removed).

Anyway I'm happy that you sorted it out, thank you for using this repo!

Roberto