salt-bootstrap icon indicating copy to clipboard operation
salt-bootstrap copied to clipboard

RHEL 6 bootstrap fails when system is registered with subscription-manager (Patch Included)

Open cingeyedog opened this issue 12 years ago • 4 comments

How to register with subscription-manager: https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/entitlements.html

register: subscription-manager register --username="rhn username" --password="rhn password" attach to subscription: subscription-manager attach --pool="pool id of your subscription" enable repos: subscription-manager repos --enable=rhel-6-server-optional-rpms

[root@matthewtest ~]# subscription-manager list
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Red Hat Enterprise Linux Server
Product ID:     69
Version:        6.5
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         06/12/2014
Ends:           05/31/2015
[root@matthewtest ~]# yum repolist enabled
Loaded plugins: product-id, subscription-manager
rhel-6-server-optional-rpms                                                                                                                                                             | 3.5 kB     00:00     
rhel-6-server-rpms                                                                                                                                                                      | 3.7 kB     00:00     
rhel-server-dts-6-rpms                                                                                                                                                                  | 2.9 kB     00:00     
rhel-server-dts2-6-rpms                                                                                                                                                                 | 2.6 kB     00:00     
repo id                                                                        repo name                                                                                                                 status
epel                                                                           Extra Packages for Enterprise Linux 6 - x86_64                                                                            10,962
rhel-6-server-optional-rpms                                                    Red Hat Enterprise Linux 6 Server - Optional (RPMs)                                                                        7,145
rhel-6-server-rpms                                                             Red Hat Enterprise Linux 6 Server (RPMs)                                                                                  12,642
rhel-server-dts-6-rpms                                                         Red Hat Developer Toolset RPMs for Red Hat Enterprise Linux 6 Server                                                          84
rhel-server-dts2-6-rpms                                                        Red Hat Developer Toolset 2 RPMs for Red Hat Enterprise Linux 6 Server                                                       380
repolist: 31,213

When you do this, rhn-channel will fail:

[root@matthewtest ~]# rhn-channel -l
Unable to locate SystemId file. Is this system registered?

In the bootstrap-salt.sh, you are looking for the optional channel in rhn-channel

Line 2487:

if [ $DISTRO_MAJOR_VERSION -eq 6 ] && case "X$(rhn-channel -l | grep optional)" in Xrhel-${OPTIONAL_ARCH}-server-optional-${DISTRO_MAJOR_VERSION}* ) false ;; * ) true ;; esac ; then

This causes systems registered with subscription-manager to fail:

[root@matthewtest ~]# /tmp/.saltcloud/deploy.sh -c /tmp/.saltcloud
 *  INFO: /bin/sh /tmp/.saltcloud/deploy.sh -- Version 2014.04.16

 *  INFO: System Information:
 *  INFO:   CPU:          GenuineIntel
 *  INFO:   CPU Arch:     x86_64
 *  INFO:   OS Name:      Linux
 *  INFO:   OS Version:   2.6.32-431.1.2.el6.x86_64
 *  INFO:   Distribution: <R>ed <H>at <E>nterprise <L>inux 6.5

 *  INFO: Installing minion
 *  INFO: Found function install_red_hat_enterprise_linux_stable_deps
 *  INFO: Found function config_salt
 *  INFO: Found function install_red_hat_enterprise_linux_stable
 *  INFO: Found function install_red_hat_enterprise_linux_stable_post
 *  INFO: Found function install_red_hat_enterprise_linux_restart_daemons
 *  INFO: Found function daemons_running
 *  INFO: Running install_red_hat_enterprise_linux_stable_deps()
 * ERROR: Failed to find RHN optional repo, please enable it using the GUI or rhn-channel command.
 * ERROR: Failed to run install_red_hat_enterprise_linux_stable_deps()!!!

Patch for your consideration:

[root@matthewtest ~]# cat bootstrap.patch 
--- /usr/lib/python2.6/site-packages/salt/cloud/deploy/bootstrap-salt.sh    2014-06-10 16:39:51.000000000 -0400
+++ deploy.sh   2014-06-28 08:55:25.506002907 -0400
@@ -2484,9 +2484,10 @@
     else
         OPTIONAL_ARCH=$CPU_ARCH_L
     fi
-    if [ $DISTRO_MAJOR_VERSION -eq 6 ] && case "X$(rhn-channel -l | grep optional)" in Xrhel-${OPTIONAL_ARCH}-server-optional-${DISTRO_MAJOR_VERSION}* ) false ;; * ) true ;; esac ; then
-      echoerror "Failed to find RHN optional repo, please enable it using the GUI or rhn-channel command."
-      return 1
+    if [ $DISTRO_MAJOR_VERSION -eq 6 -a !"$(/usr/bin/yum repolist enabled 2> /dev/null | grep rhel-${DISTRO_MAJOR_VERSION}-server-optional-rpms)" -a !"$(/usr/sbin/rhn-channel -l 2> /dev/null | grep rhel-${OPTIONAL_ARCH}-server-optional-${DISTRO_MAJOR_VERSION})" ]; then 
+        echoerror "Failed to find RHN optional repo, please enable it using the GUI or rhn-channel or subscription-manager command."
+        return 1
     fi
     install_centos_stable_deps || return 1
     return 0
[root@matthewtest ~]# /tmp/.saltcloud/deploy.sh -c /tmp/.saltcloud
 *  INFO: /bin/sh /tmp/.saltcloud/deploy.sh -- Version 2014.04.16

 *  INFO: System Information:
 *  INFO:   CPU:          GenuineIntel
 *  INFO:   CPU Arch:     x86_64
 *  INFO:   OS Name:      Linux
 *  INFO:   OS Version:   2.6.32-431.1.2.el6.x86_64
 *  INFO:   Distribution: <R>ed <H>at <E>nterprise <L>inux 6.5

 *  INFO: Installing minion
 *  INFO: Found function install_red_hat_enterprise_linux_stable_deps
 *  INFO: Found function config_salt
 *  INFO: Found function install_red_hat_enterprise_linux_stable
 *  INFO: Found function install_red_hat_enterprise_linux_stable_post
 *  INFO: Found function install_red_hat_enterprise_linux_restart_daemons
 *  INFO: Found function daemons_running
 *  INFO: Running install_red_hat_enterprise_linux_stable_deps()
Retrieving http://mirrors.kernel.org/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
Preparing...                ##################################################
epel-release                ##################################################
Loaded plugins: product-id, subscription-manager
This system is receiving updates from Red Hat Subscription Management.
Setting up Install Process
Package yum-utils-1.1.30-17.el6_5.noarch already installed and latest version
Package chkconfig-1.3.49.3-2.el6_4.1.x86_64 already installed and latest version
Package matching PyYAML-3.10-3.el6.x86_64 already installed. Checking for update.
Package m2crypto-0.20.2-9.el6.x86_64 already installed and latest version
Package python-crypto-2.0.1-22.el6.x86_64 already installed and latest version
Package python-msgpack-0.1.13-3.el6.x86_64 already installed and latest version
Package python-zmq-2.2.0.1-1.el6.x86_64 already installed and latest version
Package python-jinja2-2.2.1-2.el6_5.x86_64 already installed and latest version
Package python-requests-1.1.0-4.el6.noarch already installed and latest version
Nothing to do
 *  INFO: Running config_salt()
 *  INFO: Running install_red_hat_enterprise_linux_stable()
Loaded plugins: product-id, subscription-manager
This system is receiving updates from Red Hat Subscription Management.
Setting up Install Process
Package salt-minion-2014.1.5-1.el6.noarch already installed and latest version
Nothing to do
 *  INFO: Running install_red_hat_enterprise_linux_stable_post()
 *  INFO: Running install_red_hat_enterprise_linux_restart_daemons()
Starting salt-minion daemon:                               [  OK  ]
 *  INFO: Running daemons_running()
 *  INFO: Salt installed!

cingeyedog avatar Jun 28 '14 13:06 cingeyedog

Error in the patch file. Missing a SPACE

[root@saltmaster ~]# cat bootstrap.patch 
--- /usr/lib/python2.6/site-packages/salt/cloud/deploy/bootstrap-salt.sh    2014-06-10 16:39:51.000000000 -0400
+++ deploy.sh   2014-06-28 08:55:25.506002907 -0400
@@ -2484,9 +2484,10 @@
     else
         OPTIONAL_ARCH=$CPU_ARCH_L
     fi
-    if [ $DISTRO_MAJOR_VERSION -eq 6 ] && case "X$(rhn-channel -l | grep optional)" in Xrhel-${OPTIONAL_ARCH}-server-optional-${DISTRO_MAJOR_VERSION}* ) false ;; * ) true ;; esac ; then
-      echoerror "Failed to find RHN optional repo, please enable it using the GUI or rhn-channel command."
-      return 1
+    if [ $DISTRO_MAJOR_VERSION -eq 6 -a ! "$(/usr/bin/yum repolist enabled 2> /dev/null | grep rhel-${DISTRO_MAJOR_VERSION}-server-optional-rpms)" -a ! "$(/usr/sbin/rhn-channel -l 2> /dev/null | grep rhel-${OPTIONAL_ARCH}-server-optional-${DISTRO_MAJOR_VERSION})" ]; then
+        echoerror "Failed to find RHN optional repo, please enable it using the GUI or rhn-channel or subscription-manager command."
+        return 1
     fi
     install_centos_stable_deps || return 1
     return 0

cingeyedog avatar Jun 28 '14 14:06 cingeyedog

On 28 de Junho de 2014 14:43:36 WEST, cingeyedog [email protected] wrote:

How to register with subscription-manager: https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/entitlements.html

register: subscription-manager register --username="rhn username" --password="rhn password" attach to subscription: subscription-manager attach --pool="pool id of your subscription" enable repos: subscription-manager repos --enable=rhel-6-server-optional-rpms

[root@matthewtest ~]# subscription-manager list
+-------------------------------------------+
   Installed Product Status
+-------------------------------------------+
Product Name:   Red Hat Enterprise Linux Server
Product ID:     69
Version:        6.5
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         06/12/2014
Ends:           05/31/2015
[root@matthewtest ~]# yum repolist enabled
Loaded plugins: product-id, subscription-manager
rhel-6-server-optional-rpms                                            
                                               | 3.5 kB     00:00     
rhel-6-server-rpms                                                     
                                               | 3.7 kB     00:00     
rhel-server-dts-6-rpms                                                 
                                               | 2.9 kB     00:00     
rhel-server-dts2-6-rpms                                                
                                               | 2.6 kB     00:00     
repo id                                                                
repo name                                                              
                                                 status
epel                                                                   
Extra Packages for Enterprise Linux 6 - x86_64                         
                                                 10,962
rhel-6-server-optional-rpms                                            
Red Hat Enterprise Linux 6 Server - Optional (RPMs)                    
                                                  7,145
rhel-6-server-rpms                                                     
Red Hat Enterprise Linux 6 Server (RPMs)                               
                                                 12,642
rhel-server-dts-6-rpms                                                 
Red Hat Developer Toolset RPMs for Red Hat Enterprise Linux 6 Server   
                                                     84
rhel-server-dts2-6-rpms                                                
Red Hat Developer Toolset 2 RPMs for Red Hat Enterprise Linux 6 Server 
                                                    380
repolist: 31,213

When you do this, rhn-channel will fail:

[root@matthewtest ~]# rhn-channel -l
Unable to locate SystemId file. Is this system registered?

In the bootstrap-salt.sh, you are looking for the optional channel in rhn-channel

Line 2487:

if [ $DISTRO_MAJOR_VERSION -eq 6 ] && case "X$(rhn-channel -l | grep
optional)" in
Xrhel-${OPTIONAL_ARCH}-server-optional-${DISTRO_MAJOR_VERSION}* ) false
;; * ) true ;; esac ; then

This causes systems registered with subscription-manager to fail:

[root@matthewtest ~]# /tmp/.saltcloud/deploy.sh -c /tmp/.saltcloud
*  INFO: /bin/sh /tmp/.saltcloud/deploy.sh -- Version 2014.04.16

*  INFO: System Information:
*  INFO:   CPU:          GenuineIntel
*  INFO:   CPU Arch:     x86_64
*  INFO:   OS Name:      Linux
*  INFO:   OS Version:   2.6.32-431.1.2.el6.x86_64
*  INFO:   Distribution: <R>ed <H>at <E>nterprise <L>inux 6.5

*  INFO: Installing minion
*  INFO: Found function install_red_hat_enterprise_linux_stable_deps
*  INFO: Found function config_salt
*  INFO: Found function install_red_hat_enterprise_linux_stable
*  INFO: Found function install_red_hat_enterprise_linux_stable_post
*  INFO: Found function
install_red_hat_enterprise_linux_restart_daemons
*  INFO: Found function daemons_running
*  INFO: Running install_red_hat_enterprise_linux_stable_deps()
* ERROR: Failed to find RHN optional repo, please enable it using the
GUI or rhn-channel command.
* ERROR: Failed to run
install_red_hat_enterprise_linux_stable_deps()!!!

Patch for your consideration:

[root@matthewtest ~]# cat bootstrap.patch 
---
/usr/lib/python2.6/site-packages/salt/cloud/deploy/bootstrap-salt.sh   2014-06-10
16:39:51.000000000 -0400
+++ deploy.sh  2014-06-28 08:55:25.506002907 -0400
@@ -2484,9 +2484,10 @@
    else
        OPTIONAL_ARCH=$CPU_ARCH_L
    fi
-    if [ $DISTRO_MAJOR_VERSION -eq 6 ] && case "X$(rhn-channel -l |
grep optional)" in
Xrhel-${OPTIONAL_ARCH}-server-optional-${DISTRO_MAJOR_VERSION}* ) false
;; * ) true ;; esac ; then
-      echoerror "Failed to find RHN optional repo, please enable it
using the GUI or rhn-channel command."
-      return 1
+    if [ $DISTRO_MAJOR_VERSION -eq 6 -a !"$(/usr/bin/yum repolist
enabled 2> /dev/null | grep
rhel-${DISTRO_MAJOR_VERSION}-server-optional-rpms)" -a
!"$(/usr/sbin/rhn-channel -l 2> /dev/null | grep
rhel-${OPTIONAL_ARCH}-server-optional-${DISTRO_MAJOR_VERSION})" ]; then

+        echoerror "Failed to find RHN optional repo, please enable it
using the GUI or rhn-channel or subscription-manager command."
+        return 1
    fi
    install_centos_stable_deps || return 1
    return 0
[root@matthewtest ~]# /tmp/.saltcloud/deploy.sh -c /tmp/.saltcloud
*  INFO: /bin/sh /tmp/.saltcloud/deploy.sh -- Version 2014.04.16

*  INFO: System Information:
*  INFO:   CPU:          GenuineIntel
*  INFO:   CPU Arch:     x86_64
*  INFO:   OS Name:      Linux
*  INFO:   OS Version:   2.6.32-431.1.2.el6.x86_64
*  INFO:   Distribution: <R>ed <H>at <E>nterprise <L>inux 6.5

*  INFO: Installing minion
*  INFO: Found function install_red_hat_enterprise_linux_stable_deps
*  INFO: Found function config_salt
*  INFO: Found function install_red_hat_enterprise_linux_stable
*  INFO: Found function install_red_hat_enterprise_linux_stable_post
*  INFO: Found function
install_red_hat_enterprise_linux_restart_daemons
*  INFO: Found function daemons_running
*  INFO: Running install_red_hat_enterprise_linux_stable_deps()
Retrieving
http://mirrors.kernel.org/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
Preparing...               
##################################################
epel-release               
##################################################
Loaded plugins: product-id, subscription-manager
This system is receiving updates from Red Hat Subscription Management.
Setting up Install Process
Package yum-utils-1.1.30-17.el6_5.noarch already installed and latest
version
Package chkconfig-1.3.49.3-2.el6_4.1.x86_64 already installed and
latest version
Package matching PyYAML-3.10-3.el6.x86_64 already installed. Checking
for update.
Package m2crypto-0.20.2-9.el6.x86_64 already installed and latest
version
Package python-crypto-2.0.1-22.el6.x86_64 already installed and latest
version
Package python-msgpack-0.1.13-3.el6.x86_64 already installed and latest
version
Package python-zmq-2.2.0.1-1.el6.x86_64 already installed and latest
version
Package python-jinja2-2.2.1-2.el6_5.x86_64 already installed and latest
version
Package python-requests-1.1.0-4.el6.noarch already installed and latest
version
Nothing to do
*  INFO: Running config_salt()
*  INFO: Running install_red_hat_enterprise_linux_stable()
Loaded plugins: product-id, subscription-manager
This system is receiving updates from Red Hat Subscription Management.
Setting up Install Process
Package salt-minion-2014.1.5-1.el6.noarch already installed and latest
version
Nothing to do
*  INFO: Running install_red_hat_enterprise_linux_stable_post()
*  INFO: Running install_red_hat_enterprise_linux_restart_daemons()
Starting salt-minion daemon:                               [  OK  ]
*  INFO: Running daemons_running()
*  INFO: Salt installed!

Reply to this email directly or view it on GitHub: https://github.com/saltstack/salt-bootstrap/issues/420

Can you please download the latest stable release of the script and try again?

https://bootstrap.saltstack.com Pedro Algarvio @ Phone

s0undt3ch avatar Jun 28 '14 14:06 s0undt3ch

Sorry, you are correct. Thank you. It is working in the development version of the script.

However, it is installing too quickly for salt-cloud (not giving enough time for the openstack userdata_file time to execute. This is where I am registering the machine to RedHat).

 *  INFO: Found function daemons_running
 *  INFO: Running install_red_hat_enterprise_linux_stable_deps()
[DEBUG   ]  *  INFO: Found function daemons_running
 *  INFO: Running install_red_hat_enterprise_linux_stable_deps()
warning: /var/tmp/rpm-tmp.HGFpQ8: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
[DEBUG   ] warning: /var/tmp/rpm-tmp.HGFpQ8: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving http://mirrors.kernel.org/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
Preparing...                [DEBUG   ] Retrieving http://mirrors.kernel.org/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
Preparing...
##################################################
epel-release                ####[DEBUG   ] ##################################################
epel-release                ####
##############################################
[DEBUG   ] ##############################################
 *  INFO: Installing 'yum-tsflags' to test for package installation success
[DEBUG   ]  *  INFO: Installing 'yum-tsflags' to test for package installation success
Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
[DEBUG   ] Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
[DEBUG   ] Setting up Install Process
No package yum-tsflags available.
[DEBUG   ] No package yum-tsflags available.
No package install available.
[DEBUG   ] No package install available.
No package yum-tsflags available.
[DEBUG   ] No package yum-tsflags available.
Nothing to do
[DEBUG   ] Nothing to do
 * ERROR: Failed to install 'python-jinja2'. The optional repository or it's subscription might be missing.
 * ERROR: Failed to run install_red_hat_enterprise_linux_stable_deps()!!!
[DEBUG   ]  * ERROR: Failed to install 'python-jinja2'. The optional repository or it's subscription might be missing.
 * ERROR: Failed to run install_red_hat_enterprise_linux_stable_deps()!!!
Error: There was a profile error: Executing the command '/tmp/.saltcloud/deploy.sh -c /tmp/.saltcloud' failed

However, I can then log into the box and run the script successfully.

[root@matthewtest2 ~]# /tmp/.saltcloud/deploy.sh -c /tmp/.saltcloud
 *  INFO: /bin/sh /tmp/.saltcloud/deploy.sh -- Version 2014.06.28
 *  WARN: Running the unstable version of bootstrap-salt.sh

 *  INFO: System Information:
 *  INFO:   CPU:          GenuineIntel
 *  INFO:   CPU Arch:     x86_64
 *  INFO:   OS Name:      Linux
 *  INFO:   OS Version:   2.6.32-431.1.2.el6.x86_64
 *  INFO:   Distribution: <R>ed <H>at <E>nterprise <L>inux 6.5

 *  INFO: Installing minion
 *  INFO: Found function install_red_hat_enterprise_linux_stable_deps
 *  INFO: Found function config_salt
 *  INFO: Found function install_red_hat_enterprise_linux_stable
 *  INFO: Found function install_red_hat_enterprise_linux_stable_post
 *  INFO: Found function install_red_hat_enterprise_linux_restart_daemons
 *  INFO: Found function daemons_running
 *  INFO: Running install_red_hat_enterprise_linux_stable_deps()
warning: /var/tmp/rpm-tmp.zaBvhK: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving http://mirrors.kernel.org/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
Preparing...                ##################################################
epel-release                ##################################################
 *  INFO: Installing 'yum-tsflags' to test for package installation success
Loaded plugins: product-id, subscription-manager
This system is receiving updates from Red Hat Subscription Management.
Setting up Install Process
Package yum-3.2.29-43.el6_5.noarch already installed and latest version
No package install available.
Resolving Dependencies
--> Running transaction check
---> Package yum-plugin-tsflags.noarch 0:1.1.30-17.el6_5 will be installed
--> Finished Dependency Resolution

... cut ...

Dependency Installed:
  pciutils.x86_64 0:3.1.10-2.el6          salt.noarch 0:2014.1.5-1.el6         
  sshpass.x86_64 0:1.05-1.el6            

Complete!
 *  INFO: Running install_red_hat_enterprise_linux_stable_post()
 *  INFO: Running install_red_hat_enterprise_linux_restart_daemons()
Starting salt-minion daemon:                               [  OK  ]
 *  INFO: Running daemons_running()
 *  INFO: Salt installed!

cingeyedog avatar Jun 28 '14 15:06 cingeyedog

Awesome!

s0undt3ch avatar Jun 28 '14 23:06 s0undt3ch