Nixpkgs: Impossible to easily upgrade NixOS from <=17.09 to 18.09

Created on 8 Sep 2018  路  13Comments  路  Source: NixOS/nixpkgs

Issue description

Since 18.09 now forces people to update their Nix version to 2.0 (see https://github.com/NixOS/nixpkgs/pull/45779), only people running a 18.03 system will actually be able to smoothly upgrade with the default update procedure (upgrade channel, nixos-rebuild). Reason being that in versions <=17.09 the default Nix daemon version is <2.0, which means that even if you install a Nix 2.0 client, it won't succeed due to the daemon/client mismatch (see https://github.com/NixOS/nixpkgs/issues/42319).

Potential solutions

  • Improve upgrade instructions to mention that people need to do a 2-step upgrade process through 18.03
  • (partial solution) Don't force people on Nix 2.0 until a later release, such that this will only be a problem when upgrading from <=17.09 to 19.03

Preferably both of those

Workarounds

  • Upgrade via 18.03
  • Boot into the installer and call nixos-install
  • Set nix.package = before upgrading

In my opinion we should revert the 2.0 forcing anyways, there's just too many problems with 2.0 yet to be addressed. There's been already 2 people in IRC with super annoying Nix upgrade process bugs since the bump 2 weeks ago.

Ping @samueldr @vcunat @grahamc @lheckemann @symphorien @ElvishJerricco

stale

All 13 comments

IMHO:

Boot into the installer and call nixos-install

is the right solution. Low fuss and high reliability.

@LnL7 Not sure how that's supposed to work, because importing nixpkgs will fail in any case with a Nix version <2.0, because of the check in <nixpkgs/default.nix>. nixos-rebuild should have the same problem.

Now, the build-time closure of nix itself probably won't use placeholders yet, so the abortion itself would be the only blocker (as only new nix gets built and then it's used for further evaluation), but I can't see how to easily enforce this [...]

Yeah, it works slightly differently then I expected. I thought only nix itself would rebuild or substitute using the fallback paths.

If fallback was to be used/preferred, you wouldn't be able to use a custom nix for your nixos (for the OS evaluation step at least).

Yes, the fallback paths should be used as a fallback. 馃槃

As far as I recall, it is also not possible to upgrade to 18.03 from 17.03 without going though 17.09 first, since the Nix 1.11 in 17.03 is too old to evaluate 18.03, so this isn't a completely unusual situation.

I do agree that it's nice to facilitate a good upgrade path for people who still use unsupported versions of NixOS.

I just booted up a 17.03 VM and ran:

$ nixos-rebuild boot -I nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-18.03.tar.gz

And it worked just fine. I believe it evaluated the nix package from the 18.03 nixpkgs and used that to evaluate the system configuration.

Maybe we could allow to just evaluate the nix package from nixpkgs and have a test that we do not use nix 2.0 features for its dependencies yet?

I was on an old 18.03 system with Nix 1.11. I browsed around Hydra to find the latest Nix build from the nixos-unstable channel, and ran

nix-store -r /nix/store/sm740vh74gh7r8ww6q3wf067xkq1nb64-nix-2.3.1
sudo PATH="/nix/store/sm740vh74gh7r8ww6q3wf067xkq1nb64-nix-2.3.1/bin:$PATH" _NIXOS_REBUILD_REEXEC=1 nixos-rebuild boot

Maybe nixos-rebuild --with-nix=<path> should be an option.

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.

While this is theoretically still an issue, nobody is using those versions anymore. The problem might occur again in the future though.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

teto picture teto  路  3Comments

retrry picture retrry  路  3Comments

copumpkin picture copumpkin  路  3Comments

sid-kap picture sid-kap  路  3Comments

rzetterberg picture rzetterberg  路  3Comments