Solved

Centos 6.0 damaged rpm

Posted on 2014-09-21
15
91 Views
Last Modified: 2015-11-02
Trying to reinstall a damaged rpm file.  To do this I checked the install.log file for the version that was installed initially and found the following:

Installing rpm-libs-4.8.0-12.el6.x86_64
Installing rpm-4.8.0-12.el6.x86_64
Installing rpm-python-4.8.0-12.el6.x86_64
Installing rpm-build-4.8.0-12.el6.x86_64

So I downloaded rpm-4.8.0-12.el6.x86_64 but when I tried executing rpm2cpio I get the errors outlined below.  

[mop@localhost rpm]$ ls -al
total 4740
drwxr-xr-x   2 root    root       4096 Sep 21 09:43 .
drwxr-xr-x. 47 mop mop   12288 Sep 21 09:56 ..
-rw-r--r--   1 root    root     917116 Nov 24  2010 rpm-4.8.0-12.el6.x86_64.rpm
-rw-r--r--   1 root    root    3789304 Sep 27  2013 rpm-4.8.0-37.el6.src.rpm
-rw-r--r--   1 root    root     125220 Jul  3  2011 rpm-build-4.8.0-12.el6.x86_64.rpm
-rw-r--r--   1 root    root          0 Sep 21 09:25 rpm.cpio
[mop@localhost rpm]$ sudo rpm2cpio rpm-4.8.0-12.el6.x86_64.rpm | cpio -dim
Error: header not recognized
cpio: premature end of archive
[mop@localhost rpm]$ 

Open in new window


How to resolve?
0
Comment
Question by:forums_mp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
  • +3
15 Comments
 
LVL 40

Expert Comment

by:noci
ID: 40336059
is the disk you downloaded it to full?...
Anyway you can download a new one from the CentOS downloads:

You can find a replacement with:
http://rpmfind.net/linux/rpm2html/search.php?query=rpm&submit=Search+...&system=centos&arch=x86_64

and download it. The hash verification should match your system (check while installing).
0
 
LVL 19

Assisted Solution

by:simon3270
simon3270 earned 167 total points
ID: 40336309
Or you may have to add the 'c' flag to cpio (so "cpio -cdim"). This uses an alternative cpio data structure where the header is all printable ASCII characters (by default it is a binary format).
0
 
LVL 13

Expert Comment

by:Sandy
ID: 40336405
why don't you try direct command

#rpm -ivh <pkg> --force

use --force in case you really need it. else try without that.

TY/SA
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 78

Expert Comment

by:arnold
ID: 40337268
As others pointed out, could you make clear what it is you are trying to do?

rpm2cpio is often used to construct a stream type of package versus the RPM
It might also be used if you want to alter the location where the files will be stored.


try rpm --list rpm-4.8.0-12.el6.x86_64.rpm to see whether you get the listing of the files, or you get an error that the RPM is corrupt.
0
 
LVL 40

Assisted Solution

by:noci
noci earned 166 total points
ID: 40337512
It actually may be damaged as the file is a tad longer if downloaded:

-rw-r-----   1 nico users     922940 Sep 22 21:19 rpm-4.8.0-37.el6.x86_64.rpm

Here are chksums:

$ sha1sum Downloads/rpm-4.8.0-37.el6.x86_64.rpm
3c54ce1e59320e506ab34ee221c67c9583d0fdc0  rpm-4.8.0-37.el6.x86_64.rpm
$ md5sum Downloads/rpm-4.8.0-37.el6.x86_64.rpm
cdc80dbbf61a49b9beb6c825ef46e615  rpm-4.8.0-37.el6.x86_64.rpm
$ sha224sum Downloads/rpm-4.8.0-37.el6.x86_64.rpm
17258d1a8d552f08cf4122af55f8cd411b9c15f41a5df92fcab5565b  rpm-4.8.0-37.el6.x86_64.rpm
0
 

Author Comment

by:forums_mp
ID: 40338060
As others pointed out, could you make clear what it is you are trying to do

Open in new window

I'm using a laptop that lacks an rpm file.  "file doesn't exist' basically.  Turns out hosed up the python (looks like python was overwritten with a newer version) version among other things.

Simply put I'm in the position this individual is in (http://deadlockprocess.wordpress.com/2010/07/18/how-to-reinstall-rpm-and-yum-without-rpm-and-yum-in-centosrhel/) and I'm trying to mimick his/her steps - except I'm RHEL/centos 6
0
 
LVL 40

Expert Comment

by:noci
ID: 40338193
You should still check the rpm file, as it seems a few bytes short and the procedure you mention should work too (adjust for other version no's).
0
 
LVL 78

Expert Comment

by:arnold
ID: 40338228
Instead of running the command through sudo, elevate your rights first sudo bash
Then run the rpm2cpio RPM-*.rpm |cpio -dim

See if that also has errors.

What error do you get when you run rpm -qa?

It might be that your rpm index is corrupt rather than the rpm command itself.
0
 
LVL 62

Expert Comment

by:gheist
ID: 40340016
Error is from cpio

Verify package with rpm (should be signed by CentOS)
0
 
LVL 40

Expert Comment

by:noci
ID: 40340356
gheist, his rpm program doesn't work he wants to recover it... and gets errors.
Chicken & Egg problem.
0
 
LVL 62

Expert Comment

by:gheist
ID: 40340842
I doubt RPM binary is broke before seeing strong errors saying that.
rpm2cpio calls the same chicken egg, so it is a nogo too
0
 
LVL 78

Expert Comment

by:arnold
ID: 40340844
The issue might be that the DB become corrupt.
i.e. /var/lib/rpm the db files are messed up.

There is a way to recreate them using rpm --rebuilddb after the __db.* files were deleted. (instructions locatable using any search engine with "RPM repair corrupt db"

Before running the above, what errors if any do you get from rpm --qa?
0
 

Author Comment

by:forums_mp
ID: 40351234
For those not fully convinced that rpm is corrupt or non-existent, here goes
[root@localhost bin]# rpm -qa
bash: rpm: command not found
[root@localhost bin]# 
[root@localhost bin]# rpm
bash: rpm: command not found
[root@localhost bin]# 
[root@localhost bin]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.0 (Santiago)
[root@localhost bin]# 

Open in new window


Same errors if I run as myself versus root
noci:  Seems odd there's no 6.0 from the link you provided ( http://rpmfind.net/linux/rpm2html/search.php?query=rpm&submit=Search+...&system=centos&arch=x86_64).   Wondering if I could get away with using 6.5.    I'll search for v6.0 in the interim
0
 
LVL 78

Expert Comment

by:arnold
ID: 40351336
RPM command not found means the command I not found based on the existing defined PATHAN.

Usually one presumes that /bin /usr/bin  is part of the PATH definition.

Do which rpm
Try /usr/bin/rpm or /bin/rpm

The other option is for you to unpack the RPM on another system to a separate location and then transfer the data to this one.
0
 
LVL 62

Accepted Solution

by:
gheist earned 167 total points
ID: 40351550
Use RHEL 6U5 media to upgrade your system. It will add missing rpm too..

Without RPM you need to get CPIO on other system and then extract good CPIO with permissions on this broken systems.

Also post "locate rpm" and "yum reinstall rpm" outputs.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question