[WBEL-devel] RPM problems
Charles Lacour
clacour@clacour.com
Wed, 10 Dec 2003 21:18:06 -0600
I'm replying to my own post in case anyone else gets bitten by the problem.
On Monday 08 December 2003 21:24, Charles Lacour wrote:
> This will probably turn out to be blindness/idiocy on my part, but I'm
> trying to install an RPM to a temporary directory to check it out, and it
> keeps blowing up on me.
>
> I _thought_, reading the rpm man page, that one specified "--root
> <directory>" to have everything go to someplace other than the normal. I
> entered the following command:
>
> $ rpm -vv --root /tmp/wb -i
> /loop2/RedHat/RPMS/redhat-logos-1.1.14.3-1.noarch.rpm
>
> (That's actually all one line -- Kmail wrapped it.) And this is what I got:
<snipped error log>
>
> Being a suspicious, paranoid type, I had made /tmp/wb owned by my ordinary
> id, "clacour", and ran the install command as that ID. As best I can tell,
> it's choking because it can't write to /boot/grub/splash.xpm.gz. It is NOT
> (as best I can see) trying to write to /tmp/wb/boot/grub/splash.xpm.gz.
This turned out to be the problem. You have to run the rpm command as root or
the '--root' option won't work.
FYI, somewhere in the process, it does a true chroot. To get things to work
all the way through, I had to:
* mkdir -p var/lib/rpm (in my work directory)
* copy everything from /var/lib/rpm to var/lib/rpm
* mdkir -p var/tmp
* mkdir tmp bin sbin lib
* copy bash, cp, rm, chmod,mktemp to bin (the bin in my work directory), and
recreate the link of sh --> bash.
* copy install-info to sbin.
* Copy the libraries for all of the above libraries for all of the above.
Consider that a starting point for your working directory, if you want to have
one. Several of the things (cp, rm, install-info, mktemp) I needed because of
the specific package I was using as a test case (zsh). They were needed by
it's post-install script (and the doc clearly says it does a chroot before
doing the %pre and %post scripts.)
Depending on what packages you try to install in it, you will need to copy
other commands, almost guaranteed.
My whole working directory ended up about 45 MB, just for the infrastructure,
and it's nowhere near general yet.
If you don't copy /var/lib/rpm to var/lib/rpm, you'll get all kinds of
complaints about things missing. Copying the rpm databases fools it into
thinking your system has them installed. (Actually, your system DOES have
them installed, but rpm at that point is thinking "things inside this --root
directory"). You could, of course, truly install all those packages, but
you'd essentially be building a whole new system to test this rpm with.
This isn't that far short of that (or wouldn't be if I finished fleshing it
out). I'm not real crazy about doing rpm commands, as root, for a target
system on my real system, though.
Anybody got a better way?