yum安装软件包失败的排错过程

安装 docker-ce 时, 依赖安装 libcgroup 失败

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Total download size: 65 k
Installed size: 130 k
Is this ok [y/d/N]: y
Downloading packages:
libcgroup-0.41-15.el7.x86_64.rpm | 65 kB 00:00:00
Member: libcgroup.x86_64 0:0.41-15.el7 - u
Adding Package libcgroup-0.41-15.el7.x86_64 in mode u
Running transaction check
Transaction check time: 0.108
Running transaction test
Transaction test succeeded
Transaction test time: 0.069
Running transaction
groupadd: cannot open /etc/group
error: %pre(libcgroup-0.41-15.el7.x86_64) scriptlet failed, exit status 10
Error in PREIN scriptlet in rpm package libcgroup-0.41-15.el7.x86_64
Warning: scriptlet or other non-fatal errors occurred during transaction.
Verifying : libcgroup-0.41-15.el7.x86_64 1/1
What is this? libcgroup-0.41-15.el7.x86_64
VerifyTransaction time: 0.003
Transaction time: 0.810

Failed:
libcgroup.x86_64 0:0.41-15.el7

看到报错信息groupadd: cannot open /etc/group, 安装程序操作了这个文件, 但是报这个文件不可访问的错误

实际检查中, 该文件已经存在

将安装包单独下载下来, 手动安装查看详细操作

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
yum install --downloadonly libcgroup
Loaded plugins: fastestmirror, langpacks, priorities
Loading mirror speeds from cached hostfile
* elrepo: mirrors.neusoft.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package libcgroup.x86_64 0:0.41-15.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================
Package Arch Version Repository Size
==================================================================================================================================================================
Installing:
libcgroup x86_64 0.41-15.el7 base 65 k

Transaction Summary
==================================================================================================================================================================
Install 1 Package

Total download size: 65 k
Installed size: 130 k
Background downloading packages, then exiting:
libcgroup-0.41-15.el7.x86_64.rpm | 65 kB 00:00:00
exiting because "Download Only" specified

找到文件位置

1
2
find / -name "libcgroup-0.41-15.el7.x86_64.rpm" -type f
/var/cache/yum/x86_64/7/base/packages/libcgroup-0.41-15.el7.x86_64.rpm

手动安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
rpm -ivvvh /var/cache/yum/x86_64/7/base/packages/libcgroup-0.41-15.el7.x86_64.rpm
D: ============== /var/cache/yum/x86_64/7/base/packages/libcgroup-0.41-15.el7.x86_64.rpm
D: loading keyring from pubkeys in /var/lib/rpm/pubkeys/*.key
D: couldn't find any keys in /var/lib/rpm/pubkeys/*.key
D: loading keyring from rpmdb
D: opening db environment /var/lib/rpm cdb:0x401
D: opening db index /var/lib/rpm/Packages 0x400 mode=0x0
D: locked db index /var/lib/rpm/Packages
D: opening db index /var/lib/rpm/Name 0x400 mode=0x0
D: read h# 671 Header SHA1 digest: OK (6c239af7e9e88852422394529fbf054ef1cd4921)
D: added key gpg-pubkey-baadae52-49beffa4 to keyring
D: Using legacy gpg-pubkey(s) from rpmdb
D: Expected size: 66752 = lead(96)+sigs(1284)+pad(4)+data(65368)
D: Actual size: 66752
warning: /var/cache/yum/x86_64/7/base/packages/libcgroup-0.41-15.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
D: added binary package [0]
D: found 0 source and 1 binary packages
D: opening db index /var/lib/rpm/Conflictname 0x400 mode=0x0
D: ========== +++ libcgroup-0.41-15.el7 x86_64/linux 0x2
D: opening db index /var/lib/rpm/Basenames 0x400 mode=0x0
D: read h# 606 Header SHA1 digest: OK (83b77b161083033277b34d5b3705b5e3a2a52ab3)
D: Requires: /bin/sh YES (db files)
D: Requires: /bin/sh YES (cached)
D: read h# 36 Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
D: Requires: /sbin/ldconfig YES (db files)
D: Requires: /sbin/ldconfig YES (cached)
D: opening db index /var/lib/rpm/Providename 0x400 mode=0x0
D: read h# 36 Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
D: Requires: ld-linux-x86-64.so.2()(64bit) YES (db provides)
D: read h# 36 Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
D: Requires: ld-linux-x86-64.so.2(GLIBC_2.3)(64bit) YES (db provides)
D: read h# 36 Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
D: Requires: libc.so.6()(64bit) YES (db provides)
D: read h# 36 Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
D: Requires: libc.so.6(GLIBC_2.11)(64bit) YES (db provides)
D: read h# 36 Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
D: Requires: libc.so.6(GLIBC_2.14)(64bit) YES (db provides)
D: read h# 36 Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
D: Requires: libc.so.6(GLIBC_2.2.5)(64bit) YES (db provides)
D: read h# 36 Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
D: Requires: libc.so.6(GLIBC_2.3)(64bit) YES (db provides)
D: read h# 36 Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
D: Requires: libc.so.6(GLIBC_2.3.4)(64bit) YES (db provides)
D: read h# 36 Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
D: Requires: libc.so.6(GLIBC_2.4)(64bit) YES (db provides)
D: read h# 36 Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
D: Requires: libc.so.6(GLIBC_2.8)(64bit) YES (db provides)
D: read h# 36 Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
D: Requires: libpthread.so.0()(64bit) YES (db provides)
D: read h# 36 Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
D: Requires: libpthread.so.0(GLIBC_2.2.5)(64bit) YES (db provides)
D: Requires: rpmlib(CompressedFileNames) <= 3.0.4-1 YES (rpmlib provides)
D: Requires: rpmlib(FileDigests) <= 4.6.0-1 YES (rpmlib provides)
D: Requires: rpmlib(PayloadFilesHavePrefix) <= 4.0-1 YES (rpmlib provides)
D: read h# 36 Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
D: Requires: rtld(GNU_HASH) YES (db provides)
D: read h# 344 Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
D: Requires: shadow-utils YES (db provides)
D: read h# 365 Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
D: Requires: systemd YES (db provides)
D: Requires: systemd YES (cached)
D: Requires: systemd YES (cached)
D: Requires: rpmlib(PayloadIsXz) <= 5.2-1 YES (rpmlib provides)
D: opening db index /var/lib/rpm/Obsoletename 0x400 mode=0x0
D: ========== recording tsort relations
D: ========== tsorting packages (order, #predecessors, #succesors, depth)
D: 0 0 0 1 +libcgroup-0.41-15.el7.x86_64
D: installing binary packages
D: Selinux disabled.
D: closed db index /var/lib/rpm/Obsoletename
D: closed db index /var/lib/rpm/Conflictname
D: closed db index /var/lib/rpm/Providename
D: closed db index /var/lib/rpm/Basenames
D: closed db index /var/lib/rpm/Name
D: closed db index /var/lib/rpm/Packages
D: closed db environment /var/lib/rpm
D: opening db environment /var/lib/rpm cdb:0x401
D: opening db index /var/lib/rpm/Packages (none) mode=0x42
D: sanity checking 1 elements
D: opening db index /var/lib/rpm/Name (none) mode=0x42
D: running pre-transaction scripts
D: computing 5 file fingerprints
D: opening db index /var/lib/rpm/Basenames (none) mode=0x42
D: opening db index /var/lib/rpm/Group (none) mode=0x42
D: opening db index /var/lib/rpm/Requirename (none) mode=0x42
D: opening db index /var/lib/rpm/Providename (none) mode=0x42
D: opening db index /var/lib/rpm/Conflictname (none) mode=0x42
D: opening db index /var/lib/rpm/Obsoletename (none) mode=0x42
D: opening db index /var/lib/rpm/Triggername (none) mode=0x42
D: opening db index /var/lib/rpm/Dirnames (none) mode=0x42
D: opening db index /var/lib/rpm/Installtid (none) mode=0x42
D: opening db index /var/lib/rpm/Sigmd5 (none) mode=0x42
D: opening db index /var/lib/rpm/Sha1header (none) mode=0x42
Preparing... D: computing file dispositions
D: 0x00000803 4096 72372888 146033401 /
################################# [100%]
D: ========== +++ libcgroup-0.41-15.el7 x86_64-linux 0x2
D: Expected size: 66752 = lead(96)+sigs(1284)+pad(4)+data(65368)
D: Actual size: 66752
D: libcgroup-0.41-15.el7.x86_64: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
D: install: libcgroup-0.41-15.el7 has 5 files
D: %pre(libcgroup-0.41-15.el7.x86_64): scriptlet start
D: %pre(libcgroup-0.41-15.el7.x86_64): execv(/bin/sh) pid 43192
+ getent group cgred
+ groupadd -r cgred
groupadd: cannot open /etc/group
D: %pre(libcgroup-0.41-15.el7.x86_64): waitpid(43192) rc 43192 status a00
error: %pre(libcgroup-0.41-15.el7.x86_64) scriptlet failed, exit status 10
error: libcgroup-0.41-15.el7.x86_64: install failed
D: running post-transaction scripts
D: closed db index /var/lib/rpm/Sha1header
D: closed db index /var/lib/rpm/Sigmd5
D: closed db index /var/lib/rpm/Installtid
D: closed db index /var/lib/rpm/Dirnames
D: closed db index /var/lib/rpm/Triggername
D: closed db index /var/lib/rpm/Obsoletename
D: closed db index /var/lib/rpm/Conflictname
D: closed db index /var/lib/rpm/Providename
D: closed db index /var/lib/rpm/Requirename
D: closed db index /var/lib/rpm/Group
D: closed db index /var/lib/rpm/Basenames
D: closed db index /var/lib/rpm/Name
D: closed db index /var/lib/rpm/Packages
D: closed db environment /var/lib/rpm

可以看到, 在安装的过程中, 是执行了groupadd -r cgred导致的报错

手动执行 groupadd -r cgred, 依然报错 groupadd: cannot open /etc/group

查看文件属性

lsattr /etc/group
—-i———– /etc/group

原来是有特殊权限, 修改他

chattr -i /etc/group