Skip to content

This script sets up console utilities on the bmc to access switch console#25674

Draft
apoorv-arista wants to merge 1 commit intosonic-net:masterfrom
apoorv-arista:sonic-console-for-bmc
Draft

This script sets up console utilities on the bmc to access switch console#25674
apoorv-arista wants to merge 1 commit intosonic-net:masterfrom
apoorv-arista:sonic-console-for-bmc

Conversation

@apoorv-arista
Copy link

@apoorv-arista apoorv-arista commented Feb 25, 2026

This script assumes the presense of the following files in the following formats available at the platfomr directory for any particular vendor.

Platform directory location for configuration file

PLATFORM_NAME=$(sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)
PLATFORM_DIR="/usr/share/sonic/device/${PLATFORM_NAME}"

Udev rules to alias out the console devices to a uniform alias

# Mapping console ports to ttysonic aliases
# "console" --> vendor specific console device name under /dev/ for the host cpu console
KERNEL=="console", SUBSYSTEM=="tty", ATTR{line}=="0", SYMLINK+="ttysonic0", MODE="0666"

Contents of Udevprefixconf for consutil cli

/ttysonic

This helps the consutil cli in enumerating the console device

These two files could be put in the platform directory for each vendor with the following file names :-

  1. 99-sonic-tty.rules
  2. udevprefix.conf

And the script in the PR would be packaged as a systemd platform-independent service, which would initialise the console upon the device boot.

@mssonicbld
Copy link
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

udevadm trigger

echo "sonic udev setup complete."
echo " Rules symlinked: ${RULES_DEST} -> ${RULES_SRC}"
Copy link
Contributor

Choose a reason for hiding this comment

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

How does this support this requirement that BMC should be able to log the console of the switch CPU all the time and export those logs ?
That is there has to be "read only" access (logging everything including the commands entered) and a "read/write" (normal console access)

Copy link
Contributor

Choose a reason for hiding this comment

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

The console logging can be implemented in elsewhere with socat proxy

Here we need a virtual tty device with 0666 permission opened so user can connect to a line without root permission.

Copy link
Contributor

Choose a reason for hiding this comment

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

Commit 40f4febf70f3217b844712c7fcea81377fc49fe6 has brought in the proposed mechanism here to #24898

Just an heads up.


# --- Enable console ---
echo "Enabling console ..."
sudo config console enable
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need touch the config here? Or this suppose to be a kind of default config in BMC system? Do we need persist this config?

@yxieca
Copy link
Contributor

yxieca commented Mar 5, 2026

Please create commit with -s option so the commit is signed.

To fix the existing DCO issue, you can do git commit --amend -s on your work branch with this commit on top, and force push to your fork afterwards.

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 this pull request may close these issues.

5 participants