summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2025-07-30 21:40:11 +0100
committerChristian Breunig <christian@breunig.cc>2025-07-30 21:40:11 +0100
commitfba27cac855cf196a394ac4bb955f9f7402982cb (patch)
treec939b43b7157c3924d53604380e472bbdfad2d85 /src
parent2ac530f45d9d5f2ab7bafcc1de65284d8eef85bb (diff)
downloadvyos-1x-fba27cac855cf196a394ac4bb955f9f7402982cb.tar.gz
vyos-1x-fba27cac855cf196a394ac4bb955f9f7402982cb.zip
serial: T7484: treat unavailable serial console devices as non-fatal
Instead of failing or starting agetty on an invalid device, we now check whether the specified serial console device is a valid TTY. If it's not, we display a warning to the user and skip starting the agetty process.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/system_console.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/conf_mode/system_console.py b/src/conf_mode/system_console.py
index 2f742ee07..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'