LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-25-2008, 04:37 AM   #1
waji
LQ Newbie
 
Registered: Jun 2008
Posts: 8

Rep: Reputation: 0
RPM packages


Hi,
If some files are delete or corruption from redhat system such as /bin/bash, /bin/mount then how can I find these file belongs to what RPM.
If I have all Redhat RPM cds.

Thanks
 
Old 06-25-2008, 04:59 AM   #2
Swagata Paul
Member
 
Registered: Jun 2008
Location: Kolkata, India
Posts: 57

Rep: Reputation: 15
Find out what package a file belongs to i.e. find what package owns the file--

example command :- rpm -qf /bin/bash

Now u can install the package.
 
Old 06-25-2008, 05:02 AM   #3
shahz
Member
 
Registered: Sep 2006
Location: Quetta, Pakistan
Distribution: RHEL, Ubuntu, Fedora
Posts: 368

Rep: Reputation: 29
you can install the package with the command.


rpm -ivh package name
 
Old 06-25-2008, 05:02 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
On that machine you can verify the installation with 'rpm -qVa': any missing parts will show up with the "missing" tag. Or query the RPM database for a particular file: 'rpm -qf /bin/bash' on another machine (only works if the file exists and is known to the RPMDB).

* Also note that if this corruption or deletion is collateral damage from a breach of security, then restoring binaries is *not* the right approach.
 
Old 06-25-2008, 05:57 AM   #5
waji
LQ Newbie
 
Registered: Jun 2008
Posts: 8

Original Poster
Rep: Reputation: 0
Thanks.

unSpawn when I run 'rpm -qVa' then I see missing flag. But I also got different flag too. what is the flag for corrupted file.
 
Old 06-25-2008, 06:16 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
The "5" for MD5sum mismatch.
 
Old 06-25-2008, 12:17 PM   #7
waji
LQ Newbie
 
Registered: Jun 2008
Posts: 8

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by unSpawn View Post
The "5" for MD5sum mismatch.
well my /bin/mount file not working in rescue mode. mount command giving list like ls command. when I run rpm -qf /bin/mount then it tell package:
util-linux-2.13-0.44.el5

here is the result of rpm -qaV:
S.5....T c /etc/xml/catalog
.M...... /misc
Unsatisfied dependencies for firstboot-1.4.27.2-1.el5.noarch: metacity
.M...... /dev
SM5....T c /etc/sysconfig/iptables-config
..5....T c /etc/anacrontab
....L... c /etc/pam.d/system-auth
.M...... c /etc/cups/classes.conf
.......T c /etc/mail/sendmail.cf
S.5....T c /var/log/mail/statistics
S.5....T c /etc/sysconfig/system-config-securitylevel
.......T c /etc/kdump.conf
Unsatisfied dependencies for control-center-2.16.0-14.el5.i386: libmetacity-private.so.0
..5....T c /etc/printcap
.M.....T /bin/bash
..5....T c /etc/pki/nssdb/secmod.db
S.5....T c /etc/crontab
..5....T c /etc/inittab
.......T c /etc/audit/auditd.conf
SM5....T /bin/mount

I am unable to understand all these above flag. How can I find /bin/mount is wrong one.

Last edited by waji; 06-25-2008 at 12:23 PM.
 
Old 06-25-2008, 02:06 PM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by waji View Post
well my /bin/mount file not working in rescue mode.
You could use your distro's installer CD in rescue mode.


Quote:
Originally Posted by waji View Post
.M...... /misc
.M...... /dev
.M.....T /bin/bash
SM5....T /bin/mount
This could explain mount problems as it shows /bin/mount and /bin/bash have "M" or changed mode: both should have octal mode "0755".


Quote:
Originally Posted by waji View Post
I am unable to understand all these above flag.
See 'man rpm' under "verify options".


Could you tell us what caused all of this?
 
Old 06-26-2008, 01:41 AM   #9
shahz
Member
 
Registered: Sep 2006
Location: Quetta, Pakistan
Distribution: RHEL, Ubuntu, Fedora
Posts: 368

Rep: Reputation: 29
Originally Posted by waji
.M...... /misc
.M...... /dev
.M.....T /bin/bash
SM5....T /bin/mount


well if we take line from above for example

SM5.....T /bin/mount


S = File size mismatch

M = Mode (diffrent permission and file type)

5 = MD5 checksum wrong

T = File modification time mismatch

hope it will help.

thanks
 
Old 06-26-2008, 10:40 AM   #10
waji
LQ Newbie
 
Registered: Jun 2008
Posts: 8

Original Poster
Rep: Reputation: 0
UnSpawn > during playing all these took place. Now I saw "man rpm" on different system cuz in rescue 'man command' not working, only rpm --help in working.

Shahz thanks for your reply.
All files are look ok. except /bin/mount. I don't why others file showing Size and MD5 sum error. Could you tell me what is 'c' indicating before absolute path? Other then /bin/mount
Such as

..5....T c /etc/inittab
.......T c /etc/audit/auditd.conf

Last edited by waji; 06-26-2008 at 10:43 AM.
 
Old 06-27-2008, 12:39 AM   #11
shahz
Member
 
Registered: Sep 2006
Location: Quetta, Pakistan
Distribution: RHEL, Ubuntu, Fedora
Posts: 368

Rep: Reputation: 29
C = configruation file flag


thanks
shahz
 
Old 06-27-2008, 06:16 AM   #12
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by waji View Post
during playing all these took place.
Ah. OK. RPM allows you to restore permissions from the database for each affected package. The easiest way is to use 'rpm --setperms' (if that doesn't work you can -dump the database and script it from there but let's try this first). Automating it all you get:
Code:
# Retrieve input from rpm but not errors:
/bin/rpm -qVa 2>/dev/null | awk '{print $NF}' | while read FILE; do 
 # here we resolve the subjects to their bare package names:
 /bin/rpm -qf "${FILE}" --qf="%{name}\n" 2>/dev/null
done | while read PACKAGE; do
 # here we restore perms and log ops for later perusal:
 /bin/rpm --setperms "${PACKAGE}" 2>&1 | tee -a /tmp/setperms.log
done

Last edited by unSpawn; 06-27-2008 at 06:17 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
RPM packages svinka SUSE / openSUSE 4 10-22-2004 03:49 PM
RPM 'failed dependencies': Why can I not install any rpm packages? leontini Linux - Newbie 7 09-16-2003 12:44 AM
error: cannot get exclusive lock on /var/lib/rpm/Packages error: cannot open Packages inward_eye Linux - Software 3 08-24-2003 03:07 PM
rpm and packages q Newbulus_Maximu Linux - General 1 08-29-2002 11:21 PM
creating packages (.tgz/.deb/.rpm) How from the source packages? l_9_l Linux - General 1 03-06-2002 06:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration