RHEL6.5 的yum不可用問題處理解決

說明:RHEL6.5 配置yum源後可以使用yum安裝軟件,但是隻執行yum命令後提示如下錯誤信息

0.查看之前安裝yum軟件包
[root@dbserver ~]# rpm -qa |grep yum
yum-3.2.29-40.el6.noarch
PackageKit-yum-plugin-0.5.8-21.el6.x86_64
yum-utils-1.1.30-14.el6.noarch
yum-plugin-security-1.1.30-14.el6.noarch
PackageKit-yum-0.5.8-21.el6.x86_64
yum-rhn-plugin-0.9.1-48.el6.noarch
yum-metadata-parser-1.1.2-16.el6.x86_64
[root@dbserver ~]#

1.使用yum安裝telnet軟件
[root@dbserver ~]# yum install telnet
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package telnet.x86_64 1:0.17-47.el6_3.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================
Package Arch Version Repository Size

Installing:
telnet x86_64 1:0.17-47.el6_3.1 base 58 k

Transaction Summary

Install 1 Package(s)

Total download size: 58 k
Installed size: 109 k
Is this ok [y/N]: y
Downloading Packages:
telnet-0.17-47.el6_3.1.x86_64.rpm | 58 kB 00:04
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 1:telnet-0.17-47.el6_3.1.x86_64 1/1
Verifying : 1:telnet-0.17-47.el6_3.1.x86_64 1/1

Installed:
telnet.x86_64 1:0.17-47.el6_3.1

Complete!

2.單獨執行yum命令
[root@dbserver ~]# yum
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
You need to give some command
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in <module>
yummain.user_main(sys.argv[1:], exit_code=True)
File "/usr/share/yum-cli/yummain.py", line 285, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 105, in main
base.getOptionsConfig(args)
File "/usr/share/yum-cli/cli.py", line 310, in getOptionsConfig
self.parseCommands() # before we return check over the base command + args
File "/usr/share/yum-cli/cli.py", line 333, in parseCommands
self.usage()
File "/usr/share/yum-cli/cli.py", line 1340, in usage
sys.stdout.write(self.optparser.format_help())
File "/usr/lib64/python2.6/optparse.py", line 1641, in format_help
result.append(self.get_usage() + "\n")
File "/usr/lib64/python2.6/optparse.py", line 1583, in get_usage
self.expand_prog_name(self.usage))
File "/usr/lib64/python2.6/optparse.py", line 374, in formatusage
return
("Usage: %s\n") % usage
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in range(128)
[root@dbserver ~]#

3.處理方法:
[root@dbserver ~]# cd /var/lib/rpm/
[root@dbserver rpm]# ll
總用量 78136
-rw-r--r--. 1 root root 5517312 12月 23 14:02 Basenames
-rw-r--r--. 1 root root 12288 12月 23 13:56 Conflictname
-rw-r--r-- 1 root root 24576 12月 23 14:03 db.001
-rw-r--r-- 1 root root 229376 12月 23 14:03
db.002
-rw-r--r-- 1 root root 1318912 12月 23 14:03 db.003
-rw-r--r-- 1 root root 753664 12月 23 14:03
db.004
-rw-r--r--. 1 root root 1675264 12月 23 14:02 Dirnames
-rw-r--r--. 1 root root 10510336 12月 23 14:02 Filedigests
-rw-r--r--. 1 root root 24576 12月 23 14:02 Group
-rw-r--r--. 1 root root 20480 12月 23 14:02 Installtid
-rw-r--r--. 1 root root 90112 12月 23 14:02 Name
-rw-r--r--. 1 root root 24576 12月 14 14:11 Obsoletename
-rw-r--r--. 1 root root 60338176 12月 23 14:02 Packages
-rw-r--r--. 1 root root 1327104 12月 23 14:02 Providename
-rw-r--r--. 1 root root 684032 12月 23 14:02 Provideversion
-rw-r--r--. 1 root root 12288 12月 23 13:56 Pubkeys
-rw-r--r--. 1 root root 454656 12月 23 14:02 Requirename
-rw-r--r--. 1 root root 282624 12月 23 14:02 Requireversion
-rw-r--r--. 1 root root 176128 12月 23 14:02 Sha1header
-rw-r--r--. 1 root root 90112 12月 23 14:02 Sigmd5
-rw-r--r--. 1 root root 12288 12月 14 13:58 Triggername
[root@dbserver rpm]# **rm -i db.***
rm:是否刪除普通文件 "db.001"?y
rm:是否刪除普通文件 "
db.002"?y
rm:是否刪除普通文件 "db.003"?y
rm:是否刪除普通文件 "
db.004"?y
[root@dbserver rpm]# rpm --rebuilddb
[root@dbserver rpm]# cd /soft
[root@dbserver soft]# ll
總用量 19904
-rw-r--r-- 1 root root 1565384 12月 23 13:56 openssh-7.9p1.tar.gz
-rw-r--r-- 1 root root 5338192 12月 23 13:56 openssl-1.0.2p.tar.gz
-rw-r--r-- 1 root root 2081413 12月 23 13:56 pcre-8.42.tar.gz
-rw-r--r--. 1 root root 183811 12月 14 14:14 pdksh-5.2.14-8.i386.rpm
drwxrwxr-x. 8 oracle dba 4096 12月 14 15:59 rlwrap-0.37
-rw-r--r--. 1 root root 251438 12月 14 15:58 rlwrap-0.37.tar.gz
-rwxr-xr-x 1 root root 2372 12月 23 13:57 update.sh
-rw-r--r-- 1 root root 1044832 12月 23 14:06 yum-3.2.29-81.el6.noarch.rpm
-rw-r--r-- 1 root root 27240 12月 23 14:06 yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
-rw-r--r-- 1 root root 607698 12月 23 13:56 zlib-1.2.11.tar.gz
-rw-r--r--. 1 root root 9249332 12月 14 14:12 zysong.ttf
[root@dbserver soft]#
安裝如下兩個文件:
[root@dbserver ~]# rpm -ivh --force yum-3.2.29-81.el6.noarch.rpm yum-metadata-parser-1.1.2-16.el6.x86_64.rpm --nodeps
warning: yum-3.2.29-81.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:yum-metadata-parser ########################################### [ 50%]
2:yum ########################################### [100%]
[root@dbserver ~]# yum clean all
已加載插件:product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: base extras updates
清理一切

4.再次執行yum命令,提示正常
[root@dbserver ~]# yum
已加載插件:product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
你需要給出命令
Usage: yum [options] COMMAND

List of Commands:

check Check for problems in the rpmdb
check-update 檢查是否有軟件包更新
clean 刪除緩存的數據
deplist 列出軟件包的依賴關係
distribution-synchronization Synchronize installed packages to the latest available versions
downgrade downgrade a package
erase 從系統中移除一個或多個軟件包
groupinfo 顯示組的詳細信息
groupinstall 向系統中安裝一組軟件包
grouplist 列出可安裝的組
groupremove 從系統中移除一組軟件包
help 顯示用法信息
history Display, or use, the transaction history
info 顯示關於軟件包或組的詳細信息
install 向系統中安裝一個或多個軟件包
list 列出一個或一組軟件包
load-transaction load a saved transaction from filename
makecache 創建元數據緩存
provides 查找提供指定內容的軟件包
reinstall 覆蓋安裝一個包
repolist 顯示已配置的倉庫
resolvedep 判斷哪個包提供了指定的依賴
search 在軟件包詳細信息中搜索指定字符串
shell 運行交互式的 yum 外殼
update 更新系統中的一個或多個軟件包
update-minimal Works like update, but goes to the 'newest' package match which fixes a problem that affects your system
updateinfo Acts on repository update information
upgrade 更新軟件包同時考慮軟件包取代關係
version Display a version for the machine and/or available repos.

Options:
-h, --help show this help message and exit
-t, --tolerant 容忍錯誤
-C, --cacheonly run entirely from system cache, don't update cache
-c [config file], --config=[config file]
配置文件路徑
-R [minutes], --randomwait=[minutes]
命令最長等待時間
-d [debug level], --debuglevel=[debug level]
調試輸出級別
--showduplicates 在 list/search 命令下,顯示倉庫裏重複的條目。
-e [error level], --errorlevel=[error level]
錯誤輸出級別
--rpmverbosity=[debug level name]
debugging output level for rpm
-q, --quiet 安靜的操作
-v, --verbose verbose operation
-y, --assumeyes 回答所有的問題爲是
--assumeno answer no for all questions
--version 顯示 Yum 版本信息並退出
--installroot=[path] 設置目標根目錄
--enablerepo=[repo] 啓用一個或多個倉庫(支持通配符)
--disablerepo=[repo] 禁用一個或多個倉庫(支持通配符)
-x [package], --exclude=[package]
用全名或通配符排除軟件包
--disableexcludes=[repo]
禁止從主配置,從倉庫或者從任何位置排除
--obsoletes 升級時考慮軟件包取代關係
--noplugins 禁用 Yum 插件
--nogpgcheck 禁用 gpg 簽名檢測
--disableplugin=[plugin]
禁用指定名稱的插件
--enableplugin=[plugin]
enable plugins by name
--skip-broken 跳過有依賴問題的軟件包
--color=COLOR 配置是否使用顏色
--releasever=RELEASEVER
set value of $releasever in yum config and repo files
--downloadonly don't update, just download
--downloaddir=DLDIR specifies an alternate directory to store packages
--setopt=SETOPTS set arbitrary config and repo options

插件選項:
--security Include security relevant packages
--bugfixes Include bugfix relevant packages
--cve=CVE Include packages needed to fix the given CVE
--bz=BZ Include packages needed to fix the given BZ
--sec-severity=SEVERITY
Include security relevant packages, of this severity
--advisory=ADVISORY
Include packages needed to fix the given advisory
[root@dbserver ~]#

5.yum安裝軟件
[root@dbserver ~]# yum install gcc
已加載插件:product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
設置安裝進程
base | 3.7 kB 00:00
base/primary_db | 4.4 MB 00:55
extras | 2.9 kB 00:00
extras/primary_db | 19 kB 00:00
updates | 2.9 kB 00:00
updates/primary_db | 5.9 MB 01:08
包 gcc-4.4.7-4.el6.x86_64 已安裝並且是最新版本
無須任何處理
[root@dbserver ~]#

6.查看現在安裝的yum包
[root@dbserver soft]# rpm -qa |grep yum
yum-plugin-security-1.1.30-14.el6.noarch
yum-rhn-plugin-0.9.1-48.el6.noarch
PackageKit-yum-0.5.8-21.el6.x86_64
PackageKit-yum-plugin-0.5.8-21.el6.x86_64
yum-metadata-parser-1.1.2-16.el6.x86_64
yum-3.2.29-81.el6.noarch
yum-3.2.29-40.el6.noarch
yum-utils-1.1.30-14.el6.noarch
[root@dbserver soft]#
[root@dbserver ~]# yum --version
3.2.29
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Installed: rpm-4.8.0-37.el6.x86_64 at 2017-12-14 13:29
Built : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla&gt; at 2013-09-12 10:55
Committed: Panu Matilainen <[email protected]> at 2013-09-12

Installed: subscription-manager-1.9.11-1.el6.x86_64 at 2017-12-14 13:32
Built : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla&gt; at 2013-10-16 20:52
Committed: jesus m. rodriguez <[email protected]> at 2013-10-16

Installed: yum-3.2.29-81.el6.noarch at 2017-12-23 06:07
Built : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla&gt; at 2016-12-07 10:37
Committed: Valentina Mukhamedzhanova <[email protected]> at 2016-12-07
You have new mail in /var/spool/mail/root
[root@dbserver ~]#

7.執行yum update後提示如下:
問題:
--> 完成依賴關係計算
錯誤:ksh conflicts with pdksh-5.2.14-8.i386
You could try using --skip-broken to work around the problem
** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows:
ksh-20120801-10.el6.x86_64 has installed conflicts pdksh: pdksh-5.2.14-8.i386
yum-3.2.29-81.el6.noarch has missing requires of python-urlgrabber >= ('0', '3.9.1', '10')

分析:
根據提示需要安裝python-urlgrabber的版本大於3.9.1.10.
查看當前系統的python-urlgrabber版本
[root@dbserver ~]# rpm -qa |grep python-urlgrabber
python-urlgrabber-3.9.1-9.el6.noarch
[root@dbserver ~]#
升級安裝更高版本的python-urlgrabber
[root@dbserver soft]# yum install python-urlgrabber-3.9.1-11.el6.noarch.rpm
已加載插件:product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
設置安裝進程
診斷 python-urlgrabber-3.9.1-11.el6.noarch.rpm: python-urlgrabber-3.9.1-11.el6.noarch
python-urlgrabber-3.9.1-11.el6.noarch.rpm 將作爲 python-urlgrabber-3.9.1-9.el6.noarch 的更新
解決依賴關係
--> 執行事務檢查
---> Package python-urlgrabber.noarch 0:3.9.1-9.el6 will be 升級
---> Package python-urlgrabber.noarch 0:3.9.1-11.el6 will be an update
--> 完成依賴關係計算

依賴關係解決

============================================================================================================================================================
軟件包 架構 版本 倉庫 大小

正在升級:
python-urlgrabber noarch 3.9.1-11.el6 /python-urlgrabber-3.9.1-11.el6.noarch 316 k

事務概要

Upgrade 1 Package(s)

總文件大小:316 k
確定嗎?[y/N]:y
下載軟件包:
運行 rpm_check_debug
執行事務測試
事務測試成功
執行事務
正在升級 : python-urlgrabber-3.9.1-11.el6.noarch 1/2
清理 : python-urlgrabber-3.9.1-9.el6.noarch 2/2
Verifying : python-urlgrabber-3.9.1-11.el6.noarch 1/2
Verifying : python-urlgrabber-3.9.1-9.el6.noarch 2/2

更新完畢:
python-urlgrabber.noarch 0:3.9.1-11.el6

完畢!
[root@dbserver soft]# rpm -qa |grep python-urlgrabber
python-urlgrabber-3.9.1-11.el6.noarch
[root@dbserver soft]#

[root@dbserver soft]# yum version
已加載插件:product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Installed: 6Server/x86_64 1547:6e0f44b505b273501b4ff684b93334e8f53347ff
Group-Installed: yum 15:a19b761ff479b73d703258c649352f7ca61f4c0e
version
[root@dbserver soft]#

[root@dbserver soft]# yum --version
3.2.29
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Installed: rpm-4.8.0-37.el6.x86_64 at 2017-12-14 13:29
Built : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla&gt; at 2013-09-12 10:55
Committed: Panu Matilainen <[email protected]> at 2013-09-12

Installed: subscription-manager-1.9.11-1.el6.x86_64 at 2017-12-14 13:32
Built : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla&gt; at 2013-10-16 20:52
Committed: jesus m. rodriguez <[email protected]> at 2013-10-16

Installed: yum-3.2.29-81.el6.noarch at 2017-12-23 06:07
Built : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla&gt; at 2016-12-07 10:37
Committed: Valentina Mukhamedzhanova <[email protected]> at 2016-12-07
[root@dbserver soft]#

問題2:執行yum update的問題
--> 完成依賴關係計算
錯誤:ksh conflicts with pdksh-5.2.14-8.i386
You could try using --skip-broken to work around the problem
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
ksh-20120801-10.el6.x86_64 has installed conflicts pdksh: pdksh-5.2.14-8.i386
分析:ksh-20120801-10.el6.x86_64已經安裝並且和pdksh-5.2.14-8.i386有衝突
解決:刪除ksh-20120801-10.el6.x86_64或pdksh-5.2.14-8.i386然後再次執行yum update即可
[root@dbserver soft]# rpm -e pdksh-5.2.14-8.i386
[root@dbserver soft]# rpm -qa |grep ksh
ksh-20120801-10.el6.x86_64
[root@dbserver soft]# yum update
事務概要

Install 3 Package(s)
Upgrade 229 Package(s)

總下載量:377 M
確定嗎?[y/N]:y
下載軟件包:
(1/232): abrt-2.0.8-21.el6.centos.x86_64.rpm | 208 kB 00:01
(2/232): abrt-addon-ccpp-2.0.8-21.el6.centos.x86_64.rpm | 116 kB 00:05
(3/232): abrt-addon-kerneloops-2.0.8-21.el6.centos.x86_64.rpm | 65 kB 00:01
(4/232): abrt-addon-python-2.0.8-21.el6.centos.x86_64.rpm | 65 kB 00:01
(5/232): abrt-cli-2.0.8-21.el6.centos.x86_64.rpm | 54 kB 00:01
(6/232): abrt-desktop-2.0.8-21.el6.centos.x86_64.rpm | 54 kB 00:02
(7/232): abrt-gui-2.0.8-21.el6.centos.x86_64.rpm | 150 kB 00:07
(8/232): abrt-libs-2.0.8-21.el6.centos.x86_64.rpm | 64 kB 00:01
(9/232): abrt-tui-2.0.8-21.el6.centos.x86_64.rpm | 61 kB 00:01
(10/232): at-3.1.10-44.el6_5.2.x86_64.rpm | 60 kB 00:00

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章