Hide Forgot
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:
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.