Linux 4 All

Best Linux tricks source

Posts in the rpm category

Sometimes you may find the situation where duplicate packages exists on a server.

[root@tstsrv ~]# rpm -qa | grep php53u-5
php53u-5.3.17-2.ius.el6.x86_64

Few minutes later we got the 2 php packages

[root@tstsrv ~]# rpm -qa | grep php53u-5 php53u-5.3.17-2.ius.el6.i686 php53u-5.3.17-2.ius.el6.x86_64

and it looks like they are sharing some packages
[root@tstsrv ~]# rpm -ql php53u-5.3.17-2.ius.el6.x86_64
/etc/httpd/conf.d/php.conf
/usr/lib64/httpd/modules/libphp5.so
/var/lib/php/session
/var/www/icons/php.gif
[root@tstsrv ~]# rpm -ql php53u-5.3.17-2.ius.el6.i686
/etc/httpd/conf.d/php.conf
/usr/lib/httpd/modules/libphp5.so
/var/lib/php/session
/var/www/icons/php.gif
I went ahead and removed one the wrong package:
[root@tstsrv ~]# yum remove php53u-5.3.17-2.ius.el6.i686

Checking the good package and everything is fine.

[root@tstsrv ~]# rpm -ql php53u-5.3.17-2.ius.el6.x86_64
/etc/httpd/conf.d/php.conf
/usr/lib64/httpd/modules/libphp5.so
/var/lib/php/session
/var/www/icons/php.gif

Reset RPM permissions

Again, you managed to screw your system by doing a stupid chown/chmod command were you shouldn’t. Now, if you still have your connection, the following 2 commands, executed in EXACT that order, will restore the RPM permissions, giving you an usable system.

for i in $(rpm -qa); do rpm --setugids $i; done
for i in $(rpm -qa); do rpm --setperms $i; done