System rebuild fails after channel update to 20.03

Hi!

I’m currently on nixos 19.09 and wanting to upgrade to 20.03.

# nixos-version
19.09.2520.289466dd6a1 (Loris)

I’ve updated my channels:

# nix-channel --list
nixos https://nixos.org/channels/nixos-20.03
nixos-unstable https://nixos.org/channels/nixos-unstable
unstable https://nixos.org/channels/nixos-unstable

Now, I’ve had to make a few corrections to my configs following warnings after my first attempts at nixos-rebuild --upgrade switch.

Now, I’m stuck with a syntax error: syntax error, unexpected $end, at /dev/nvme0n1p2:1:1

Full output of nixos-rebuild --show-trace --upgrade switch: nixos-rebuild logs · GitHub

This seems related to the hardware configuration? I’m really lost as to what to do with this.

My configuration.nix: https://github.com/DrPyser/configs/blob/nixos-20.03-upgrade/nixos/etc/nixos/configuration.nix

Thanks!

I’m no expert but maybe it will work if you have 20.03 channels only. Unstable didn’t work form me I had errors in some system derivations when I tried building last week.

The fact that it’s referencing your drive (nvme0n1p2) makes me think yes maybe something with the hardware/filesystems config.

What’s in your hardware-configuration.nix or your relevant config that references /dev/nvme0n1p2?

1 Like

It’s not referenced explicitly at all in my hardware-configuration.nix.
I am using lvm:

# lsblk -f
NAME                         FSTYPE      LABEL UUID                                   FSAVAIL FSUSE% MOUNTPOINT
loop0
└─docker-254:2-11409308-pool
loop1
└─docker-254:2-11409308-pool
nvme0n1
├─nvme0n1p1                  vfat        boot  CB25-FF72                               438.1M    14% /boot
└─nvme0n1p2                  crypto_LUKS       185e02ad-ab8a-4e95-abb9-1b2c1baf7e5d
  └─root                     LVM2_member       IehRny-m3jl-CpyY-0sWD-84sI-WoTL-jNP83c
    ├─nixos--vg-swap         swap        swap  1d3a24b2-016c-42ac-86df-469600ecb535                  [SWAP]
    └─nixos--vg-root         ext4        nixos 87e3f898-45a4-4cbf-8580-a2228a10b105    287.6G    32% /

My hardware config:

# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:

{
  imports =
    [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
    ];

  boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" ];
  boot.initrd.kernelModules = [ "dm-snapshot" ];
  boot.kernelModules = [ "kvm-intel" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/disk/by-uuid/87e3f898-45a4-4cbf-8580-a2228a10b105";
      fsType = "ext4";
    };

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/CB25-FF72";
      fsType = "vfat";
    };

  fileSystems."/mnt/usb1" =
    { device = "/dev/sdb";
      fsType = "iso9660";
      options = [ "nofail" ];
    };

  swapDevices =
    [ { device = "/dev/disk/by-uuid/1d3a24b2-016c-42ac-86df-469600ecb535"; }
    ];

  nix.maxJobs = lib.mkDefault 8;
  powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
}

Thanks, but no cigar. Removing all other channels doesn’t seem to solve the problem.

Another idea would be too look if you’re not mixing EFI and bios loader. I had some problems with it (as it confuses me so much), but obviously I used to have more meaningful errors than yours.
config/configuration.nix at 992f85cbfe4cc6086b36d9b8b9773924a9402f33 · mixmixmix/config · GitHub - it is my EFI config on Badger and I have grub disabled there and do not explicitly provide the starting disk like you do.
I provide a startup device for legacy loading as here in Raccoon (config/configuration.nix at 992f85cbfe4cc6086b36d9b8b9773924a9402f33 · mixmixmix/config · GitHub)

Hope you’ll work out what works. Are you sure to have the setup working as is on 19.09? I know it is a silly question but always worth retracing your steps.

1 Like

Change:

      # configuration for disk encryption
      boot.initrd.luks.devices = {
          name = "root";
          device = "/dev/nvme0n1p2";
          preLVM = true;
      };

to:

  # configuration for disk encryption
  boot.initrd.luks.devices.root = {
      device = "/dev/nvme0n1p2";
      preLVM = true;
  };
2 Likes

Thanks, that was it! Guess I should have read that warning better!