简体   繁体   English

RPM 无法遵循安装时的依赖顺序

[英]RPM fails to follow dependency order on install

I'm trying to force rpm to follow a given install order and it is not working as expected.我试图强制rpm遵循给定的安装顺序,但它没有按预期工作。 The Requires clause I added is not being respected.我添加的Requires条款没有得到尊重。

I am doing a bare-metal Linux installer (openSUSE 42.2-based).我正在做一个裸机 Linux 安装程序(基于 openSUSE 42.2)。 A whole system -- hundreds of packages -- are installed with one RPM command (using --root ).一个完整的系统——数百个软件包——是用一个 RPM 命令(使用--root )安装的。 I am having problems with three packages -- pam-config, pam-script, and openssh.我在使用三个包时遇到问题——pam-config、pam-script 和 openssh。 The pam-config %post scriptlet tries to modify files contained in pam-script and openssh but is installed, by default, before them. pam-config %post scriptlet 尝试修改包含在 pam-script 和 openssh 中的文件,但默认情况下安装在它们之前。 It does not have dependencies by default, so, having the source, I rectified that by adding:默认情况下它没有依赖项,因此,有了源代码,我通过添加以下内容来纠正它:

Requires: pam-script
Requires: openssh

to pam-config.spec .pam-config.spec (I also tried Prereq: with same results.) As expected, with this change, it switches the ordering for pam-script and that error goes away. (我也试过Prereq:有相同的结果。)正如预期的那样,通过这个更改,它切换了 pam-script 的顺序,并且该错误消失了。 But it steadfastly refuses to change the order of installation for openssh, which is installed two packages after pam-config.但是它坚决拒绝改变openssh的安装顺序,它是在pam-config之后安装了两个包。 [Openssh is dependent on coreutils and shadow (pwdutil), both of which are already installed at this point. 【Openssh 依赖于 coreutils 和 shadow (pwdutil),这两个此时都已经安装好了。 It's also dependent ( PreReq ) on a mysterious macro, %{fillup_prereq} .]它也依赖于( PreReq )一个神秘的宏, %{fillup_prereq} 。]

Everything else installs (and runs) just fine, but I would like to understand better how rpm works.其他一切都安装(并运行)得很好,但我想更好地了解rpm工作原理。 I thought if I used Required: to specify openssh in pam-config, that openssh would invariably be installed before pam-config.我想如果我使用Required:在pam-config 中指定openssh,那么openssh 总是会在pam-config 之前安装。 It worked for pam-script.它适用于 pam-script。

rpm -qp --requires on the .rpm file shows openssh. .rpm文件上的rpm -qp --requires显示 openssh。 I repeated the install with the -vv option instead of -v .我使用-vv选项而不是-v重复安装。 I can see the Requires: for openssh listed just the same as pam-script ( YES (added provide) ).我可以看到Requires: for openssh 与 pam-script 列出的一样( YES (added provide) )。 I see a pam-config-0.91xxx -> openssh-7.2p2xxx listed under SCC #8: 11 members (100 external dependencies) .我看到一个pam-config-0.91xxx -> openssh-7.2p2xxx列在SCC #8: 11 members (100 external dependencies) I see the install of pam-config, which has no dependency information and nothing remarkable except for the %post scriptlet command that generates the error ( pam-config --service sshd --delete --listfile ).我看到了 pam-config 的安装,它没有任何依赖信息,除了生成错误的%post scriptlet 命令( pam-config --service sshd --delete --listfile )之外没有什么pam-config --service sshd --delete --listfile What other kind of things should I be looking at to debug this?我应该查看哪些其他类型的东西来调试它? What are these SCCs?这些 SCC 是什么? Am I missing something about Requires ?我是否缺少有关Requires Or is there something obscure I may have overlooked, like circular, indirect, or hidden dependencies (I've checked for that, but ruled it out)?或者我可能忽略了一些晦涩的东西,比如循环、间接或隐藏的依赖关系(我已经检查过,但排除了它)? I've looked at several RPM tutorials and done a number of web searches and come up empty.我查看了几个 RPM 教程并进行了大量网络搜索,但结果都是空的。

UPDATE : It appears that unlike pam-script, openssh is caught up in a mutual-dependency critical section.更新:似乎与 pam-script 不同,openssh 陷入了相互依赖的临界区。 Here is the order of the packages actually being installed:以下是实际安装的软件包的顺序:

ruby2.1-rubygem-ruby-dbus-0.9.3-4.3.x86_64.rpm
pam-script-1.1.6-1.os42.gb01.x86_64.rpm
suse-module-tools-12.4-3.2.x86_64.rpm
kmod-17-6.2.x86_64.rpm
kmod-compat-17-6.2.x86_64.rpm
libcurl4-7.37.0-15.1.x86_64.rpm
pam-config-0.91-1.2.os42.gb01.x86_64.rpm
systemd-sysvinit-228-15.1.x86_64.rpm
krb5-1.12.5-5.13.x86_64.rpm
openssh-7.2p2-6.1.SBC.os42.gb01.x86_64.rpm
dracut-044-12.1.x86_64.rpm
systemd-228-15.1.x86_64.rpm

If I stage an installation on a production system and stop just before pam-config, it complains about being dependent on krb5, which is in the future!如果我在生产系统上进行安装并在 pam-config 之前停止,它会抱怨依赖于将来的 krb5! If I stop at ruby, it works.如果我停在 ruby​​ 上,它会起作用。 If I stop at pam-script, it works.如果我停在 pam-script 上,它会起作用。 If I stop at suse-module-tools, it complains about dependencies on dracut.如果我停留在 suse-module-tools,它会抱怨对 dracut 的依赖。 So I'm wondering if RPM abandons its ordering principle within a mutual-dependency critical section, or if there is a dependency I haven't uncovered yet.所以我想知道 RPM 是否在相互依赖的临界区中放弃了它的排序原则,或者是否存在我尚未发现的依赖关系。 I am using rpm -q --requires and rpm -q --provides to work this out.我正在使用rpm -q --requiresrpm -q --provides来解决这个问题。 Stay tuned.敬请关注。

You can add more explicit sub-fields to the Requires tag, eg Requires(post): openssh-server or Requires(pre,post): openssh-server .您可以向Requires标签添加更明确的子字段,例如Requires(post): openssh-serverRequires(pre,post): openssh-server

A single RPM transaction isn't really atomic, but is treated that way.单个 RPM 事务并不是真正的原子,而是以这种方式处理的。 Without this additional information, it just ensures that the packages are installed by the end of this transaction , which is "good enough" most of the time.如果没有这些附加信息,它只会确保在此事务结束时安装软件包,这在大多数情况下“足够好”。

Another option is to put the required configuration into a %triggerin stanza, which I believe only executes once both packages are installed.另一种选择是将所需的配置放入%triggerin节,我相信只有在安装了两个软件包后才会执行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM