diff options
| author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2025-07-31 19:18:51 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-31 19:18:51 +0300 |
| commit | 8c34aa09954f4b266478d48d8a0256e695f4e666 (patch) | |
| tree | 84c6314eb18a3a9fc3d6717f29b66df446c1c5c7 /src | |
| parent | ebd16523072e39848d32e88b13c9b8ff72e86aad (diff) | |
| parent | fba27cac855cf196a394ac4bb955f9f7402982cb (diff) | |
| download | vyos-1x-8c34aa09954f4b266478d48d8a0256e695f4e666.tar.gz vyos-1x-8c34aa09954f4b266478d48d8a0256e695f4e666.zip | |
Merge pull request #4638 from c-po/is-a-tty
serial: T7484: treat unavailable serial console devices as non-fatal
Diffstat (limited to 'src')
| -rwxr-xr-x | src/conf_mode/system_console.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/conf_mode/system_console.py b/src/conf_mode/system_console.py index 90648e2b8..fe910c1b0 100755 --- a/src/conf_mode/system_console.py +++ b/src/conf_mode/system_console.py @@ -17,9 +17,11 @@ import os from pathlib import Path +from vyos.base import Warning from vyos.config import Config from vyos.utils.process import call from vyos.utils.serial import restart_login_consoles +from vyos.utils.serial import is_tty from vyos.system import grub_util from vyos.template import render from vyos import ConfigError @@ -66,6 +68,8 @@ def verify(console): # and it can not be used as a serial interface if not os.path.isdir(by_bus_dir) or not os.path.exists(by_bus_device): raise ConfigError(f'Device {device} does not support beeing used as tty') + if not is_tty(device): + Warning(f'Device "{device}" used for console is not a TTY!') return None @@ -98,6 +102,9 @@ def generate(console): raise ConfigError(f'Device {device} does not support beeing used as tty') for device, device_config in console['device'].items(): + # Do not render getty configuration if specified device is not a TTY. + if not is_tty(device): + continue config_file = base_dir + f'/serial-getty@{device}.service' Path(f'{base_dir}/getty.target.wants').mkdir(exist_ok=True) getty_wants_symlink = base_dir + f'/getty.target.wants/serial-getty@{device}.service' @@ -119,8 +126,6 @@ def generate(console): def apply(console): # Reset screen blanking call('/usr/bin/setterm -blank 0 -powersave off -powerdown 0 -term linux </dev/tty1 >/dev/tty1 2>&1') - # Reload systemd manager configuration - call('systemctl daemon-reload') # Service control moved to vyos.utils.serial to unify checks and prompts. # If users are connected, we want to show an informational message on completing |
