From e65a4e960b0babfd88b288f0337d32d160bd3843 Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Tue, 3 Nov 2026 17:41:31 +0100 Subject: [PATCH] Leave the source hostname out of captured images The image kept /etc/hostname of the source host, so a diskless node ran under that name until onboot set its own, and early journal and syslog entries carried the wrong name. With an empty /etc/hostname systemd keeps the node name the deployment initramfs already set. Install to disk writes /etc/hostname itself. --- imgutil/imgutil | 2 ++ 1 file changed, 2 insertions(+) diff --git a/imgutil/imgutil b/imgutil/imgutil index d117e42e..42a425bb 100644 --- a/imgutil/imgutil +++ b/imgutil/imgutil @@ -240,6 +240,8 @@ def capture_fs(args): masker.mask('/etc/pki/tls/private/*') masker.mask('/root/.ssh/id_*') masker.mask('/etc/netplan/*.yaml') + # an empty hostname keeps the node name the deployment initramfs set + masker.mask('/etc/hostname', '/run/imgutil/captmp/empty') mksquashargs = ['mksquashfs', '/run/imgutil/capin', fname + '.sfs', '-comp', 'xz'] excludes = get_capture_excludes(mdir) exfile = None