LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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, 05: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, 05: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, 06:02 AM   #3
shahz
Member
 
Registered: Sep 2006
Location: Quetta, Pakistan
Distribution: RHEL 4
Posts: 363

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


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

Rep: Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529
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, 06: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, 07:16 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529
The "5" for MD5sum mismatch.
 
Old 06-25-2008, 01: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 01:23 PM.
 
Old 06-25-2008, 03:06 PM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529
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, 02:41 AM   #9
shahz
Member
 
Registered: Sep 2006
Location: Quetta, Pakistan
Distribution: RHEL 4
Posts: 363

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, 11: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 11:43 AM.
 
Old 06-27-2008, 01:39 AM   #11
shahz
Member
 
Registered: Sep 2006
Location: Quetta, Pakistan
Distribution: RHEL 4
Posts: 363

Rep: Reputation: 29
C = configruation file flag


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

Rep: Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529Reputation: 3529
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 07:17 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 04:49 PM
RPM 'failed dependencies': Why can I not install any rpm packages? leontini Linux - Newbie 7 09-16-2003 01:44 AM
error: cannot get exclusive lock on /var/lib/rpm/Packages error: cannot open Packages inward_eye Linux - Software 3 08-24-2003 04:07 PM
rpm and packages q Newbulus_Maximu Linux - General 1 08-30-2002 12:21 AM
creating packages (.tgz/.deb/.rpm) How from the source packages? l_9_l Linux - General 1 03-06-2002 07:03 PM


All times are GMT -5. The time now is 06:24 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration