Skip to content

serial: T8375: use boot activation script to define a serial console on the CLI#5092

Open
c-po wants to merge 5 commits intovyos:currentfrom
c-po:kernel-serial-activation
Open

serial: T8375: use boot activation script to define a serial console on the CLI#5092
c-po wants to merge 5 commits intovyos:currentfrom
c-po:kernel-serial-activation

Conversation

@c-po
Copy link
Copy Markdown
Member

@c-po c-po commented Mar 26, 2026

Change summary

Required during first-boot of a system. We have images form amd64 and arm64 CPUs which also tend to have different serial interfaces (ttyS vs. ttyAMA).

The images which are installed have the correct serial setting for GRUB (ttyS0 or ttyAMA0) and the activation script will probe the Kernel command-line. If a serial interface is defined, we will include it in the VyOS CLI configuration.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Related PR(s)

How to test / Smoketest result

TBD

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 26, 2026

👍
No issues in PR Title / Commit Title

Copy link
Copy Markdown
Contributor

@zdc zdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, it looks logical. Let's try to polish it, I think.

  1. I think, if we use only one way to note the console, it will be less messy in the code: console_type + console_num or console_device.

  2. There is a mix-up between str and None arguments in functions and their calls, which should work fine generally. But it may also end up with unexpected surprises in the long term, when someone will update calls. I would prefer to unify all calls to a single type. Also, we may consider using just the explicit defaults argument: str = '' more for "cleanup" operations to keep the mistake risk surface purely inside functions.

@c-po c-po force-pushed the kernel-serial-activation branch 2 times, most recently from ed11d93 to 31f0e14 Compare March 31, 2026 13:02
@c-po c-po requested a review from zdc March 31, 2026 13:05
@c-po c-po marked this pull request as ready for review March 31, 2026 13:07
@c-po c-po marked this pull request as draft March 31, 2026 13:13
@c-po c-po force-pushed the kernel-serial-activation branch 2 times, most recently from d1d817b to bd95a69 Compare March 31, 2026 14:59
@c-po c-po marked this pull request as ready for review March 31, 2026 15:08
@c-po
Copy link
Copy Markdown
Member Author

c-po commented Mar 31, 2026

Smoketests are failing due to unmerged vyos/vyos-build#1152

@c-po c-po marked this pull request as draft March 31, 2026 15:15
@c-po c-po marked this pull request as ready for review April 2, 2026 20:49
@c-po c-po force-pushed the kernel-serial-activation branch from bd95a69 to 28c3206 Compare April 2, 2026 21:23
Copy link
Copy Markdown
Member

@sever-sever sever-sever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add console parameters based on architecture
At least we see the login/password for the git ARM runner

DEBUG - Welcome to VyOS - vyos ttyAMA0
DEBUG - 
DEBUG - vyos login: vyos
DEBUG - vyos
DEBUG - Password: vyos
DEBUG - 
DEBUG - Welcome to VyOS!
DEBUG - 
DEBUG -    ┌── ┐
DEBUG -    . VyOS 999.202604030943
DEBUG -    └ ──┘  current
DEBUG - 
DEBUG -  * Documentation:  https://docs.vyos.io/en/latest
DEBUG -  * Project news:   https://blog.vyos.io/
DEBUG -  * Bug reports:    https://vyos.dev/
DEBUG - 
DEBUG - You can change this banner using "set system login banner post-login" command.
DEBUG - 
DEBUG - VyOS is a free software distribution that includes multiple components,
DEBUG - you can check individual component licenses under /usr/share/doc/*/copyright
DEBUG - 
DEBUG - ---
DEBUG - WARNING: This VyOS system is not a stable long-term support version and
DEBUG -          is not intended for production use.
DEBUG - 
 INFO - Logged in!
DEBUG - vyos@vyos:~$ if sudo grep -rq "BEGIN PRIVATE KEY" /var/lib/shim-signed/mok; then echo Found private key - bailing out; exit 1; fi
DEBUG - if sudo grep -rq "BEGIN PRIVATE KEY" /var/lib/shim-signed/mok; then 
 echo Found private key - bailing out; exit 1; fi
 INFO - Starting installer
DEBUG - vyos@vyos:~$ install image
DEBUG - install image
DEBUG - Welcome to VyOS installation!
DEBUG - This command will install VyOS to your permanent storage.
DEBUG - Would you like to continue?y
DEBUG -  [y/N] y
DEBUG - What would you like to name this image? (Default: 999.202604030943)
DEBUG - 
DEBUG - Please enter a password for the "vyos" user: vyos
DEBUG - 
DEBUG - 
DEBUG - WARNING: Default password used. Consider changing it on next login.
DEBUG - 
DEBUG - Please confirm password for the "vyos" user: vyos
DEBUG - 
DEBUG - What console should be used by default? (K: KVM, S: Serial)? (DefauS
DEBUG - lt: A) S
DEBUG - Invalid value, try again.
ERROR - Timeout waiting for VyOS system
ERROR - Traceback (most recent call last):
  File "/__w/vyos-build-arm64/vyos-build-arm64/vyos-build/scripts/check-qemu-install", line 692, in <module>
    c.expect('\nWhich one should be used for installation?.*')
  File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 343, in expect
    return self.expect_list(compiled_pattern_list,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 372, in expect_list
    return exp.expect_loop(timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 181, in expect_loop
    return self.timeout(e)
           ^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pexpect/expect.py", line 144, in timeout
    raise exc
pexpect.exceptions.TIMEOUT: Timeout exceeded.

@github-actions github-actions bot added the rebase label Apr 3, 2026
@c-po c-po force-pushed the kernel-serial-activation branch from 3f722d2 to 8886c2e Compare April 3, 2026 15:32
c-po added 2 commits April 3, 2026 17:40
For the sake of nice grep lines and refactoring we have an unspoken - unwritten
rule considered as folklore to have imports one per line. This helped in the
past with refactorings.
c-po added 2 commits April 3, 2026 17:40
Clearly indicate during startup what happens. When we see "system" on the CLI,
infact we ran the activation scripts, thus the rename.
…on the CLI

Required during first-boot of a system. We have images form amd64 and arm64
CPUs which also tend to have different serial interfaces (ttyS vs. ttyAMA).

The images which are installed have the correct serial setting for GRUB (ttyS0
or ttyAMA0) and the activation script will probe the Kernel command-line. If a
serial interface is defined, we will include it in the VyOS CLI configuration.
@c-po c-po force-pushed the kernel-serial-activation branch from 8886c2e to 36ef074 Compare April 3, 2026 15:40
@c-po c-po removed the rebase label Apr 3, 2026
@c-po c-po force-pushed the kernel-serial-activation branch from 36ef074 to b8497c3 Compare April 3, 2026 18:04
Copy link
Copy Markdown
Contributor

@jestabro jestabro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see one issue here: the setting added to the config file during live boot (say, ttyS0) remains after the first boot into the installed image. Consequently, if a user chooses K(VM) during image install, that is correctly written to the grub vars for the reboot into the installed image; however, during that reboot, the system_console config script will re-write the config entry to the grub vars. A subsequent reboot will replace the choice of tty with ttyS.

@c-po c-po marked this pull request as draft April 4, 2026 17:11
@c-po c-po force-pushed the kernel-serial-activation branch from b8497c3 to e3624b1 Compare April 4, 2026 21:36
Previously, VyOS hardcoded the kernel boot log console to either ttyS0 or
tty0, with no post-install CLI method to change it (manual GRUB edits
were required).

This commit adds a new CLI node:
  system console device <name> kernel

When set, the selected serial console is used as the kernel boot console.
When removed, the kernel boot console falls back to tty0.
@c-po c-po force-pushed the kernel-serial-activation branch from e3624b1 to 335c6b3 Compare April 5, 2026 13:23
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

CI integration ❌ failed!

Details

CI logs

  • CLI Smoketests ❌ failed
  • CLI Smoketests (interfaces only) 👍 passed
  • Config tests ❌ failed
  • RAID1 tests 👍 passed
  • CLI Smoketests VPP 👍 passed
  • Config tests VPP 👍 passed
  • TPM tests ❌ failed

@c-po c-po requested a review from jestabro April 5, 2026 18:38
@c-po c-po marked this pull request as ready for review April 5, 2026 18:54
@c-po
Copy link
Copy Markdown
Member Author

c-po commented Apr 6, 2026

I see one issue here: the setting added to the config file during live boot (say, ttyS0) remains after the first boot into the installed image. Consequently, if a user chooses K(VM) during image install, that is correctly written to the grub vars for the reboot into the installed image; however, during that reboot, the system_console config script will re-write the config entry to the grub vars. A subsequent reboot will replace the choice of tty with ttyS.

The issue has been corrected. Thanks for testing this interesting combination.

Copy link
Copy Markdown
Contributor

@jestabro jestabro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue (mentioned above) with overwriting grub vars after installation has been resolved. The necessary tools to define a serial console on live-boot are in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

4 participants