Bug 810399

Summary: Firstboot crashes when already registered to rhsm
Product: Red Hat Enterprise Linux 6 Reporter: J.C. Molet <jmolet>
Component: subscription-managerAssignee: Adrian Likins <alikins>
Status: CLOSED ERRATA QA Contact: Entitlement Bugs <entitlement-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.3CC: alikins
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 13:09:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 738066    

Description J.C. Molet 2012-04-05 21:01:13 UTC
Description of problem:
If you had registered subscription-manager before starting firstboot (via cli or in a kickstart) firstboot will throw an exception and crash.

Version-Release number of selected component (if applicable):
subscription-manager-gnome-1.0.0-1.git.2.711e916.el6.x86_64
subscription-manager-firstboot-1.0.0-1.git.2.711e916.el6.x86_64
python-rhsm-1.0.0-1.git.1.873e09b.el6.noarch
subscription-manager-migration-data-1.12.1.2-1.git.0.9e244c8.el6.noarch
subscription-manager-migration-1.0.0-1.git.2.711e916.el6.x86_64
subscription-manager-1.0.0-1.git.2.711e916.el6.x86_64

How reproducible:
always


Steps to Reproduce:
1.  register subscription manager via cli:  subscription-manager register --username=testuser1 --password=password --org=admin 
    or via the appropriate commands in a kickstart postinstall
2.  start firstboot
3.  continue along and select to register with the new rhsm
  
Actual results:
executable:     /usr/bin/python
hashmarkername: firstboot
kernel:         2.6.32-220.4.1.el6.x86_64
reason:         IndexError: list index out of range
time:           Thu 05 Apr 2012 04:33:17 PM EDT

firstboot-tb-TNvyVa: Text file, 42636 bytes

description:
:The following was filed automatically by firstboot:
:firstboot 1.110.11 exception report
:Traceback (most recent call last):
:  File "/usr/lib/python2.6/site-packages/firstboot/interface.py", line 105, in _nextClicked
:    self.advance()
:  File "/usr/lib/python2.6/site-packages/firstboot/interface.py", line 148, in advance
:    result = module.apply(self, self.testing)
:  File "/usr/share/rhn/up2date_client/firstboot/rhn_choose_server_gui.py", line 57, in apply
:    while not interface.moduleList[i].__module__.startswith('rhsm_'):
:IndexError: list index out of range

END:


Expected results:
I would expect this to behave exactly like rhn-classic currently does.  If it detects that you are already registered it doesn't even ask you if you would like to register and just skips to the final entitlement screen.

Additional info:

Comment 1 Adrian Likins 2012-04-09 17:40:43 UTC
The crash is in a rhn module, rhn_choose_server_gui. It is attempting to figure out where the screen after rhsm is, but to do that, it checks to see if rhsm_logging module exists. But the way it checks (looking for rhsm_module python module loaded into python's module path) is a bit of a false positive, since that can be there, even if the module itself isn't in firstboot's module list (which, in this case, it isn't because rhsm_login.shouldAppear is false, because the system is already loaded).

Basically, it's trying to look for the module loaded after rhsm_*, but there are no rhsm_* modules loaded. And I don't really see a good way for rhn_choose_server_gui to detect if the rhsm modules are loaded (at least not
at the time of createScreen which it needs to toggle the "rhn classic" widget).

Comment 2 Adrian Likins 2012-04-09 18:16:05 UTC
what versions of rhn-setup-gnome?

Comment 3 Adrian Likins 2012-04-09 18:24:29 UTC
I was able to reproduce this on a 6.2.x box with an older rhn-setup-gnome, but with a 6.3.x box, it seems to be okay for me.

Comment 4 J.C. Molet 2012-04-10 16:09:24 UTC
Testing this on a freshly built 6.3 box using rhn-setup-gnome-1.0.0-82.el6.noarch

I can see using strace that firstboot now tries to do:

stat("/etc/pki/product", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/etc/pki/entitlement", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/etc/pki/consumer", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

before it gets to that screen and now skips the entitlement part entirely.


Now the question is this:  shouldn't the latest package of subscription-manager-firstboot now require rhn-setup-gnome with versions >= 1.0.0-82 so people upgrading from rhel 6.2 systems get the right dependency?

Comment 5 Adrian Likins 2012-04-10 17:23:40 UTC
commit d10e51f10d468eabd2e2274a5580d8907f7ed76b
Author: Adrian Likins <alikins>
Date:   Tue Apr 10 12:19:52 2012 -0400

    810399: require the latest rhn-setup-gnome for firstboot
    
    Older versions of rhn-setup-gnome will crash firstboot
    when used with newer subscription-manager-firstboot

Comment 8 J.C. Molet 2012-04-11 15:22:53 UTC
[root@jmolet-vm0 ~]# rpm -qa | grep subscription-manager
subscription-manager-migration-data-1.12.1.2-1.git.2.99d0c10.el6.noarch
subscription-manager-gnome-1.0.0-1.git.11.f42a186.el6.x86_64
subscription-manager-1.0.0-1.git.11.f42a186.el6.x86_64
subscription-manager-migration-1.0.0-1.git.11.f42a186.el6.x86_64
subscription-manager-firstboot-1.0.0-1.git.11.f42a186.el6.x86_64


[root@jmolet-vm0 ~]# rpm -qR subscription-manager-firstboot
librsvg2  
rhn-setup-gnome >= 1.0.0-82
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PartialHardlinkSets) <= 4.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
subscription-manager-gnome = 1.0.0-1.git.11.f42a186.el6
rpmlib(PayloadIsXz) <= 5.2-1


subscription-manager-firstboot now requires rhn-setup-gnome >= 1.0.0-82

marking VERIFIED.

Comment 10 errata-xmlrpc 2012-06-20 13:09:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0804.html