Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] init: create /dev/root in stage 2 too #33067

Closed
wants to merge 2 commits into from
Closed

Conversation

teto
Copy link
Member

@teto teto commented Dec 26, 2017

Motivation for this change

Solves (same problem)
#32406
NixOS/nixops#795

Create the symlink /dev/root in stage2 as in some cases (like when /proc is not available) stage 1 can't create it. I moved the /proc/cmdline parsing after /proc gets mounted.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@teto teto changed the title Install grub init: create /dev/root in stage 2 too Dec 26, 2017
@teto
Copy link
Member Author

teto commented Jan 10, 2018

Is there any reason to create the symlink in stage 1 ? maybe I could remove it from there so that it isn't done twice (or check if it exists beforehand) ?

When running nixops-libvirt with a host kernel via the command line

      cmdline="root=/dev/sda1 earlycon=ttyS0 console=ttyS0
      init=/nix/var/nix/profiles/system/init boot.debug=1 boot.consoleLogLevel=1 ";
      kernel="/host/kernel/arch/x86_64/boot/bzImage";

/proc/cmdline can't be read in stage 1 and thus /dev/root doesn't exist
which makes `nixops deploy` fail with

==========
client> copying closure...
server> copying closure...
e> closures copied successfully
client> updating GRUB 2 menu...
client> Failed to get blkid info for / on /dev/root at /nix/store/s54azprbp2ic2zpb7df2kb2pafmcrsdi-install-grub.pl line 185.
client> error: Traceback (most recent call last):
  File "/home/teto/nixops/nixops/deployment.py", line 705, in worker
    raise Exception("unable to activate new configuration")
Exception: unable to activate new configuration
==========

Solves
NixOS#32406
NixOS/nixops#795
@matthewbauer
Copy link
Member

This looks like a good change though I'm not very knowledgeable in the Linux stage stuff.

/cc @domenkozar

@teto
Copy link
Member Author

teto commented Feb 9, 2018

@matthewbauer thanks for the ping, If I deploy with a nixpkgs without this branch then I can't reboot the VM (that run with a host kernel) so that's annoying.

@teto
Copy link
Member Author

teto commented Feb 19, 2018

Would love to have some feedback on this. The only drawback I see is the loss of some logging if /proc/cmdline was correctly mounted and boot.debugtrace set. It can be solved by duplicating the boot.debutrace but I thought the extra complexity was not worth it.

@teto teto changed the title init: create /dev/root in stage 2 too [WIP] init: create /dev/root in stage 2 too Mar 9, 2018
@teto
Copy link
Member Author

teto commented Mar 13, 2018

This seems too peculiar a problem to justify the change, I'll try to work around it with boot.postCommands or fix it via a nixops patch instead.

@teto teto closed this Mar 13, 2018
@teto teto deleted the install-grub branch May 13, 2020 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants