LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-03-2013, 06:25 AM   #1
alan.vitor
LQ Newbie
 
Registered: Apr 2013
Posts: 4

Rep: Reputation: Disabled
yum --installroot should use /etc/yum.repos.d?


I have a chroot environment in a directory. I want to install some RPM packages using the repositories in that chroot environment instead of the host OS ones.

yum --installroot= will look for packages repositories only in myroot/etc/yum.repos.d or it will only/also look in /etc/yum/repos.d? RHEL 6 is having the latter behavior. If that is expected behavior, what is the best method to achieve what I need?

Thanks in advance.
 
Old 04-03-2013, 08:35 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
In the man page for yum it says repository configuration is honored for all operations. I take that to mean it is always going to look at your overall configuration.

The way yum works is to install what you ask for AND any dependencies required to make it work. It is recursive which is to say if it determines package J is needed to install package A it will then check to see what dependencies package J has so may find it also needs to install package Z. It then checks package Z and may find it needs package F. It then checks package F etc...

So if you think about it if you were to try to use yum to install packages in a chroot directory and exclude the main repositories and rpmdb it would determine utltimately that you need a full install of hundreds of packages because you're chroot is apt to have a limited subset that you'd put there. (e.g. you typically don't copy all of /lib, /usr/lib, /bin, /etc to it - just enough to make it work when someone logs into the chroot).

Theoretically the above wouldn't be a problem if you logged in as the chrooted user and ran yum because the chrooted user wouldn't see the root /etc but rather the /etc you'd put in myroot. Unfortunately you'd still have the same problem of yum deciding to install EVERYTHING because it wouldn't see much. In practice it wouldn't work anyway because your chrooted user won't have root access to his own environment.

So the question here is - Are you trying to simply set up a chroot environment with limited functionality or are you trying to setup a fully functional environment with broad functionality. If the latter you should be looking at creating a virtual machine (e.g. with KVM). If the former a better way to do what you want might be to either a) Install the packages as your real root user then copy what you need to the chroot'ed environment from your non-chroot environment or b) Use yum downloadonly to download the RPMs you need then use yum's local install option or rpm itself to install the packages. Were it me I'd go with option a.
 
Old 04-03-2013, 01:53 PM   #3
alan.vitor
LQ Newbie
 
Registered: Apr 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
I'm trying to set up a fully functional limited environment to build packages for different Linux distributions. Each chroot should contain all packages/binaries/libraries it needs, but it should contain the minimum necessary to build packages. I use schroot to manage all chroots and imho it is simpler/faster than managing one VM for each Linux distribution I need to support.

As I may have a chroot with a Linux distribution different than the host OS, installing packages as host OS root user using host OS repositories does not work. Using yum downloadonly in the host OS will not work for the same reason.

I need to only use repos in the myroot/etc/yum.repos.d.

Idea 1: as yum --installroot=<myroot> repolist gets chroot and host repositories, I thought in using yum install disablerepo=<host OS repositories> but then I'd need to parse files in etc/yum.repos.d/ to get the repositories list?

Idea 2: temporarily backup /etc/yum.repos.d and replace it with myroot/etc/yum.repos.d

I think there should be a simpler way to achieve this. Ideas?

Last edited by alan.vitor; 04-03-2013 at 02:08 PM.
 
Old 04-03-2013, 03:51 PM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
I haven't done what you're trying.

Doing a web search using the following search terms resulted in a fair number of hits.
creating multiple build environments with chroot yum

The first one I see talks about doing this for CentOS which should be similar to RHEL:
http://www.serverschool.com/dedicate...ent-in-centos/

However it shows that you do have to do a full install in each chroot as I indicated would be the case which is why I suggested VMs.

One idea might be to setup your chroot'ed user so that the myroot/etc/passwd gives him UID 0 so that when it logs in it is seen as the root user in the chroot itself. Or better yet setup sudo under the chroot (e.g. myroot/etc/sudoers) to allow the chrooted user to become root after loging. Since it is chroot'ed and logged into the chroot theoretically it should see myroot as / and only use anything it sees under that directory structure. I've not tried that myself though and there may be safeguards specifically to prevent chroot'ed user's from becoming root of which I am not aware.
 
Old 04-03-2013, 04:58 PM   #5
alan.vitor
LQ Newbie
 
Registered: Apr 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
I'm already following the steps in the url you sent in your last post. The problem is that yum install fails because yum looks in my host os repositories and tries to download the wrong packages (host os != chrooted os). Fow now, I've used hard-coded --disablerepo=<host_repos> parameter in yum install, but that's hardly a definite solution.

I have no problem doing a full install (if it's a minimal one) in each chroot. As I said, chroots are now easily handled by schroot and the build process is already automated using it, so I'd like to avoid the change to VMs.

Last edited by alan.vitor; 04-03-2013 at 05:03 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
yum --installroot service httpd mysqld not recognize noufal_pv Linux - Newbie 12 10-22-2012 08:59 AM
Unable to update repos in CentOS 5.6 yum.repos.d!!!!! Explore_Linux Linux - Newbie 1 09-28-2011 04:20 AM
yum install flash ... yum: command not found ... which yum ... /usr/bin/yum tg0000 Fedora 8 04-13-2011 11:25 AM
Other yum repos? hamtavs Fedora 1 12-20-2006 04:51 AM
Yum/Apt whis is better? yum or apt repos needed coolguy_iiit Linux - Newbie 1 07-31-2006 08:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration