The announcement from Red Hat last December that it would be “shifting focus from CentOS” caused quite a stir amongst the open source community, particularly those using CentOS widely. One outcome of this was the announcement of a new distribution, namely Rocky Linux.
The interest in Rocky Linux appeared to ramp up enormously from that point with a GA version releasing in June 2021.
We have many customers running applications which run on a variety of Linux platforms, Ubuntu, RHEL, CentOS, etc. that depend on PowerFlex storage. Since Rocky Linux is a distribution built directly from RHEL source code, then surely I should be able to access a PowerFlex environment in exactly the same way as I would from RHEL or CentOS…
After installing a fresh copy of Rocky Linux 8.4 and updating it with dnf, I attempted the installation of the PowerFlex SDC
rpm -ivh PowerFlex_3.6.0.1_102_RHEL_OEL8/EMC-ScaleIO-sdc-3.6-100.102.el8.x86_64.rpm warning: PowerFlex_3.6.0.1_102_RHEL_OEL8/EMC-ScaleIO-sdc-3.6-100.102.el8.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 1c853b80: NOKEY Verifying... ################################# [100%] Preparing... ################################# [100%] Attempting to install on incorrect distribution! Expected: REDHAT Actual: UNKNOWN error: %prein(EMC-ScaleIO-sdc-3.6-100.102.el8.x86_64) scriptlet failed, exit status 1 error: EMC-ScaleIO-sdc-3.6-100.102.el8.x86_64: install failed
Well that was very disappointing!!
Clearly something in the installation process is looking to see which platform the installation is being attempted on.
A utility I have used previously to investigate issues similar to this is rpmrebuild. Normally this is available in the EPEL repository but for some reason I could not find it after installing EPEL on Rocky Linux. I was not going to let this beat me so went for the manual process
dnf install -y wget wget http://rpmfind.net/linux/sourceforge/r/rp/rpmrebuild/rpmrebuild/2.16/rpmrebuild-2.16-1.noarch.rpm rpm -ivh rpmrebuild-2.16-1.noarch.rpm
The rpmrebuild utility is great as it allows you to open up the RPM package into a temporary working area, edit the spec files for the package and any other installation scripts.
Running the following command
rpmrebuild -enp PowerFlex_3.6.0.1_102_RHEL_OEL8/EMC-ScaleIO-sdc-3.6-100.102.el8.x86_64.rpm
Opens up the spec file in an editor session, typically vi/vim. A search through the file shows that for a RHEL based distribution, the installation is looking for Red Hat, CentOS or Oracle as the operating system name in /etc/os-release.
############################################################################### OS_RELEASE_FILE=/etc/os-release RH_RELEASE_FILE=/etc/redhat-release ############################################################################### get_distro_name() { local os_name= local dist_name= local ret_val=0 os_name=$(_get_field_from_os_release NAME) if [ $? -ne 0 ] && [ -f $RH_RELEASE_FILE ]; then os_name=$(cat $RH_RELEASE_FILE) fi case $os_name in *"Red Hat"*|*CentOS*|*Oracle*) #Redhat and "derivatives" dist_name=REDHAT ;; *Ubuntu*) dist_name=UBUNTU ;; *Debian*) dist_name=DEBIAN ;; *SLES*) dist_name=SUSE ;; *CoreOS*) dist_name=COREOS ;; *XenServer*|*Citrix*) dist_name=XEN ;; *) dist_name=UNKNOWN ret_val=1 ;; esac echo $dist_name return $ret_val }
When looking at the /etc/os-release file on the Rocky Linux system, it is clear to see the name is set to Rocky Linux
NAME="Rocky Linux" VERSION="8.4 (Green Obsidian)" ID="rocky" ID_LIKE="rhel centos fedora" VERSION_ID="8.4" PLATFORM_ID="platform:el8" PRETTY_NAME="Rocky Linux 8.4 (Green Obsidian)" ANSI_COLOR="0;32" CPE_NAME="cpe:/o:rocky:rocky:8.4:GA" HOME_URL="https://rockylinux.org/" BUG_REPORT_URL="https://bugs.rockylinux.org/" ROCKY_SUPPORT_PRODUCT="Rocky Linux" ROCKY_SUPPORT_PRODUCT_VERSION="8"
So by adding Rocky Linux as an acceptable OS name in the spec file, it should make the RPM installable, fingers crossed.
case $os_name in *"Red Hat"*|*CentOS*|*Oracle*|*"Rocky Linux"*) #Redhat and "derivatives" dist_name=REDHAT ;;
After making the changes, save them and exit the editor, you are prompted for confirmation
Do you want to continue ? (y/N)
Select y for yes. The system will then go through a process of creating a new RPM and after a short period, tell you where it is located (yes I did this as root, very bad practice!!)
result: /root/rpmbuild/RPMS/x86_64/EMC-ScaleIO-sdc-3.6-100.102.el8.x86_64.rpm
An installation of the rebuilt RPM can be attempted and if the edits have worked, this should complete successfully.
rpm -ivh /root/rpmbuild/RPMS/x86_64/EMC-ScaleIO-sdc-3.6-100.102.el8.x86_64.rpm Verifying... ################################# [100%] Preparing... ################################# [100%] Updating / installing... 1:EMC-ScaleIO-sdc-3.6-100.102.el8 ################################# [100%] EMC-ScaleIO-diag_coll-0.17.linux.noarch.bsx: 29/09 12:54:55.052192: Installing diagnostic collector Created symlink /etc/systemd/system/multi-user.target.wants/diag_coll.service → /etc/systemd/system/diag_coll.service. EMC-ScaleIO-diag_coll-0.17.linux.noarch.bsx: 29/09 12:54:55.348543: Diagnostic collector version 0.17 installed /var/tmp/rpm-tmp.lyyTlP: line 286: which:: command not found Using pre-compiled selinux policy /bin/emc/scaleio/selinux/precompiled_scini.pp Installing selinux policy Generating new UUID 8434C938-671A-4BFE-98B5-4C16EADACD27 Updating file /etc/emc/scaleio/drv_cfg.txt with GUID Starting scini (via systemctl): [ OK ]
Check that the scini driver has loaded correctly
systemctl status scini ● scini.service - LSB: This script is responsible to control the scini service. Loaded: loaded (/etc/rc.d/init.d/scini; generated) Active: active (exited) since Wed 2021-09-29 12:55:28 BST; 1min 42s ago Docs: man:systemd-sysv-generator(8) Process: 3561028 ExecStart=/etc/rc.d/init.d/scini start (code=exited, status=0/SUCCESS)
The PowerFlex administrator can now present volumes to the node running Rocky Linux.
The good news is that PowerFlex engineering will very soon have support for the SDC in Rocky Linux thereby removing the requirement for any ‘hacking’ with rpmrebuild, however it is still something very useful to have in your tool bag.
Hi Kevin, this is a great example of rpmrebuild’s many uses – however, I wonder if you could also rename the OS temporarily in /etc/os-release instead to trick it for the purpose of installing?
That would probably be possible too 🙂 Provided it is restored to its original state then it shouldn’t break anything else