From b26e6bcb7bb3111ff3648545ccc8002071ec077d Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Mon, 20 Jan 2020 00:48:21 +0100 Subject: [PATCH] SLE15: Fix /etc/resolv.conf overwrite In SLE15 /etc/resolv.conf is a symlink to /run/netconfig/resolv.conf. The package sysconfig-netconfig creates the symlink to /run/netconfig/resolv.conf on the host OS. It does not stay in the chroot environment. Therefore, genimage overwrites /etc/resolv.conf of the host. Let's not create a dummy file if /etc/resolv.conf is a symlink. --- xCAT-server/share/xcat/netboot/sles/genimage | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 303cd0a0a..f345dbd42 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -1999,9 +1999,12 @@ sub generic_post { # This function is meant to leave the image in a state approx print $cfgfile "NETWORKING=yes\n"; close($cfgfile); - open($cfgfile, ">", "$rootimg_dir/etc/resolv.conf"); - print $cfgfile "#Dummy resolv.conf to make boot cleaner"; - close($cfgfile); + # SLE15 has a symlink to /run/netconfig/resolv.conf and does not need a dummy file + if (! -l "$rootimg_dir/etc/resolv.conf") { + open($cfgfile, ">", "$rootimg_dir/etc/resolv.conf"); + print $cfgfile "#Dummy resolv.conf to make boot cleaner"; + close($cfgfile); + } # Create the ifcfg-x file for diskless node. But keep the ONBOOT=no # to skip the break of nfs-based boot