VirtualBox

Opened 4 years ago

Last modified 4 years ago

#19801 new defect

add redhat8_ks.cfg kickstart config to unattended templates

Reported by: Frank Batschulat (Oracle) Owned by:
Component: installer Version: VirtualBox 6.1.10
Keywords: rhel 8 Cc:
Guest type: Linux Host type: all

Description

From: "Timothy Tacker" <> To: vbox-dev@… Subject: [vbox-dev] [PATCH] add redhat8_ks.cfg kickstart Date: Tue, 21 Jul 2020 14:49:04 +0200

Due to changes in RHEL 8, the redhat67_ks.cfg Kickstart script included in the UnattendedTemplates directory does not work with CentOS 8. The patch below adds a Kickstart script for RHEL 8 and CentOS 8, and makes other changes to integrate the new script into VirtualBox. Following the pattern for redhat67_ks.cfg, the new script is named redhat8_ks.cfg. All comments in the new script are worded to mirror language and terms used in the RHEL 8 documentation; and all sections, commands, and options appear in the same order in both the new script and the documentation.

The install command has been deprecated in RHEL 8. In regard to the install command, the documentation states, "Use its methods as separate commands." The cdrom command was retained and now serves to specify that installation should occur from the first optical drive. The install command was removed from the new script.

The auth command has been deprecated in RHEL 8. Passwords are shadowed by default with sha512. The following auth command was removed from the new script: auth --useshadow --passalgo=sha512

The default SELinux policy is enforcing. The following selinux command was removed from the new script: selinux --enforcing

The documentation states, "Either the --vckeymap= or the --xlayouts= option must be used" for the required keyboard command, suggesting an OR rather than an AND. Nonetheless, both --vckeymap=us and --xlayouts='us' are used in the new script. Many examples of this usage can be found, and it does not appear to cause issues. The value "us" was specified to maintain consistency with the value that was specified in the redhat67_ks.cfg script.

In order to comply with the order demonstrated in the syntax shown in the documentation, the timezone command was changed as follows: timezone@@VBOX_COND_IS_RTC_USING_UTC@@ --utc@@VBOX_COND_END@@ @@VBOX_INSERT_TIME_ZONE_UX@@ timezone @@VBOX_INSERT_TIME_ZONE_UX@@@@VBOX_COND_IS_RTC_USING_UTC@@ --utc@ @VBOX_COND_END@@

For the --plaintext option to the user command, the documentation states, "If this option is present, the password argument is assumed to be in plain text"; but it does not explicitly indicate plaintext is the default. The --plaintext option was added to the user command as follows: user --name=@@VBOX_INSERT_USER_LOGIN_SH@@ --password=@@VBOX_INSERT_USER_PASSWORD_SH@@ user --name=@@VBOX_INSERT_USER_LOGIN_SH@@ --password=@@VBOX_INSERT_USER_PASSWORD_SH@@ --plaintext

For the network command, DHCP is the bootproto method used by default. In addition, due to a change in how network devices are named in RHEL 8, eth0 is not a valid device name by default; but the link keyword can be used to specify the first interface with its link in the up state. The network command was changed as follows: network --bootproto=dhcp --device=eth0 --onboot=on --hostname=@@VBOX_INSERT_HOSTNAME_FQDN_SH@@ network --device=link --onboot=on --hostname=@@VBOX_INSERT_HOSTNAME_FQDN_SH@ @

For the bootloader command, mbr is the default value for the location option. The bootloader command was changed as follows: bootloader --location=mbr --append="nomodeset crashkernel=auto rhgb quiet" bootloader --append="nomodeset crashkernel=auto rhgb quiet"

The autopart command automatically creates partitions in accordance with Red Hat recommendations. The value plain for the type option specifies "Regular partitions with no LVM." The following two part commands were changed to the single autopart command on the third line immediately below: part / --fstype ext4 --size 6000 --grow --asprimary part swap --size 1024 autopart --type=plain

Without the elfutils-libelf-devel package installed, post install scripting failed to compile kernel modules for VirtualBox Guest Additions, resulting in their failure to install. The elfutils-libelf-devel package was added to the %packages section in order to resolve this issue.

Only the new Kickstart script has been tested, and it has only been tested with CentOS 8. OS and Guest Additions both install. Full testing with RHEL 8 should be completed prior to integration.

I'm licensing this patch under the MIT license. Please review. Feedback is welcome. Thanks!

Timothy Tacker

---
  src/VBox/Installer/Config.kmk                 |   1 +
  .../Main/UnattendedTemplates/Makefile.kmk     |   1 +
  .../Main/UnattendedTemplates/redhat8_ks.cfg   | 116 ++++++++++++++++++
  src/VBox/Main/include/UnattendedInstaller.h   |  11 ++
  4 files changed, 129 insertions(+)
  create mode 100644 src/VBox/Main/UnattendedTemplates/redhat8_ks.cfg

diff --git a/src/VBox/Installer/Config.kmk b/src/VBox/Installer/Config.kmk
index 077d6af6..0cbcfe8d 100644
--- a/src/VBox/Installer/Config.kmk
+++ b/src/VBox/Installer/Config.kmk
@@ -66,6 +66,7 @@ ifdef VBOX_WITH_UNATTENDED
   rhel4_ks.cfg \
   rhel5_ks.cfg \
   redhat67_ks.cfg \
+ redhat8_ks.cfg \
   win_nt5_unattended.sif \
   win_nt6_unattended.xml \
         \
diff --git a/src/VBox/Main/UnattendedTemplates/Makefile.kmk
b/src/VBox/Main/UnattendedTemplates/Makefile.kmk
index c8baeaf5..cd15ffb4 100644
--- a/src/VBox/Main/UnattendedTemplates/Makefile.kmk
+++ b/src/VBox/Main/UnattendedTemplates/Makefile.kmk
@@ -32,6 +32,7 @@ ifdef VBOX_WITH_UNATTENDED
   rhel4_ks.cfg \
   rhel5_ks.cfg \
   redhat67_ks.cfg \
+ redhat8_ks.cfg \
   ol_ks.cfg \
   fedora_ks.cfg \
   suse_autoinstall.xml \
diff --git a/src/VBox/Main/UnattendedTemplates/redhat8_ks.cfg
b/src/VBox/Main/UnattendedTemplates/redhat8_ks.cfg
new file mode 100644
index 00000000..d37f8baa
--- /dev/null
+++ b/src/VBox/Main/UnattendedTemplates/redhat8_ks.cfg
@@ -0,0 +1,116 @@
+#platform=x86, AMD64, or Intel EM64T
+#version=DEVEL
+
+
+## Installation program configuration and flow control commands:
+
+# Install from first optical drive.
+cdrom
+
+# Specify info as minimum log level on tty3 in Anaconda during
installation.
+logging --level=info
+
+# Attempt to eject bootable media and reboot after installation.
+reboot --eject
+
+# Perform installation in text mode.
+text
+
+
+## System configuration commands:
+
+# Do not configure iptables rules.
+firewall --disabled
+
+# Set available keyboard layouts for system.
+keyboard --vckeymap=us --xlayouts='us'
+
+# Set language to use during installation and default to use on installed
system.
+lang @@VBOX_INSERT_LOCALE@@
+
+# Set system root password using supplied plaintext.
+rootpw --plaintext @@VBOX_INSERT_ROOT_PASSWORD_SH@@
+
+# Set system time zone and indicate if hardware clock is UTC (Greenwich
Mean) time.
+timezone @@VBOX_INSERT_TIME_ZONE_UX@@@@VBOX_COND_IS_RTC_USING_UTC@@ --utc@
@VBOX_COND_END@@
+
+# Create new user on system and set password using supplied plaintext.
+user --name=@@VBOX_INSERT_USER_LOGIN_SH@@
--password=@@VBOX_INSERT_USER_PASSWORD_SH@@ --plaintext
+
+
+## Network configuration commands:
+
+# Configure network device and activate in Anaconda installation
environment.
+#  Device specified in first network command activated automatically.
+#  DHCP method used by default.
+#  Device: Link keyword specifies first interface with link in up state.
+#  Onboot: Enable device at boot time.
+#  Hostname: Specify host name for installed system.
+network --device=link --onboot=on
--hostname=@@VBOX_INSERT_HOSTNAME_FQDN_SH@@
+
+
+## Storage handling commands:
+
+# Specifify how boot loader installed.
+#  Location boot record written dependent on drive usage of MBR or GPT
scheme.
+#  Append: Specifies additional kernel parameters.
+bootloader --append="nomodeset crashkernel=auto rhgb quiet"
+
+# Remove partitions from system prior to creation of new partitions.
+#  All: Erase all partitions on disks reachable by installation program,
including attached network storage.
+#  Initlabel: Initialize disk(s) by creating default labels in respective
architectures designated for formatting.
+clearpart --all --initlabel
+
+# Automatically create partitions.
+#  Type: Plain keyword specifies regular partitioning scheme with no LVM.
+#  Default file system is xfs.
+autopart --type=plain
+
+# Initialize invalid partition tables and destroy contents of disks with
invalid partition tables.
+zerombr
+
+
+# Packages.  We currently ignore missing packages/groups here to keep
things simpler.
+%packages --ignoremissing
+@base
+@core
+@@VBOX_COND_IS_NOT_MINIMAL_INSTALLATION@@
+@development
+@basic-desktop
+@desktop-debugging
+@desktop-platform
+@fonts
+@general-desktop
+@graphical-admin-tools
+@remote-desktop-clients
+@x11
+@@VBOX_COND_END@@
+
+# Prepare building the additions kernel module, try get what we can from
the cdrom as it may be impossible
+# to install anything from the post script:
+kernel-headers
+kernel-devel
+glibc-devel
+glibc-headers
+gcc
+dkms
+make
+bzip2
+perl
+elfutils-libelf-devel
+
+%end
+
+
+# Post install happens in a different script.
+# Note! We mount the CDROM explictily here since the location differs
between fedora 26 to rhel5
+#       and apparently there isn't any way to be certain that anaconda
didn't unmount it already.
+%post --nochroot --log=/mnt/sysimage/root/ks-post.log
+df -h
+mkdir -p /tmp/vboxcdrom
+mount /dev/cdrom /tmp/vboxcdrom
+cp /tmp/vboxcdrom/vboxpostinstall.sh /mnt/sysimage/root/vboxpostinstall.sh
+chmod a+x /mnt/sysimage/root/vboxpostinstall.sh
+/bin/bash /mnt/sysimage/root/vboxpostinstall.sh --rhel
+umount /tmp/vboxcdrom
+%end
diff --git a/src/VBox/Main/include/UnattendedInstaller.h
b/src/VBox/Main/include/UnattendedInstaller.h
index 5003613d..09988815 100644
--- a/src/VBox/Main/include/UnattendedInstaller.h
+++ b/src/VBox/Main/include/UnattendedInstaller.h
@@ -518,6 +518,17 @@ protected:
  };


+/**
+ * RHEL 8 installer (same as RHEL 6 & 7, except for the kickstart
template).
+ */
+class UnattendedRhel5Installer : public UnattendedRhel6And7Installer
+{
+public:
+    UnattendedRhel5Installer(Unattended *pParent) :
UnattendedRhel6And7Installer(pParent, "redhat8_ks.cfg") {}
+    ~UnattendedRhel5Installer() {}
+};
+
+
  /**
   * RHEL 5 installer (same as RHEL 6 & 7, except for the kickstart
template).
   */
--

https://www.virtualbox.org/pipermail/vbox-dev/2020-July/015524.html

Change History (4)

comment:1 by Frank Batschulat (Oracle), 4 years ago

This should probably also used and tested for the Oracle Linux 8 distribution.

comment:2 by Frank Batschulat (Oracle), 4 years ago

Heads up on this one: Just noticed the dkms (Dynamic Kernel Module Support) package is failing to install, both in the %packages section of the Kickstart script and in the postinstall script. I haven't yet had time to verify, but I believe this is because the dkms package is in the EPEL (Extra Packages for Enterprise Linux) repository; and that repo isn't enabled when these scripts run. I don't think the packages for this repo will be included in ISO distributions, so that leaves the question if we want to introduce a requirement that a network connection be available during installation, do something like include the dkms package with VirtualBox, or find an alternative to using the dkms package. Is the dkms package really required? VirtualBox Guest Additions appears to be working without it, but I'm really only basing that on the fact that they seem to successfully manage the host share following installation. Also, I haven't verified this either; but I suspect this isn't a new issue, as it looks like the dkms package was in the EPEL repo for RHEL 7 (and maybe before that too.) Timothy Tacker

comment:3 by Frank Batschulat (Oracle), 4 years ago

for Oracle Linux we use a different template then for RHEL based ones, not sure if that has been tested with OL8 though:
trunk/src/VBox/Main/UnattendedTemplates/ol_ks.cfg
We don't have anything specific for CentOS or Fedora.

Last edited 4 years ago by Frank Batschulat (Oracle) (previous) (diff)

comment:4 by Frank Batschulat (Oracle), 4 years ago

So neither Oracle Linux 6,7,8 nor CentOS 6,7,8 do provide a 'dkms' package at all. Only Fedora does so like RHEL, for Fedora it is in the "updates" repository for 30,31,32. Need to check RHEL as well.

Note: See TracTickets for help on using tickets.

© 2023 Oracle
ContactPrivacy policyTerms of Use