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

Installation over serial via syslinux is unecessarily fiddly #58198

Closed
2 tasks done
tomfitzhenry opened this issue Mar 24, 2019 · 13 comments · Fixed by #91086
Closed
2 tasks done

Installation over serial via syslinux is unecessarily fiddly #58198

tomfitzhenry opened this issue Mar 24, 2019 · 13 comments · Fixed by #91086

Comments

@tomfitzhenry
Copy link
Contributor

tomfitzhenry commented Mar 24, 2019

Installing nixos over serial via syslinux is fiddly, because:

  • serial terminals aren't enabled by default on all stages
  • on the boot stages that do have serial terminals enabled, they use inconsistent bitrates
Stage Bitrate
BIOS 115200 (typically)
syslinux 38400 115200 (fixed in #58196)
Linux boot serial terminal not enabled
Linux login 115200 (see stty)

In practice this means the user must either patch their image, or perform an installation while switching bitrates and adding serial terminals to kernel boot parameters.

We can make this smoother, by enabling serial on all stages, and ensuring they use the same bitrate.

@tomfitzhenry
Copy link
Contributor Author

tomfitzhenry commented Mar 24, 2019

My reading of the GRUB2 config suggests in GRUB2 the serial terminal isn't enabled by default:

# Serial access is a must!
submenu "" {return}
submenu "Serial console=ttyS0,115200n8" --class serial {
${grubMenuCfg}
${buildMenuAdditionalParamsGrub2 config "console=ttyS0,115200n8"}
}
}

What's the rationale for this, and does this apply for syslinux?

@stale
Copy link

stale bot commented Jun 3, 2020

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.

@stale stale bot added 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md and removed 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md labels Jun 3, 2020
@tomfitzhenry
Copy link
Contributor Author

The remaining step is step 2.

Step 2: Enable kernel serial console by default, by adding console=tty0 console=ttyS0,115200 to all boot entries.

This is just a matter of copying the existing serial boot entry for GRUB ( https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/cd-dvd/iso-image.nix#L325-L330 ) and adapting it to be a boot entry for syslinux: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/cd-dvd/iso-image.nix#L120-L146

I'll do this when I have time to test it.

@sneak
Copy link

sneak commented Sep 29, 2020

This would be very useful to me, as I'm trying to install nixos via virt-install without vnc (headless, serial console).

@sneak
Copy link

sneak commented Sep 29, 2020

Actually, I think just spawning a getty on the serial console after boot would be fine for my use case.

@tomfitzhenry
Copy link
Contributor Author

tomfitzhenry commented Sep 29, 2020

sneak@, if you're able to test #91086 that'd be much appreciated. It should make installation easier for you.

@sneak
Copy link

sneak commented Sep 29, 2020

Do you have an ISO I can download for that? Happy to test out.

@sneak
Copy link

sneak commented Sep 29, 2020

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/feature-request-spawn-getty-on-serial-console-in-installer-iso/9195/3

@tomfitzhenry
Copy link
Contributor Author

Do you have an ISO I can download for that? Happy to test out.

#91086 has instructions on building an ISO. See "I tested this change by building the image".

@tomfitzhenry
Copy link
Contributor Author

Actually, I think just spawning a getty on the serial console after boot would be fine for my use case.

FWIW, I think the installer already does this. You just have to sit through a blank Linux boot process. If the boot succeeds, getty should open on the serial console. If the boot fails, getty won't get chance and it's hard to diagnose the boot failure since the Linux boot doesn't write to the serial console (that's what #91086 aims to fix).

@samueldr
Copy link
Member

Stage-1 doesn't support multiple consoles yet.

#42255 was a first draft towards supporting this.

"Just" adding console=* here won't exactly help as only the last one will have the initial boot messages.

I mean to eventually get back to this problem and properly implement tests for bootlogd, in use in Mobile NixOS.

@sneak
Copy link

sneak commented Sep 30, 2020

FWIW, I think the installer already does this.

It does not. VNCing in and running systemctl start serial-getty@ttyS0 makes it show up, though.

The only output from the system via serial is:

Loading /boot/bzImage... ok
Loading /boot/initrd...ok

...and that's it.

peterhoeg pushed a commit that referenced this issue Dec 22, 2020
Prior to this commit, installation over serial console would requiring
manually having to modify the kernel modeline, as described in
#58198 .

This is unnecessarily fiddly, so this commit adds a syslinux boot
entry that has serial enabled.

GRUB already has a serial console entry:
https://github.com/NixOS/nixpkgs/blob/2c07a0800a76be01a3c255f39e21877a9a389f84/nixos/modules/installer/cd-dvd/iso-image.nix#L311-L317

Why 115200 bps? This is already used in other places, e.g. #58196

I tested this change by building the image, booting the image, and
observing the boot process over serial:

    $ cd nixos/
    $ nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-minimal.nix default.nix
    $ sudo cp /nix/store/arcl702c3z8xlndlvnfplq9yhixjvs9k-nixos-20.09pre-git-x86_64-linux.iso/iso/nixos-20.09pre-git-x86_64-linux.iso /dev/sdb

    $ picocom -b 115200 /dev/ttyUSB0
tomfitzhenry added a commit to tomfitzhenry/nixpkgs that referenced this issue May 24, 2021
tomfitzhenry added a commit to tomfitzhenry/nixpkgs that referenced this issue May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants