Bug 850686

Summary: yum --installroot doest not work
Product: Red Hat Enterprise Linux 6 Reporter: hydra35 <clanherb>
Component: yumAssignee: James Antill <james.antill>
Status: CLOSED NOTABUG QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.3   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-23 19:26:14 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:

Description hydra35 2012-08-22 07:15:33 UTC
Description of problem:

When using --installroot option to install package to a specific directory, such as /usr/local/nginx, yum always uses an incorrect URL to get repomd.xml: http://mirrors.163.com/centos/%24releasever. The correct one should be http://mirrors.163.com/centos/6.

The command also produces unrelated files in the intended installroot:

/usr/local/nginx
└── var
    ├── cache
    │   └── yum
    │       └── x86_64
    │           └── $releasever
    │               ├── base
    │               │   └── packages
    │               ├── epel
    │               │   ├── metalink.xml
    │               │   └── packages
    │               └── timedhosts.txt
    ├── lib
    │   ├── rpm
    │   │   ├── Name
    │   │   ├── Packages
    │   │   └── Providename
    │   └── yum
    │       ├── repos
    │       │   └── x86_64
    │       │       └── $releasever
    │       │           ├── base
    │       │           └── epel
    │       └── uuid
    ├── log
    │   └── yum.log
    └── run


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

How reproducible:

# yum --installroot=/usr/local/nginx install nginx

Loaded plugins: fastestmirror, presto
Determining fastest mirrors
epel/metalink                                                                                                                                              | 4.5 kB     00:00     
Including mirror: mirror.neu.edu.cn
Including mirror: mirrors.ustc.edu.cn
 * epel: mirror.neu.edu.cn
http://mirrors.163.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again



Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 2 James Antill 2012-08-23 19:26:14 UTC
 When using --installroot everything is done within the chroot, so yum can't find out what $releasever maps to (it normally does this by reading /var/lib/rpm).
 There are two workarounds:

Pass: --releasever=6
Pass: --releasever=/

...the later tells yum to lookup this value from the /var/lib/rpm outside the chroot.