From fd64b84bcc931c4ba432f33d275566abec1132f7 Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Tue, 6 Aug 2024 17:26:25 +0200 Subject: postinstall: linux does not allow more than 64 bytes long hostnames As per: $ getconf HOST_NAME_MAX 64 truncate it to the maximum. --- src/utils/postinstall.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utils/postinstall.py b/src/utils/postinstall.py index f52ca77..a043ae8 100644 --- a/src/utils/postinstall.py +++ b/src/utils/postinstall.py @@ -69,6 +69,10 @@ def set_windows_hostname(disk, partition, name): def set_linux_hostname(disk, partition, name): logging.info(f'Setting Linux hostname to {name}') + if len(name) > 64: + logging.warning(f'Linux does not permit hostnames that exceed 64 characters. Truncating {name}') + name = name[0:64] + device = get_partition_device(disk, partition) mountpoint = device.replace('dev', 'mnt') -- cgit v1.2.3-18-g5258