mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-07-14 18:00:43 +00:00
fix(xcat-server): stop Ubuntu diskless images carrying the builder's identity
The Ubuntu netboot image inherited the build host's /etc/hostname --
genimage's chroot shares the build host's UTS namespace, so /etc/hostname
ended up as the MN's name and every diskless node booted as that name
instead of its own ("hostname poisoning"). xCAT keys on IP/MAC so
provisioning still succeeds, but the node's local identity (hostname,
prompt, syslog) is wrong and N nodes share one name. The image also
shipped no netplan, so systemd-networkd-wait-online failed. In
compute.postinstall, clear /etc/hostname so each node takes its name at
boot from DHCP (udhcpc option host-name) / xCAT, and drop in a DHCP
netplan (optional, dhcp-identifier mac) so systemd-networkd configures the
boot NIC. Ubuntu-only.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
@@ -51,3 +51,27 @@ chroot $installroot \
|
||||
update-locale
|
||||
DEBIAN_FRONTEND=noninteractive chroot $installroot \
|
||||
dpkg-reconfigure locales
|
||||
|
||||
#-- A shared diskless image must not carry the builder's identity. genimage's chroot shares
|
||||
#-- the build host's UTS namespace, so /etc/hostname ends up as the MN's name and every node
|
||||
#-- booting this image inherits it ("hostname poisoning"). Clear it so each node takes its name
|
||||
#-- at boot from DHCP (udhcpc option host-name) / xCAT instead of the build host.
|
||||
: > $installroot/etc/hostname
|
||||
|
||||
#-- Ship a DHCP netplan so systemd-networkd configures the boot NIC. Without any netplan in the
|
||||
#-- image, systemd-networkd-wait-online has nothing to bring up and the unit fails. optional:true
|
||||
#-- keeps it from blocking boot; dhcp-identifier:mac matches xCAT's MAC-based DHCP.
|
||||
mkdir -p $installroot/etc/netplan
|
||||
cat <<'NETPLAN' > $installroot/etc/netplan/90-xcat-dhcp.yaml
|
||||
network:
|
||||
version: 2
|
||||
renderer: networkd
|
||||
ethernets:
|
||||
xcat-cluster:
|
||||
match:
|
||||
name: "e*"
|
||||
dhcp4: true
|
||||
dhcp-identifier: mac
|
||||
optional: true
|
||||
NETPLAN
|
||||
chmod 600 $installroot/etc/netplan/90-xcat-dhcp.yaml
|
||||
|
||||
Reference in New Issue
Block a user