-
Notifications
You must be signed in to change notification settings - Fork 1.8k
This script sets up console utilities on the bmc to access switch console #25674
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # sonic-udev-setup.sh | ||
| # Enables console mode and symlinks the platform udev rules file. | ||
| # Assumes 99-sonic-tty.rules and udevprefix.conf already exist in the platform directory. | ||
| # Must be run as root on a Debian-based system. | ||
| # | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| PLATFORM_NAME=$(sonic-cfggen -H -v DEVICE_METADATA.localhost.platform) | ||
| PLATFORM_DIR="/usr/share/sonic/device/${PLATFORM_NAME}" | ||
| RULES_SRC="${PLATFORM_DIR}/99-sonic-tty.rules" | ||
| RULES_DEST="/etc/udev/rules.d/99-sonic-tty.rules" | ||
|
|
||
| # --- Ensure we are running as root --- | ||
| if [[ "$(id -u)" -ne 0 ]]; then | ||
| echo "Error: this script must be run as root." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # --- Enable console --- | ||
| echo "Enabling console ..." | ||
| sudo config console enable | ||
|
|
||
| # --- Symlink udev rules --- | ||
| echo "Creating symlink ${RULES_DEST} -> ${RULES_SRC} ..." | ||
| ln -sf "${RULES_SRC}" "${RULES_DEST}" | ||
|
|
||
| # --- Reload udev rules --- | ||
| echo "Reloading udev rules ..." | ||
| udevadm control --reload-rules | ||
| udevadm trigger | ||
|
|
||
| echo "sonic udev setup complete." | ||
| echo " Rules symlinked: ${RULES_DEST} -> ${RULES_SRC}" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
There was a problem hiding this comment.
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?