怎么装rpm?

linux_base-fc-4_9中的rpm似乎有点问题。我安装过后,chroot到
/usr/compat/linux,但是运行rpm的时候会提示
sh-3.00# rpm
rpm: error while loading shared libraries: librpm-4.4.so: cannot open
shared object file: No such file or directory
我把fc4的rpm-4.4.1-23.i386.rpm包解压缩来看,发现的确找不到这个so.
用ldd查看,
librpm-4.4.so => not found
librpmdb-4.4.so => not found
哎。。。。。。。。。。。。
sh-3.00# rpm
ELF binary type "0" not known.
sh: /bin/rpm: cannot execute binary file
sh-3.00# rpm
error: Unable to open /usr/lib/rpm/rpmrc for reading: No such file or
directory.
然后手动把*.so和rpmrc copy过去。
sh-3.00# rpm
RPM version 4.1
Copyright (C) 1998-2002 - Red Hat, Inc.
This program may be freely redistributed under the terms of the GNU GPL
Usage: rpm [-a|--all] [-f|--file] [-g|--group] [-p|--package]
[--specfile]
[--whatrequires] [--whatprovides] [-c|--configfiles]
[-d|--docfiles]
[--dump] [-l|--list] [--queryformat=QUERYFORMAT] [-s|--state]
[--nomd5] [--nofiles] [--nodeps] [--noscript] [--addsign]
[-K|--checksig] [--import] [--resign] [--nodigest]
[--nosignature]
[--initdb] [--rebuilddb] [--allfiles] [--allmatches]
[--badreloc]
[-e|--erase \+] [--excludedocs]
[--excludepath=\]
[--force] [-F|--freshen \+] [-h|--hash]
[--ignorearch]
[--ignoreos] [--ignoresize] [-i|--install] [--justdb] [--nodeps]
[--nomd5] [--noorder] [--nosuggest] [--noscripts] [--notriggers]
[--oldpackage] [--percent] [--prefix=\]
[--relocate=\=\]
[--repackage] [--replacefiles] [--replacepkgs] [--test]
[-U|--upgrade \+] [-D|--define 'MACRO EXPR']
[-E|--eval 'EXPR'] [--macros=\] [--nodigest]
[--nosignature]
[--rcfile=\] [-r|--root ROOT] [--querytags]
[--showrc]
[--quiet] [-v|--verbose] [--version] [-?|--help] [--usage]
哈哈,只能说一句,thanks goodness.
sh-3.00# rpm -qa
error: cannot open Packages database in /var/lib/rpm
no packages
sh-3.00# rpm --rebuilddb
error: unrecognized db option: "db3" ignored.
error: cannot open Packages index
看来事情还没有完
原来是文件没有copy完,rpmpopt-4.1没有copy过去。顺手,把rpmi,rpmv等也copy过去了。
sh-3.00# rpm --rebuilddb
/usr/lib/rpm/rpmd: error while loading shared libraries: libelf.so.0:
cannot open shared object file: No such file or directory
原来是依赖libelf,而我还没有安装。(FC4下没有这个库)
ok,继续 copy
sh-3.00# rpm --rebuilddb
sh-3.00# rpm -qa
一切正常。
然后我想用rpm装rpm
然后就进入地狱般的依赖关系
sh-3.00# rpm -i glibc-2.3.6-3.i386.rpm
warning: glibc-2.3.6-3.i386.rpm: V3 DSA signature: NOKEY, key ID
4f2a6fd2
error: Failed dependencies:
glibc-common = 2.3.6-3 is needed by glibc-2.3.6-3
basesystem is needed by glibc-2.3.6-3
libgcc is needed by glibc-2.3.6-3
sh-3.00# rpm -i glibc-common-2.3.6-3.i386.rpm
warning: glibc-common-2.3.6-3.i386.rpm: V3 DSA signature: NOKEY, key ID
4f2a6fd2
error: Failed dependencies:
tzdata >= 2003a is needed by glibc-common-2.3.6-3
sh-3.00# rpm -i --nodeps glibc-2.3.6-3.i386.rpm
warning: glibc-2.3.6-3.i386.rpm: V3 DSA signature: NOKEY, key ID
4f2a6fd2
warning: /etc/ld.so.conf created as /etc/ld.so.conf.rpmnew
warning: /etc/nsswitch.conf created as /etc/nsswitch.conf.rpmnew
warning: /etc/rpc saved as /etc/rpc.rpmorig
warning: /usr/lib/gconv/gconv-modules created as
/usr/lib/gconv/gconv-modules.rpmnew
ELF binary type "0" not known.
error: %post(glibc-2.3.6-3) scriptlet failed, exit status 255
错误出在了对elf文件的类型的判别上。好吧,那就用sysctl设置一下
sysctl kern.elf32.fallback_brand=3
然后继续安装
sh-3.00# rpm -i --nodeps glibc-common-2.3.6-3.i386.rpm
warning: glibc-common-2.3.6-3.i386.rpm: V3 DSA signature: NOKEY, key ID
4f2a6fd2
warning: /etc/default/nss created as /etc/default/nss.rpmnew
sh-3.00# rpm -qa
glibc-common-2.3.6-3
非常成功
但是装filesystem的时候遇到一个问题
sh-3.00# rpm -i filesystem-2.3.4-1.i386.rpm
warning: filesystem-2.3.4-1.i386.rpm: V3 DSA signature: NOKEY, key ID
4f2a6fd2
warning: group lock does not exist - using root
warning: group mail does not exist - using root
error: unpacking of archive failed on file /proc: cpio: chown failed -
Operation not supported
不知道该怎么办,算了,用force强制安装 rpm-4.1-1.06.i386.rpm
发现rpm的一个巧妙之处。
sh-3.00# rm -i setserial-2.17-19.i386.rpm
rm:是否删除一般文件‘setserial-2.17-19.i386.rpm’? n
我不小心把rpm写成了rm,幸好啊,幸好啊,rm -i的参数-i的特殊含义。不知道是这是巧合,还是有意设计的。

此博客中的热门博文

少写代码,多读别人写的代码

在windows下使用llvm+clang

tensorflow distributed runtime初窥