Solved

Centos 6.0 damaged rpm

Posted on 2014-09-21
15
77 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
  • 4
  • 4
  • 3
  • +3
15 Comments
 
LVL 39

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
 
LVL 76

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 39

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 39

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
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 76

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 61

Expert Comment

by:gheist
ID: 40340016
Error is from cpio

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

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 61

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 76

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 76

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 61

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now