RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1038242 - Blindly assumes presence of /mnt/sysimage means it should put things there
Summary: Blindly assumes presence of /mnt/sysimage means it should put things there
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Adrian Likins
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel70
TreeView+ depends on / blocked
 
Reported: 2013-12-04 17:01 UTC by Bill Nottingham
Modified: 2014-06-18 00:29 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-13 12:42:47 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Bill Nottingham 2013-12-04 17:01:16 UTC
Description of problem:

From productid.py:


def chroot():
    """
    Use /mnt/sysimage when it exists to support operating
    within an Anaconda installation.
    """
    sysimage = '/mnt/sysimage'
    if os.path.exists(sysimage):
        Path.ROOT = sysimage

If something accidentally creates /mnt/sysimage (see bug 1038241), it appears that subscription-manager will blindly use that directory.

Version-Release number of selected component (if applicable):

latest RHEL 7 releng tree as of 1203

Comment 2 Adrian Likins 2014-01-14 19:01:36 UTC
Definately busted for the case mentioned. 

Is there a good way to determine if a yum plugin is running within anaconda?

Comment 3 Adrian Likins 2014-02-18 15:38:54 UTC
Discussed this with the anaconda folks, and the thought was that looking for /mnt/sysimage was reasonable, and it's existing elsewhere was a bug. But that looking for say, /tmp/anaconda.log as well would mitigate.

Comment 4 Adrian Likins 2014-02-18 17:04:47 UTC
Since /tmp/anaconda.log is probably even more likely to accidentally exist (or be created by a install into an image), changed to checking for
'/mnt/sysimage' and '/var/run/anaconda.pid'

pr at https://github.com/candlepin/subscription-manager/pull/910

Comment 5 Adrian Likins 2014-02-18 22:36:09 UTC
master
commit 86138d955d2d3859d0f1c6c94a91c02d00f34f9d
Author: Adrian Likins <alikins>
Date:   Tue Feb 18 11:59:12 2014 -0500

    1038242: add anaconda.pid check before chroot
    
    The yum plugin 'productid.py' has to detect if it is
    running in anaconda or not, so that it will place the
    productid file in the correct chroot.
    
    Previusly, this just checked for existince of '/mnt/sysimage'
    but that can exist outside of anaconda (or in the original
    bug, left over by anaconda). So add a check that
    '/var/run/anaconda.pid' exists as well.

Comment 7 John Sefler 2014-02-28 22:52:47 UTC
Demonstrating the failure....

[root@jsefler-6server ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: Unknown
subscription-manager: 1.9.11-1.el6
python-rhsm: 1.9.6-1.el6

[root@jsefler-6server ~]# subscription-manager register --username=stage_test_12 --serverurl=subscription.rhn.stage.redhat.com:443/subscription --autosubscribe
Password: 
The system has been registered with ID: c6d2789e-8ba7-4734-b4ce-a101f97aec1d 
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

[root@jsefler-6server ~]# find /mnt/sysimage
find: `/mnt/sysimage': No such file or directory
[root@jsefler-6server ~]# mkdir -p /mnt/sysimage
[root@jsefler-6server ~]# yum install zsh --quiet -y
This system is receiving updates from Red Hat Subscription Management.
This system is not registered with RHN Classic or RHN Satellite.
You can use rhn_register to register.
RHN Satellite or RHN Classic support will be disabled.
[root@jsefler-6server ~]# find /mnt/sysimage/
/mnt/sysimage/
/mnt/sysimage/var
/mnt/sysimage/var/lib
/mnt/sysimage/var/lib/rhsm
/mnt/sysimage/var/lib/rhsm/productid.js
/mnt/sysimage/etc
/mnt/sysimage/etc/pki
/mnt/sysimage/etc/pki/product
/mnt/sysimage/etc/pki/product/69.pem


FAILED: The product-id yum plugin installed the repo product cert 69.pem into /mnt/sysimage/etc/pki/product and also installed productid.js file.  This chroot should not have happened.

Comment 8 John Sefler 2014-02-28 23:11:00 UTC
Verifying Version....

[root@jsefler-7 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: Unknown
subscription-manager: 1.10.14-3.el7
python-rhsm: 1.10.12-1.el7

[root@jsefler-7 ~]# subscription-manager register --username=rhel7beta --serverurl=subscription.rhn.stage.redhat.com:443/subscription --autosubscribe
Password: 
The system has been registered with ID: eab93723-8a6f-4d9a-bd15-0a2abdae7a6d 
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux 7 Server High Touch Beta
Status:       Subscribed

[root@jsefler-7 ~]# find /mnt/sysimage
find: ‘/mnt/sysimage’: No such file or directory
[root@jsefler-7 ~]# mkdir -p /mnt/sysimage
[root@jsefler-7 ~]# ls /var/run/anaconda.pid
ls: cannot access /var/run/anaconda.pid: No such file or directory
[root@jsefler-7 ~]# rpm -q zsh
package zsh is not installed
[root@jsefler-7 ~]# yum install zsh --quiet -y
[root@jsefler-7 ~]# rpm -q zsh
zsh-5.0.2-7.el7.x86_64
[root@jsefler-7 ~]# find /mnt/sysimage
/mnt/sysimage
[root@jsefler-7 ~]# ls /var/lib/rhsm/
branded_name  cache  facts  packages  productid.js
[root@jsefler-7 ~]# ls /etc/pki/product/
230.pem

VERIFIED: Despite the existance of /mnt/sysimage, no chroot was executed and /mnt/sysimage was not used by the yum product-id plugin during yum install of a package.

Comment 10 Adrian Likins 2014-06-04 19:14:48 UTC
/var/run/anaconda.pid isn't created by RHEL5 anaconda, hence https://bugzilla.redhat.com/show_bug.cgi?id=1104498

Comment 11 Ludek Smid 2014-06-13 12:42:47 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


Note You need to log in before you can comment on or make changes to this bug.