LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Errors When Updating With YUM (https://www.linuxquestions.org/questions/linux-server-73/errors-when-updating-with-yum-934663/)

Arty Ziff 03-15-2012 05:58 PM

Errors When Updating With YUM
 
Server Distro: CentOS v4

I am trying to update some packages with YUM and this is what I am being told:
Code:

Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in ?
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 229, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 145, in main
    (result, resultmsgs) = base.buildTransaction()
  File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 647, in buildTransaction
    (rescode, restring) = self.resolveDeps()
  File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 704, in resolveDeps
    for po, dep in self._checkFileRequires():
  File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 939, in _checkFileRequires
    if not self.tsInfo.getOldProvides(filename) and not self.tsInfo.getNewProvides(filename):
  File "/usr/lib/python2.4/site-packages/yum/transactioninfo.py", line 414, in getNewProvides
    for pkg, hits in self.pkgSack.getProvides(name, flag, version).iteritems():
  File "/usr/lib/python2.4/site-packages/yum/packageSack.py", line 300, in getProvides
    return self._computeAggregateDictResult("getProvides", name, flags, version)
  File "/usr/lib/python2.4/site-packages/yum/packageSack.py", line 470, in _computeAggregateDictResult
    sackResult = apply(method, args)
  File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 861, in getProvides
    return self._search("provides", name, flags, version)
  File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 43, in newFunc
    return func(*args, **kwargs)
  File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 837, in _search
    for pkg in self.searchFiles(name, strict=True):
  File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 43, in newFunc
    return func(*args, **kwargs)
  File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 586, in searchFiles
    self._sql_pkgKey2po(rep, cur, pkgs)
  File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 470, in _sql_pkgKey2po
    pkg = self._packageByKey(repo, ob['pkgKey'])
  File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 413, in _packageByKey
    po = self.pc(repo, cur.fetchone())
  File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 68, in __init__
    self._read_db_obj(db_obj)
  File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 94, in _read_db_obj
    setattr(self, item, _share_data(db_obj[item]))
TypeError: unsubscriptable object

So, I'm not sure what's going on.

Actually, the only packages I *really* want to update are my PHP rpms:
Code:

rpm -qa |grep php
php-common-5.2.11-jason.1
php-pgsql-5.2.11-jason.1
php-imap-5.2.11-jason.1
php-cli-5.2.11-jason.1
php-xml-5.2.11-jason.1
php-devel-5.2.11-jason.1
php-pdo-5.2.11-jason.1
php-5.2.11-jason.1
php-mcrypt-5.2.11-jason.1
php-mbstring-5.2.11-jason.1
php-pear-1.7.2-2.jason.1
php-mysql-5.2.11-jason.1
php-xcache-1.2.2-jason.4
php-ldap-5.2.11-jason.1
php-gd-5.2.11-jason.1

I can't remember why I used a non-CentOS repository. I suspect it's because when I wanted to upgrade to PHP 5.2.11, CentOS didn't have it.

So... two questions:

1. What's the error I'm getting?

2. If I want to side-step there error for the time being and just upgrade PHP, how might I go about that?

I'd like to get php v. 5.3.2 or better if possible.

Thanks,

- Arty

Kustom42 03-15-2012 06:11 PM

That is not a traditional yum error. The error is being reported when the binary application "yum" fails to run as it should. So the issue here is really with yum and in most cases this sort of error can indicate a file system corruption or hopefully, a corrupted binary file.

Taking a look at the log files may help point you in the right direction. The kernel messages file at /var/log/messages is likely to have something about the problem and the yum logs also in /var/log/ may contain some info but probably not.


Your best bet here would be to attempt to re-install the yum package manually and see if that helps. This will be dependent on the OS, arch, etc.. that your system is using.

I would first try doing a simply rpm database rebuild and verify to see if that helps.

rpm --rebuilddb
rpm -Va

You may also want to consider backing up your data and running a filesystem check. BACKUP YOUR DATA!

PHP can always be built and compiled from source and most would say that is the best way to go as you can lock down PHP and compile it with only what you need to make it run for your system. However, if this is just a simple CentOS box running some web-apps that are not critical the easy way to go is to add the atomic repository and do a yum update php. Atomic repo is a good one for CentOS and is designed to work with web-apps running under the Plesk control panel. If you are using cPanel you can use EasyApache(see docs.cpanel.net) to recompile php/apache.

An important note here is that upgraded php from the 5.2 family to 5.3 will usually upgrade MySQL as a dependency. In order to complete the upgrade you MUST run the mysqlupgrade command. Check out dev.mysql.com/doc/refman/5.5/en/mysql-upgrade.html.

Start off by reviewing the log files and if you notice anything out of the ordinary post it here so you can get some input on what the actual root cause of your issue may be.

Kustom42 03-15-2012 06:15 PM

You should also take a look at /etc/yum.repos.d/ and see what repos you have running as the packages you have installed on your system: php-common-5.2.11-jason.1 are definitely not a stable version. Who is Jason? I didnt know he was a revision number..

Worst case scenario you will just need to back up your data, dump your MySQL dbs and re-image. If you have secondary drives or partitions available I would set up a mount there rsync your data over and re-image it just to get those bad packages completely removed.

Arty Ziff 03-15-2012 10:14 PM

After doing some searching on the Intertubes (as I should have done in the first place), I came up with this:

yum clean metadata

...and things progressed as I wanted.

Thanks for the YUM tips, it took me down some roads I might not have explored.

Arty Ziff 03-15-2012 11:36 PM

Actually the update went very well. Except for php, which is what I need to update. Probably because of the odd versions I'm running.

If my bad memory serves me, the reason I installed these version is because when I *needed* to upgrade, there were not yet any "official" rpm packages for this version, which is what I am now stuck with...

http://www.jasonlitka.com/yum-repository/

Code:

# rpm -qa |grep php
php-mbstring-5.2.17-jason.2
php-pdo-5.2.17-jason.2
php-mcrypt-5.2.17-jason.2
php-common-5.2.17-jason.2
php-gd-5.2.17-jason.2
php-cli-5.2.17-jason.2
php-pear-1.9.4-1.jason.1
php-mysql-5.2.17-jason.2
php-pgsql-5.2.17-jason.2
php-ldap-5.2.17-jason.2
php-xml-5.2.17-jason.2
php-xcache-1.3.2-jason.1
php-5.2.17-jason.2
php-devel-5.2.17-jason.2
php-imap-5.2.17-jason.2

What would be the best approach to jettison these and install whatever is fresh in the CentOS repositories?

Yum tells me there are no packages to update, but that can't be true, can it?
Code:

# yum update php
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
 * base: mirrors.kernel.org
 * extras: mirrors.usc.edu
 * rpmforge: ftp-stud.fht-esslingen.de
 * updates: mirrors.cat.pdx.edu
Setting up Update Process
No Packages marked for Update
[root@localhost ~]# php -v
PHP 5.2.17 (cli) (built: Aug 31 2011 17:06:47)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
    with XCache v1.3.2, Copyright (c) 2005-2011, by mOo

So I'm a bit lost...

John VV 03-16-2012 12:23 AM

this is cent 4
the now END OF LIFE cent 4
there will be NO more updates
that was the last
Quote:

Probably because of the odd versions I'm running.
CentOS 4.9 is End Of Life
please install the current version of Cent , CentOS 6.2
Quote:

What would be the best approach to jettison these and install whatever is fresh in the CentOS repositories?
there is NO fresh/new rpm's for cent 4

your BEST bet is to upgrade to cent 6
but if you intend on continuing to use a UNSUPPORTED version

uninstall those non cent rpms
Code:

su -
rpm -qa | grep jason

and use rpm to remove them
or YUM seeing as it looks like you installed yum on cent4
then remove any repos that are NOT cent4
Code:

yum repolist all
will give a list of " all" that are installed whether or not they are on or off
then remove the needed repo files and rebuild the rpm database


but you should install CentOS6.2

Arty Ziff 03-16-2012 11:06 AM

I'm on version 5.4, actually. not 4 (my mistake).

It's nice to be able to just install the latest OS version, well, "because", but that's not always possible.

And, - serious question - if this version has served me well for the most part and been very stable for my needs, what is the benifit to me to upgrading from 5 to 6? To be on CentOS's bleeding edge? Yesterday, when I ran update, was the very first time in almost two years that I had to reboot the machine. There is no mail server running on this box. It is behind a firewall appliance and its sole purpose is to serve web pages, none of which require HTTPS. It's not connected to any tasty networks, and indeed I have large swaths of IP ranges simply blocked because I don't do business in Russia, China, Nigeria, or any of the other Internet vacation spots of ill-repute.

I guess I'm asking if the purpose is to upgrade just to upgrade, or some other reason?

It is unlikely this machine will ever do more than it is doing right now, and php is the single thing I would like a newer version of...

I mean, sure, I'm not trying to be a flaky amateur server admin (amateur yes, but I try not to be flaky), if there is COMPELLING reason to upgrade, well, it has to be done...

Kustom42 03-16-2012 02:15 PM

If you want to do a quick PHP upgrade on CentOS 5. Add the atomic repo, google wget atomic repo, do yum update php mysql. MySQL will need to be upgraded due to PHP dependencies. So after the yum transaction completes run the mysql_upgrade command on your databases so the MySQL table gets upgraded correctly.

chrism01 03-18-2012 08:29 PM

Actually, RHEL/Centos is the stable/production version. The 'bleeding edge' is Fedora, which is used by RH to research/test/refine proposed new functionality.

If you want current versions of SW, upgrading to 5.x or 6.x would be the best way, otherwise you may be trying to force new SW onto an old OS, which is likely to cause issues.
Ultimately it's you choice; if it works for you, go for it.
It's just good to be aware of support/update limits etc.

The support lifetimes are listed here https://access.redhat.com/support/po...pdates/errata/ to help you decide.

You may not know that upgrading in-place across major versions eg 4.x->5.x or 5.x->6.x is not supported, so a clean install is recommended.
Again, it's your choice but I wouldn't do it, especially on a 'prod' system.


All times are GMT -5. The time now is 04:18 PM.