使用本地YUM源安装服务报错以及解决办法
YUM报错
Total 35 MB/s | 18 MB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
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 375, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 281, in main
return_code = base.doTransaction()
File "/usr/share/yum-cli/cli.py", line 816, in doTransaction
resultobject = self.runTransaction(cb=cb)
File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 1833, in runTransaction
lastdbv = self.history.last()
File "/usr/lib/python2.7/site-packages/yum/history.py", line 1271, in last
ret = self.old([], 1, complete_transactions_only)
File "/usr/lib/python2.7/site-packages/yum/history.py", line 1220, in old
executeSQL(cur, sql, params)
File "/usr/lib/python2.7/site-packages/yum/sqlutils.py", line 166, in executeSQLQmark
return cursor.execute(query)
sqlite3.OperationalError: database is locked
解决办法
[root@node ~]# cd /var/lib/rpm/
[root@node rpm]# ll
total 47744
-rw-r--r--. 1 root root 1257472 Nov 10 09:51 Basenames
-rw-r--r--. 1 root root 8192 Nov 10 09:51 Conflictname
-rw-r--r--. 1 root root 286720 Nov 10 09:55 __db.001
-rw-r--r--. 1 root root 90112 Nov 10 09:55 __db.002
-rw-r--r--. 1 root root 1318912 Nov 10 09:55 __db.003
-rw-r--r--. 1 root root 401408 Nov 10 09:51 Dirnames
-rw-r--r--. 1 root root 8192 Nov 10 09:51 Group
-rw-r--r--. 1 root root 12288 Nov 10 09:51 Installtid
-rw-r--r--. 1 root root 24576 Nov 10 09:51 Name
-rw-r--r--. 1 root root 16384 Nov 10 09:51 Obsoletename
-rw-r--r--. 1 root root 43581440 Nov 10 09:51 Packages
-rw-r--r--. 1 root root 1748992 Nov 10 09:51 Providename
-rw-r--r--. 1 root root 135168 Nov 10 09:51 Requirename
-rw-r--r--. 1 root root 40960 Nov 10 09:51 Sha1header
-rw-r--r--. 1 root root 24576 Nov 10 09:51 Sigmd5
-rw-r--r--. 1 root root 8192 Nov 10 09:51 Triggername
[root@node rpm]# rm -i __db.*
rm: remove regular file ‘__db.001’? y
rm: remove regular file ‘__db.002’? y
rm: remove regular file ‘__db.003’? y
[root@node rpm]#
[root@node rpm]#
[root@node rpm]# yum clean all
Loaded plugins: fastestmirror
Cleaning repos: centos k8s
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@node rpm]# yum history new
Loaded plugins: fastestmirror
history new
[root@node rpm]#