diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sle15.x86_64.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.sle15.x86_64.pkglist deleted file mode 100644 index 02d11dd47..000000000 --- a/xCAT-server/share/xcat/netboot/sles/compute.sle15.x86_64.pkglist +++ /dev/null @@ -1,50 +0,0 @@ -aaa_base -coreutils -bash -dbus-1 -wicked -device-mapper -dracut -nfs-kernel-server -keyutils -lvm2 -openssl -dhcp-client -openssh -procps -psmisc -wget -sysconfig -rsyslog -vim -rsync -timezone -bc -ntp -gzip -e2fsprogs -parted -binutils -tar -open-iscsi -curl -btrfsprogs -cryptsetup -dmraid -mdadm -multipath-tools -gpg2 -which -cifs-utils -open-lldp -fcoe-utils -util-linux-systemd -udev -kernel-default -kernel-firmware -adaptec-firmware -xz -SLE_HPC-release -insserv-compat -net-tools-deprecated -rsyslog diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sle15.x86_64.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.sle15.x86_64.pkglist new file mode 120000 index 000000000..0e114f64f --- /dev/null +++ b/xCAT-server/share/xcat/netboot/sles/compute.sle15.x86_64.pkglist @@ -0,0 +1 @@ +compute.sle15.pkglist \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/sles/dracut_033/xcat-prepivot.sh b/xCAT-server/share/xcat/netboot/sles/dracut_033/xcat-prepivot.sh index 9471787b7..f52312e38 100755 --- a/xCAT-server/share/xcat/netboot/sles/dracut_033/xcat-prepivot.sh +++ b/xCAT-server/share/xcat/netboot/sles/dracut_033/xcat-prepivot.sh @@ -153,11 +153,11 @@ function getdevfrommac() { done } -for lf in /tmp/dhclient.*.lease; do - netif=${lf#*.} - netif=${netif%.*} - cp $lf "$NEWROOT/var/lib/dhclient/dhclient-$netif.leases" -done +bootif=$(ls /tmp/net.*.conf|sed -e s/.*net\.// -e s/\.conf//) +cat < $NEWROOT/etc/sysconfig/network/ifcfg-$bootif +BOOTPROTO='dhcp' +STARTMODE='auto' +EOF if [ -f $NEWROOT/etc/hostname ]; then echo `hostname -s` > $NEWROOT/etc/hostname diff --git a/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot index a1f39ac71..4b6c9aeaf 100755 --- a/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot @@ -295,12 +295,12 @@ function getdevfrommac() { if [ -z $STATEMNT ]; then - for lf in /tmp/dhclient.*.lease; do - netif=${lf#*.} - netif=${netif%.*} - cp $lf "$NEWROOT/var/lib/dhclient/dhclient-$netif.leases" - [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p debug "saving $NEWROOT/var/lib/dhclient/dhclient-$netif.leases" - done + bootif=$(ls /tmp/net.*.conf|sed -e s/.*net\.// -e s/\.conf//) + cat < $NEWROOT/etc/sysconfig/network/ifcfg-$bootif +BOOTPROTO='dhcp' +STARTMODE='auto' +EOF + [ "$xcatdebugmode" > "0" ] && logger -t $log_label -p debug "saving $NEWROOT/etc/sysconfig/network/ifcfg-$bootif" if [ ! -z "$ifname" ]; then MACX=${ifname#*:} diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 5792b3c6c..049c1b681 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -72,6 +72,31 @@ sub xdie { die @_; } +sub umount { + # some rpms mounts the imageroot/proc on the /proc, need to release it, + # otherwise got kernal panic when installing + # sometimes, the proc fs is not mounted, so one warning/error message will display, + # and I add one check point here. + my $MFD; + open MFD, "/proc/mounts"; + my @lines = ; + close MFD; + + my $ret = grep m{$rootimg_dir/proc}, @lines; + if ($ret > 0) { + system("umount -l $rootimg_dir/proc"); + } + $ret = grep m{$rootimg_dir/sys}, @lines; + if ($ret > 0) { + system("umount -l $rootimg_dir/sys"); + } +} + +# Make sure we clean up all mounts everytime +END { + umount(); +} + #-- fetch current version form CVS (overwrite locally changed versions) # if (opendir(CVS,"$pathtofiles/CVS")){ # close CVS; @@ -203,7 +228,7 @@ unless (grep /af_packet/, @ndrivers) { } my $osver_host; -if (`grep VERSION /etc/os-release` =~ /VERSION = (\d+)/) { +if (`grep VERSION /etc/os-release` =~ /VERSION="(\d+)/) { $osver_host = $1; } else { $osver_host = 11; @@ -225,26 +250,32 @@ unless ($onlyinitrd) { mkpath "$rootimg_dir/etc"; mkpath "$rootimg_dir/dev"; + mkpath "$rootimg_dir/proc"; + mkpath "$rootimg_dir/sys"; + + #needed for newer versions of the SLE permissions RPM. See: https://github.com/openSUSE/permissions/commit/2d0ef5d55b30f72322d18951214353ecfd9c4245 + system "mount -t proc proc $rootimg_dir/proc"; + #Create /sys to have /sys/kernel/fscaps. Fixes: "Warning: running kernel does not support fscaps" + system "mount -o bind /sys $rootimg_dir/sys"; #system "mount -o bind /dev $rootimg_dir/dev"; unless (-e "$rootimg_dir/dev/zero") { - system "mknod $rootimg_dir/dev/zero c 1 5"; + system "mknod -m 0666 $rootimg_dir/dev/zero c 1 5"; } unless (-e "$rootimg_dir/dev/null") { - system "mknod $rootimg_dir/dev/null c 1 3"; #that's neccessary for SLES11 + system "mknod -m 0666 $rootimg_dir/dev/null c 1 3"; #that's neccessary for SLES11+ } - unless (-e "$rootimg_dir/dev/random") { - system "mknod $rootimg_dir/dev/random c 1 8"; #that's neccessary for SLES11 + system "mknod -m 0666 $rootimg_dir/dev/random c 1 8"; #that's neccessary for SLES11+ } unless (-e "$rootimg_dir/dev/urandom") { - system "mknod $rootimg_dir/dev/urandom c 1 9"; #that's neccessary for SLES11 + system "mknod -m 0666 $rootimg_dir/dev/urandom c 1 9"; #that's neccessary for SLES11+ } for (my $i = 0 ; $i <= 12 ; $i++) { unless (-e "$rootimg_dir/dev/tty$i") { - system "mknod $rootimg_dir/dev/tty$i c 4 $i"; #that's neccessary for SLES11 + system "mknod $rootimg_dir/dev/tty$i c 4 $i"; #that's neccessary for SLES11+ } } @@ -397,10 +428,12 @@ unless ($onlyinitrd) { #my $yumcmd = "yum -y -c /tmp/genimage.$$.yum.conf --installroot=$rootimg_dir --disablerepo=* "; #$yumcmd .= "install "; #mkpath("$rootimg_dir/var/lib/yum"); - mkpath("$rootimg_dir/etc/"); - my $passwdfile; - open($passwdfile, ">", "$rootimg_dir/etc/passwd"); - print $passwdfile "root:x:0:0:root:/root:/bin/bash\n"; + if (! -f "$rootimg_dir/etc/passwd") { + mkpath("$rootimg_dir/etc/"); + my $passwdfile; + open($passwdfile, ">", "$rootimg_dir/etc/passwd"); + print $passwdfile "root:x:0:0:root:/root:/bin/bash\n"; + } my $yumcmd; if ($osver_host < 11) { $yumcmd = "zypper -R $rootimg_dir $non_interactive install "; @@ -872,19 +905,8 @@ system("cd $rootimg_dir/usr/bin/; ln -s ../../bin/keyctl $rootimg_dir/usr/bin/ke # which is different from the Redhat family -# some rpms mounts the imageroot/proc on the /proc, need to release it, -# otherwise got kernal panic when installing -# sometimes, the proc fs is not mounted, so one warning/error message will display, -# and I add one check point here. -my $MFD; -open MFD, "/proc/mounts"; -my @lines = ; -close MFD; - -my $ret = grep m{$rootimg_dir/proc}, @lines; -if ($ret > 0) { - system("umount -l $rootimg_dir/proc"); -} +# umount /proc and /sys from rootimg +umount(); # Load driver update disk, and copy them to the root image my @dd_drivers = &load_dd(); @@ -1953,7 +1975,7 @@ sub generic_post { # This function is meant to leave the image in a state approx } unlink("$rootimg_dir/dev/null"); - system("mknod $rootimg_dir/dev/null c 1 3"); + system("mknod -m 0666 $rootimg_dir/dev/null c 1 3"); open($cfgfile, ">", "$rootimg_dir/etc/fstab"); print $cfgfile "devpts /dev/pts devpts gid=5,mode=620 0 0\n"; print $cfgfile "tmpfs /dev/shm tmpfs defaults 0 0\n"; @@ -1976,9 +1998,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