Trying to get Red Hat Enterprise Linux to accept a DVD-based repository

I use Windows computers every day, I run my home stuff on a Mac and I want to continue to develop my Linux skills – so, I decided to build a Linux server at home. Out came my Red Hat Enterprise Linux 5 installation DVD and a short while later I had a working server. Great. Next, I wanted to customise the installed packages (the installer had given me the option to customise later, which I had accepted) – I fired up the Package Manager and…

…that’s right, a big empty white space in the browse list – the only listed packages were those that had been installed at setup time.

It seems that yum/pirut cannot read the RHEL installation DVD. After some googling, I decided to set up a new repository and created a file in /etc/yum.repos.d called rhel-dvd.repo, the contents of which were:

[dvd]
mediaid=1170972069.396645
name=DVD for RHEL5
baseurl=file:///media/RHEL_5%20i386%20DVD
enabled=1
gpgcheck=0

(the mediaid=1170972069.396645 line is the first line from the .discinfo file on the RHEL DVD, based on a comment on Jeremy Katz’s site.)

Cannot open/read repomd.xml file for repository: dvdIt seemed to recognise my DVD as an installation source but not as a valid repository, so after digging a little deeper I found that mediaid= requires yum 3.1.2 or later and I ended up in dependency hell (exactly what rpm is supposed to avoid).

This is crazy – it seems that Red Hat expect me to install everything from the Red Hat Network (RHN) – what about servers that do not have a connection to the Internet (or to an RHN proxy/satellite server)? Surely installation from the RHEL DVD should be an option (I suppose it is, technically, if I know what every RPM is for – that’s where the pirut browse capability is so useful).

For once, I give in. I could spend hours on this issue (I’ve already spent a few too many) but it’s Friday evening now and my bad IT day has turned into a bad IT week. I need to put the kids to bed and then have a quiet evening in with a large glass (or two) of wine.

In the meantime, if anyone has any ideas on how to get yum/pirut to recognise a CD/DVD as valid installation media, please leave a comment.

22 thoughts on “Trying to get Red Hat Enterprise Linux to accept a DVD-based repository


  1. Your info above was a great help to me in getting my repository loaded. the only thing different that I did was on the BASEURL entry, I added the full path into the /Server directory, so mine (on Oracle Enterprise Linux 5) was:

    baseurl=file:///media/Enterprise%20Linux%20cd%201%2020070613/Server

    The /Server directory on my CD is where the “repodata” directory is located. Once I added that path, everything you have above worked great. Thanks!


  2. Jeff, thank you so much for leaving that comment – your suggestion of adding /Server to the base URL fixed the problem completely :-)

    For reference, the file contents of /etc/yum.repos.d/rhel-dvd.repo are now:

    [dvd]
    mediaid=1170972069.396645
    name=DVD for RHEL5
    baseurl=file:///media/RHEL_5%20i386%20DVD/Server
    enabled=1
    gpgcheck=0

    Mark


  3. First of all, thanks for this thread, it’s helped me make progress of my own. I am able to see the packages on the DVD in the tool. However, when I try to install any of them, I get an error:

    IOError:

    This appears to be coming from the repomd.xml file, which defines package locations as ‘media:///’ etc.

    Did you not see this problem?


  4. Hi Matthew,
    Do you mean something like this:

    yum search packagename
    Loading “installonlyn” plugin
    Loading “rhnplugin” plugin
    This system is not registered with RHN.
    RHN support will be disabled.
    Setting up repositories
    file:///media/RHEL_5%20i386%20DVD/Server/repodata/repomd.xml: [Errno 5] OSError: [Errno 2] No such file or directory: ‘/media/RHEL_5 i386 DVD/Server/repodata/repomd.xml’
    Trying other mirror.
    Error: Cannot open/read repomd.xml file for repository: dvd

    If so, this is what I get if I don’t have the DVD mounted, although I don’t recall having seen a reference to “IOError:”.


  5. Mark,

    Thanks for your response. Ok, here is my rhel-dvd.repo file:

    [dvd]
    mediaid=1170972087.594754
    name=DVD for RHEL5
    baseurl=file:///media/cdrom/Workstation
    enabled=1
    gpgcheck=0

    Note that I could not get it to see the structure without the /media/cdrom reference (that is the mount point for my DVD). The output when I try to install an RPM is:

    Component: Software Manager
    Summary: TBe634e670 __init__.py:767:downloadHeader:RepoError: failed to retrieve system-config-kickstart-2.6.19.1-1.el5.noarch.rpm from dvd
    error was [Errno 4] IOError: urlopen error unknown url type: media>

    Traceback (most recent call last):
    File “/usr/sbin/pirut”, line 334, in _apply
    self.applyChanges(self.mainwin)
    File “/usr/lib/python2.4/site-packages/pirut/__init__.py”, line 557, in applyChanges
    self.checkDeps(mainwin)
    File “/usr/lib/python2.4/site-packages/pirut/__init__.py”, line 322, in checkDeps
    self.populateTs(keepold=0)
    File “/usr/lib/python2.4/site-packages/yum/depsolve.py”, line 153, in populateTs
    self.downloadHeader(txmbr.po)
    File “/usr/lib/python2.4/site-packages/yum/__init__.py”, line 767, in downloadHeader
    raise Errors.RepoError, saved_repo_error
    RepoError: failed to retrieve system-config-kickstart-2.6.19.1-1.el5.noarch.rpm from dvd
    error was [Errno 4] IOError:

    Local variables in innermost frame:
    errors: {}
    e: [Errno 2] No such file or directory: ‘//var/cache/yum/dvd/headers/system-config-kickstart-2.6.19.1-1.el5.noarch.hdr’
    self:
    saved_repo_error: failed to retrieve system-config-kickstart-2.6.19.1-1.el5.noarch.rpm from dvd
    error was [Errno 4] IOError:
    repo: dvd
    checkfunc: (>, (, 1), {})
    local: //var/cache/yum/dvd/headers/system-config-kickstart-2.6.19.1-1.el5.noarch.hdr
    po: system-config-kickstart – 2.6.19.1-1.el5.noarch


  6. Sorry Matthew, that’s got me stumped (although with my limited Linux knowledge that doesn’t take too much).

    The only thing that I can see different is that I’ve let RHEL automount the DVD for me when I double-clicked its icon in Nautilus (so mount shows /dev/hdc on /media/RHEL_5 i386 DVD type iso9660 (ro,noexec,nosuid,nodev,uid=0) whereas you have manually mounted it on /media/cdrom.

    HTH, Mark


  7. Mark, thanks for your response anyway. I will continue investigating and let you know if I find anything further.

    -Matthew Steele


  8. Hi everybody,
    I think you have to use the createrepo command in order to create a new RPM repository.
    Check man pages of the command and good luck!!

    Massimo


  9. my repo file is:
    [dvd]
    name=rhel5dvd
    baseurl=file:///dvd/actual/Server#actual is a mount point.
    enabled=1
    gpgcheck=1
    gpgkey=…
    when i use yum install/erase packages,it’s ok,but when through pirut/system-config-packages,it got output as below,but if i mkdir headers in /var/cache/yum/dvd,it’s ok too.could anybody give some deeper idea?
    Component: Software Manager
    Summary: TB5c703576 __init__.py:870:downloadHeader:RepoError: failure: actual/Server/adaptx-0.9.13-3jpp.1.i386.rpm from dvd: [Errno 256] No more mirrors to try.

    Traceback (most recent call last):
    File “/usr/sbin/system-config-packages”, line 334, in _apply
    self.applyChanges(self.mainwin)
    File “/usr/lib/python2.4/site-packages/pirut/__init__.py”, line 557, in applyChanges
    self.checkDeps(mainwin)
    File “/usr/lib/python2.4/site-packages/pirut/__init__.py”, line 322, in checkDeps
    self.populateTs(keepold=0)
    File “/usr/lib/python2.4/site-packages/yum/depsolve.py”, line 201, in populateTs
    self.downloadHeader(txmbr.po)
    File “/usr/lib/python2.4/site-packages/yum/__init__.py”, line 870, in downloadHeader
    raise Errors.RepoError, saved_repo_error
    RepoError: failure: actual/Server/adaptx-0.9.13-3jpp.1.i386.rpm from dvd: [Errno 256] No more mirrors to try.

    Local variables in innermost frame:
    errors: {}
    e: [Errno 2] No such file or directory: ‘//var/cache/yum/dvd/headers/adaptx-0.9.13-3jpp.1.i386.hdr’
    self:
    saved_repo_error: failure: actual/Server/adaptx-0.9.13-3jpp.1.i386.rpm from dvd: [Errno 256] No more mirrors to try.
    repo: dvd
    checkfunc: (>, (, 1), {})
    local: //var/cache/yum/dvd/headers/adaptx-0.9.13-3jpp.1.i386.hdr
    po: adaptx – 0.9.13-3jpp.1.i386


  10. From what I can tell there is no fix for the problem.

    The workaround is in the Red Hat KB which basically says rebuild your repodata to conform to yum “standard” without the media id bits.

    Then Pirut will work.

    From reading around it seems Jeremy Katz and others were trying to use the media id tag to “cache” repodata from the first disc and allow swapping of media without having to re-read the repodata from each disc. That project looks premature for RHEL5 and may involve upstream changes to yum to “allow” the media id tags. Since the Anaconda installer serves the install process and its using yum as the resolver for install they hacked it to support media id tags to make installs smoother. “After” install though yum standard can’t deal with the repodata “accessories” like media id tags in the repodata, so it throws an “unknown url type”.

    Installing createrepo lets you rebuild the repodata, but it needs to be relative to package source so the package source has to be on read/write media.

    I “guess” if they got the changes into an “upstream” version of yum then someday a yum errata or update will include a version that doesn’t choke on the old repodata and we could use DVD repodata, but that’s just speculation on my part.


  11. @Andrew – thanks for the Red Hat KB link – not quite the same issue as it need me to create a .ISO of the media (rather than working with physical DVDs) but a workaround nevertheless.

    @John – thanks for your input too. I’m always glad to hear from people who know more than I do about this stuff!

    @Matthew and David – FYI, my original server on which I got this working was physical. I’m now trying this in a virtual environment (have tried boih 32- and 64-bit versions of RHEL5) and seeing the same errors as you. The most obvious difference to me is that the RHEL5 DVD would auto-mount on my original server and needs to be manually mounted in my virtual environment. Not sure if that has any bearing on it all but it’s also possible that I did update something when I tried to move to a later version of yum on my original installation (despite ending up in dependency hell).


  12. hello guys
    i hav a problem with yum i m not able to configure yum on rhel5
    so please help me nd send me configuration of yum server for local intranet


  13. Hi Rajan, this post is about configuring a DVD-based repository (not an intranet-based one). There should be information on your question in the Red Hat documentation and if not, then try one of the Linux support forums. Mark


  14. Hey Mark,

    No problem.. but I always think everyone else knows more than me on a subject. Funny that you just commented recently since I found a temporary workaround just last night. If you “mount” the DVD below a read/writable path, you can run createrepo in a mode that offsets the repodata directory into the writable portion and can include group information from the read-only path.

    Then you can run a familar GUI tool like [ system-cdinstall-helper ] to get the “original” GUI used to setup install packages and pick and choose just like when you were about to install the first time.

    I’m just checking now, but I also think this “source” is acceptable to yum, so “finally” you should be able to used yum with the DVD media.

    Basically here’s what I’m talking about:

    1. mkdir -p /repo/RHEL5

    2. mount /dev/dvdrom /repo/RHEL5

    3. cd /repo

    4. createrepo -g /repo/RHEL5/Server/repodata/comps-rhel5-server-core.xml .


  15. I was trying to install RHEL5, update 1 via a PXE-boot and HTTP server (with the server running an old RHEL 3), that had the RHEL 5 DVD iso mounted to the repository directory. I was getting the same error messages as above (“could not find repomd.xml”), and none of the fixes seemed to apply to my situation. Simply changing to using the multiple CD iso’s instead of the DVD iso made the issue go away, so I have to think maybe my DVD image was corrupted or incomplete.


  16. Oh, i was anxious to say that above. I didn’t work for me! Only yum search is working… yum install brings me a error saying that my path is incorrect. It says something about media://[mediaid number]…


  17. Diogo

    I’ve been using the ‘trick’ I mentioned regularly for over a year now.

    For a PXE install I refer to the full path “deep” with /Server which lets the installer use the repodata in the original media with the mediatag bits.

    As part of the install I go ahead and add a .repo file to the /etc/yum.repos.d directory (with no mention of media id tags) and refer to a directory “above” the /Server directory where I have created “new” repodata using the createrepo command.

    That way the PXE install anaconda installer gets what it wants.

    And the after install yum tools get what they want.

    The yum GUI “pirut” and yumex (if you install that from EPEL or someplace) need the group information.

    That’s why I violate the “rule” for createrepo and create a repodata using createrepo from “outside” the directory of packages.

    # cd /repo

    # createrepo -g /repo/RHEL5/Server/repodata/comps-rhel5-server-core.xml .

    It’s wholey unconventional and unintuitive.

    It just happend to work.

    What’s going on here is the “-g” option is looking into the old original repodata directory and sourcing a package group specification file and using that to find the path to the packages its indexing.. and it happens to include the path to the packages source relative to where the command is run from.

    Trust me it works very well.

    There’s a more complicated work around to also include the other “channels” on the disk like Virtual and so forth using –repo options in your kickstart.. but I think I’m the only one that is interested in a unified deployment of both Server and Virtualization.

    You see I also deploy virtual machines at the same time on a host configuration using the same kickstart.. normally you’d rather using virt or libvirt tools to do that to be consistent with Red Hat way of doing things.

    I’ve also become a big fan of using a %postscript to create a one-time after install script that I chkconfig on before first reboot and chkconfig off after first reboot to perform stuff in installer neutral script languages.. that way I don’t have to worry about what’s available in anaconda as far as scripting goes.. and the full goodness of yum install, yum search, ect.. is available for solving depedencies and things..


  18. Thanks Mark upgrading the yum package did the trick, after i was able to run yum upgrade from my local DVD repo; regards Hiram

Leave a Reply