Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dealing with very old fedora release #39

Open
pevsonic opened this issue Feb 18, 2019 · 5 comments
Open

Dealing with very old fedora release #39

pevsonic opened this issue Feb 18, 2019 · 5 comments

Comments

@pevsonic
Copy link

Hiya,

So firstly, yumbootstrap is a cracking tool - I'm using it to help create a docker base image for resurrecting a very old build environment for an old project that needs to be built on Fedora 8 so I'm sure this is almost certainly going to be an obscure / non issue for most people :-)

As per the usage example in README.md, I'm doing :

yumbootstrap --verbose --no-scripts fedora-8 ${CHROOT}
yum --installroot=${CHROOT} -c ${CHROOT}/yumbootstrap/yum.conf install ...
yumbootstrap --verbose --just-scripts ${CHROOT}

The last command fails however with :

root@zed:/opt/docker/src#   yumbootstrap --verbose --just-scripts ${CHROOT}
[19:57:45] executing post-install scripts
[19:57:45] running finalize
[19:57:45] fixing RPM database for guest
[19:57:45] converting "Packages" file
[19:57:53] removing all the files except "Packages"
[19:57:53] running `rpm --rebuilddb'
rpmdb: /var/lib/rpm/Packages: unsupported hash version: 9
error: cannot open Packages index using db3 - Invalid argument (22)
Traceback (most recent call last):
  File "/etc/yumbootstrap/suites/scripts/fix_rpmdb.py", line 27, in <module>
    yum.fix_rpmdb()
  File "/usr/lib/python2.7/dist-packages/yumbootstrap/yum.py", line 192, in fix_rpmdb
    env = self.yum_conf.env,
  File "/usr/lib/python2.7/dist-packages/yumbootstrap/sh.py", line 80, in run
    check_error(command[0], proc.returncode)
  File "/usr/lib/python2.7/dist-packages/yumbootstrap/sh.py", line 16, in check_error
    raise YBError('"%s" exited with code %d', cmd, code, exit = 1)
yumbootstrap.exceptions.YBError: "rpm" exited with code 1
"/etc/yumbootstrap/suites/scripts/fix_rpmdb.py" exited with code 1

This looks to be because the ${CHROOT}/var/lib/rpm/Packages has been created with a version of rpm that isn't backwards compatible.

Luckily it seems to be the last operation so I can repair the Packages file by building bdb v4.2.52 and using it :

mv ${CHROOT}/var/lib/rpm/Packages ${CHROOT}/var/lib/rpm/Packages.orig
db_dump  ${CHROOT}/var/lib/rpm/Packages.orig | /opt/ptx/bin/db_load42 ${CHROOT}/var/lib/rpm/Packages

I'm scratching my head though to see if there's clean way to fix this? Im also wondering if its even worth bothering as Im not sure if anyone else would be interested in this as its a spot obscure?

@dozzie
Copy link
Owner

dozzie commented Feb 18, 2019

What you encountered, the RPM database being in the BerkeleyDB format of the host instead of the guest, is not a weird, obscure case. I would say it's more or less an expected problem. It's the reason why I included the fix_rpmdb.py post-install script, which is supposed to make a DB dump with host's db_dump and load it with the chroot's, so the RPM database would be usable from within the chroot.

What you did is pretty much the same, except you installed the older BDB tools on the host in /opt. In fact, I don't quite understand why you needed to do that yourself. Maybe in Fedora 8 the db_dump and RPM were of different versions? I need to check that.

@pevsonic
Copy link
Author

Ah, OK, that's interesting, I had wondered if something like that was the case!

Do you want anything else from my end? I've got a easily testable forked copy of the source with FC8 changes with a branch fedora8-support at :

https://github.com/pevsonic/yumbootstrap

That fork also has an extra commit that adds a switch to ignore gpg checks which is needed to use fedora 8 which might be worth grabbing (there appears to be no valid key available any more for some of the packages)

pevsonic@40b01ce

Thanks!

@dozzie
Copy link
Owner

dozzie commented Feb 20, 2019

I managed to reproduce the problem, for now this is enough.

A command line option to disable GPG signatures is a good idea (though disabling GPG signatures is itself not a good idea). I think I'll include your commit. Thanks.

@dozzie
Copy link
Owner

dozzie commented Feb 21, 2019

I have good news. Apparently rpm is shipped with BerkeleyDB utilities appropriate for its database, and it's in the same place for all Fedora versions I checked, Fedora 8 through 27.

If you adjust yum.fix_rpmdb() call in fix_rpmdb.py post-install script, you can resolve this problem in a systemic way. What you want to put there is:

yum.fix_rpmdb(db_load = '/usr/lib/rpm/rpmdb_load')

I need to see if the rpmdb_load is a universal thing and I'll adjust the underlying Python code to use the proper tool for converting the format, which will be an actual and the proper solution to this issue.

@pevsonic
Copy link
Author

Ah, nice one, thanks. Having a quick dig, you're right - it will be universal as it's part of rpm :

https://github.com/rpm-software-management/rpm/blob/6d4c68ba10b9713f3e599cf20c2455eb80e9bfe1/lib/Makefile.am#L119w

That's a tidy resolution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants