Skip to content

Commit

Permalink
chore: drop console ttyS0 argument
Browse files Browse the repository at this point in the history
Drop `console=ttyS0` argument for metal images/installer.

`console=ttyS0` causes lot of issues with bare metal hardware when
trying to use a physical serial port.

Ref:

* https://bugzilla.redhat.com/show_bug.cgi?id=1839923
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=763601;msg=17
* https://www.kernel.org/doc/html/latest/admin-guide/serial-console.html
* coreos/fedora-coreos-tracker#567

Fixes: #8695
Fixes: #8657
Fixes: #8127

Signed-off-by: Noel Georgi <git@frezbo.dev>
  • Loading branch information
frezbo committed Aug 27, 2024
1 parent 75cecb4 commit 19a44c2
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1523,12 +1523,14 @@ jobs:
if: github.event_name == 'schedule'
env:
IMAGE_REGISTRY: registry.dev.siderolabs.io
IMAGER_ARGS: --extra-kernel-arg=console=ttyS0
run: |
make iso secureboot-iso
- name: images-essential
if: github.event_name == 'schedule'
env:
IMAGE_REGISTRY: registry.dev.siderolabs.io
IMAGER_ARGS: --extra-kernel-arg=console=ttyS0
PLATFORM: linux/amd64
run: |
make images-essential
Expand Down Expand Up @@ -3110,13 +3112,15 @@ jobs:
if: github.event_name == 'schedule'
env:
IMAGE_REGISTRY: registry.dev.siderolabs.io
IMAGER_ARGS: --extra-kernel-arg=console=ttyS0
PLATFORM: linux/amd64
run: |
make images-essential
- name: secureboot-iso
if: github.event_name == 'schedule'
env:
IMAGE_REGISTRY: registry.dev.siderolabs.io
IMAGER_ARGS: --extra-kernel-arg=console=ttyS0
PLATFORM: linux/amd64
run: |
make secureboot-iso
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/integration-image-factory-cron.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-05-27T16:20:10Z by kres bcb280a.
# Generated on 2024-08-25T07:59:04Z by kres 8e4bbb4.

name: integration-image-factory-cron
concurrency:
Expand Down Expand Up @@ -84,12 +84,14 @@ jobs:
if: github.event_name == 'schedule'
env:
IMAGE_REGISTRY: registry.dev.siderolabs.io
IMAGER_ARGS: --extra-kernel-arg=console=ttyS0
run: |
make iso secureboot-iso
- name: images-essential
if: github.event_name == 'schedule'
env:
IMAGE_REGISTRY: registry.dev.siderolabs.io
IMAGER_ARGS: --extra-kernel-arg=console=ttyS0
PLATFORM: linux/amd64
run: |
make images-essential
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/integration-trusted-boot-cron.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2024-05-27T16:20:10Z by kres bcb280a.
# Generated on 2024-08-25T05:01:25Z by kres 8e4bbb4.

name: integration-trusted-boot-cron
concurrency:
Expand Down Expand Up @@ -84,13 +84,15 @@ jobs:
if: github.event_name == 'schedule'
env:
IMAGE_REGISTRY: registry.dev.siderolabs.io
IMAGER_ARGS: --extra-kernel-arg=console=ttyS0
PLATFORM: linux/amd64
run: |
make images-essential
- name: secureboot-iso
if: github.event_name == 'schedule'
env:
IMAGE_REGISTRY: registry.dev.siderolabs.io
IMAGER_ARGS: --extra-kernel-arg=console=ttyS0
PLATFORM: linux/amd64
run: |
make secureboot-iso
Expand Down
4 changes: 4 additions & 0 deletions .kres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -425,12 +425,14 @@ spec:
- only-on-schedule
environment:
PLATFORM: linux/amd64
IMAGER_ARGS: "--extra-kernel-arg=console=ttyS0"
IMAGE_REGISTRY: registry.dev.siderolabs.io
- name: secureboot-iso
conditions:
- only-on-schedule
environment:
PLATFORM: linux/amd64
IMAGER_ARGS: "--extra-kernel-arg=console=ttyS0"
IMAGE_REGISTRY: registry.dev.siderolabs.io
- name: integration-trusted-boot
command: e2e-qemu
Expand Down Expand Up @@ -1425,12 +1427,14 @@ spec:
- only-on-schedule
command: iso secureboot-iso
environment:
IMAGER_ARGS: "--extra-kernel-arg=console=ttyS0"
IMAGE_REGISTRY: registry.dev.siderolabs.io
- name: images-essential
conditions:
- only-on-schedule
environment:
PLATFORM: linux/amd64
IMAGER_ARGS: "--extra-kernel-arg=console=ttyS0"
IMAGE_REGISTRY: registry.dev.siderolabs.io
- name: factory-1.6-iso
command: e2e-image-factory
Expand Down
10 changes: 10 additions & 0 deletions cmd/installer/pkg/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"log"
"os"
"path/filepath"
"slices"
"syscall"
"time"

Expand Down Expand Up @@ -148,6 +149,15 @@ func Install(ctx context.Context, p runtime.Platform, mode Mode, opts *Options)
cmdline.SetAll(overlayOpts.KernelArgs)
}

// preserve console=ttyS0 if it was already present in cmdline for metal platform
existingCmdline := procfs.ProcCmdline()

if *existingCmdline.Get(constants.KernelParamPlatform).First() == constants.PlatformMetal && existingCmdline.Get("console").Contains("ttyS0") {
if !slices.Contains(opts.ExtraKernelArgs, "console=ttyS0") {
cmdline.Append("console", "ttyS0")
}
}

if err := cmdline.AppendAll(
opts.ExtraKernelArgs,
procfs.WithOverwriteArgs("console"),
Expand Down
8 changes: 8 additions & 0 deletions hack/release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ Talos Linux now supports a kernel command line argument `talos.device.settle_tim
title = "Platform Support"
description = """\
Talos Linux now supports Apache CloudStack platform.
"""

[notes.metal-image]
title = "Metal images"
description = """\
Starting with Talos 1.8, `console=ttyS0` kernel argument is removed from the metal images and installer. If running virtualized in QEMU (For eg: Proxmox), this can be added as an extra kernel argument if needed via Image Factory or using Imager.
This should fix slow boot or no console output issues on most bare metal hardware.
"""

[make_deps]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (m *Metal) KernelArgs(arch string) procfs.Parameters {
switch arch {
case "amd64":
return []*procfs.Parameter{
procfs.NewParameter("console").Append("ttyS0").Append("tty0"),
procfs.NewParameter("console").Append("tty0"),
}
case "arm64":
return []*procfs.Parameter{
Expand Down
5 changes: 5 additions & 0 deletions pkg/imager/imager.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ func (i *Imager) buildCmdline() error {

// platform kernel args
cmdline.Append(constants.KernelParamPlatform, p.Name())

if quirks.New(i.prof.Version).SupportsMetalPlatformConsoleTTYS0() && i.prof.Platform == constants.PlatformMetal {
cmdline.Append("console", "ttyS0")
}

cmdline.SetAll(p.KernelArgs(i.prof.Arch).Strings())

// board kernel args
Expand Down
13 changes: 13 additions & 0 deletions pkg/machinery/imager/quirks/quirks.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,16 @@ func (q Quirks) SupportsMultidoc() bool {

return q.v.GTE(minVersionMultidoc)
}

// maxVersionMetalPlatformConsoleTTYS0Dropped is the version that dropped console=ttyS0 for metal image.
var maxVersionMetalPlatformConsoleTTYS0Dropped = semver.MustParse("1.8.0")

// SupportsMetalPlatformConsoleTTYS0 returns true if the Talos version supports already has console=ttyS0 kernel argument.
func (q Quirks) SupportsMetalPlatformConsoleTTYS0() bool {
// if the version doesn't parse, we assume it's latest Talos
if q.v == nil {
return false
}

return q.v.LT(maxVersionMetalPlatformConsoleTTYS0Dropped)
}
2 changes: 1 addition & 1 deletion website/content/v1.8/talos-guides/configuration/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Kernel messages can be retrieved with `talosctl dmesg` command:
```sh
$ talosctl -n 172.20.1.2 dmesg

172.20.1.2: kern: info: [2021-11-10T10:09:37.662764956Z]: Command line: init_on_alloc=1 slab_nomerge pti=on consoleblank=0 nvme_core.io_timeout=4294967295 printk.devkmsg=on ima_template=ima-ng ima_appraise=fix ima_hash=sha512 console=ttyS0 reboot=k panic=1 talos.shutdown=halt talos.platform=metal talos.config=http://172.20.1.1:40101/config.yaml
172.20.1.2: kern: info: [2021-11-10T10:09:37.662764956Z]: Command line: init_on_alloc=1 slab_nomerge pti=on consoleblank=0 nvme_core.io_timeout=4294967295 printk.devkmsg=on ima_template=ima-ng ima_appraise=fix ima_hash=sha512 reboot=k panic=1 talos.shutdown=halt talos.platform=metal talos.config=http://172.20.1.1:40101/config.yaml
[...]
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Matchbox"
description: "In this guide we will create an HA Kubernetes cluster with 3 worker nodes using an existing load balancer and matchbox deployment."
aliases:
aliases:
- ../../../bare-metal-platforms/matchbox
---

Expand Down Expand Up @@ -67,7 +67,6 @@ Download these files from the [release](https://github.com/siderolabs/talos/rele
"slab_nomerge",
"pti=on",
"console=tty0",
"console=ttyS0",
"printk.devkmsg=on",
"talos.platform=metal",
"talos.config=http://matchbox.talos.dev/assets/controlplane.yaml"
Expand All @@ -93,7 +92,6 @@ Download these files from the [release](https://github.com/siderolabs/talos/rele
"slab_nomerge",
"pti=on",
"console=tty0",
"console=ttyS0",
"printk.devkmsg=on",
"talos.platform=metal",
"talos.config=http://matchbox.talos.dev/assets/worker.yaml"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ output:
kind: iso
outFormat: raw
skipped initramfs rebuild (no system extensions)
kernel command line: talos.platform=metal console=ttyS0 console=tty0 init_on_alloc=1 slab_nomerge pti=on consoleblank=0 nvme_core.io_timeout=4294967295 printk.devkmsg=on ima_template=ima-ng ima_appraise=fix ima_hash=sha512 lockdown=confidentiality
kernel command line: talos.platform=metal console=tty0 init_on_alloc=1 slab_nomerge pti=on consoleblank=0 nvme_core.io_timeout=4294967295 printk.devkmsg=on ima_template=ima-ng ima_appraise=fix ima_hash=sha512 lockdown=confidentiality
UKI ready
ISO ready
output asset path: /out/metal-amd64-secureboot.iso
Expand Down Expand Up @@ -236,7 +236,7 @@ output:
kind: installer
outFormat: raw
skipped initramfs rebuild (no system extensions)
kernel command line: talos.platform=metal console=ttyS0 console=tty0 init_on_alloc=1 slab_nomerge pti=on consoleblank=0 nvme_core.io_timeout=4294967295 printk.devkmsg=on ima_template=ima-ng ima_appraise=fix ima_hash=sha512 lockdown=confidentiality
kernel command line: talos.platform=metal console=tty0 init_on_alloc=1 slab_nomerge pti=on consoleblank=0 nvme_core.io_timeout=4294967295 printk.devkmsg=on ima_template=ima-ng ima_appraise=fix ima_hash=sha512 lockdown=confidentiality
UKI ready
installer container image ready
output asset path: /out/installer-amd64-secureboot.tar
Expand Down

0 comments on commit 19a44c2

Please sign in to comment.