summaryrefslogtreecommitdiff
path: root/src/conf_mode/system_console.py
diff options
context:
space:
mode:
authorNicolas Vandamme <n.vandamme@firis-system.lu>2025-09-01 17:24:26 +0200
committerGitHub <noreply@github.com>2025-09-01 17:24:26 +0200
commita791cc3b7bb28081a6e79a988964f1fc51a47dae (patch)
treeef5e734bf580f1abfd7d3d4ea30240d8d9fb1278 /src/conf_mode/system_console.py
parentb9f60711392463af1892a30472fba6622a73390a (diff)
parentb1b4545cb7984cd3cdf42554ab2b28acd1ecb6cb (diff)
downloadvyos-1x-a791cc3b7bb28081a6e79a988964f1fc51a47dae.tar.gz
vyos-1x-a791cc3b7bb28081a6e79a988964f1fc51a47dae.zip
Merge branch 'vyos:current' into current
Diffstat (limited to 'src/conf_mode/system_console.py')
-rwxr-xr-xsrc/conf_mode/system_console.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/conf_mode/system_console.py b/src/conf_mode/system_console.py
index b380e0521..fe910c1b0 100755
--- a/src/conf_mode/system_console.py
+++ b/src/conf_mode/system_console.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2020-2024 VyOS maintainers and contributors
+# Copyright VyOS maintainers and contributors <maintainers@vyos.io>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -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