Red Hat Topics - how to restore RPM when it's broken ?

This is Interesting: Free IT Magazines  
Home > Archive > Red Hat Topics > January 2005 > how to restore RPM when it's broken ?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author how to restore RPM when it's broken ?
Bruno

2005-01-01, 5:45 pm

Lenard wrote:

> On Wed, 22 Dec 2004 22:54:25 +0100, Bruno wrote:
>
http://download.fedora.redhat.com/p...os/Fedora/RPMS/[vbcol=seagreen]
>
> Just to be sure, you did boot into 'rescue mode' from either the rescue CD
> or the installation media, correct?
>
>
>
> OK....
>
>
>
> One last thing to try, after booting from the rescue CD or from the FC2
> Installation media in 'rescue mode' do;
>
> cd /mnt/sysimage/var/lib/rpm
> rm -f /var/lib/rpm/__db*
> cd /usr/bin
> rpm --initdb
> rpm -vv --rebuilddb
> Note; this should take a bit of time and produce a lot of output.
>
> When done change directory to where the four rpm-4.3.1 packages are
> stored. Notice in the first 'cd command' above '/mnt/sysimage' was used
> you will have to specify this in addition to change to the packages are
> stored location. For example lets say the four rpm-4.3.1 packages are
> stored in your /tmp location you would type; cd /mnt/sysimage/tmp
>
> Now type; /usr/bin/rpm -Uvh rpm*.rpm --force --ignoreos
>
>
> If everything goes right you should see the correct version 4.3.1 here.
> Additional help can be found here; http://www.rpm.org/hintskinks/repairdb/
>
> It might be easier to re-install FC2 from scratch or install/upgrade to
> FC3.
>
>


Lenard, as you mentionned, I downloaded the following :

FC2-i386-rescuecd.iso 13-May-2004 05:38 75.8M

I booted on it (via lilo) but then was asked to indicate path to found ISO
files for Fedora Core 2 (which I have on my disk so indicated the path)
then the system was (partially ?) upgraded without any prompt in a rescue
mode. And from there, as I descibed in my previous post, I have the version
4.2.1

Is there something I missed to be able to obtain a rescue prompt mode ?


Lenard

2005-01-02, 2:45 am

On Sat, 01 Jan 2005 22:03:52 +0100, Bruno wrote:

> Lenard wrote:
>
> http://download.fedora.redhat.com/p...os/Fedora/RPMS/
> Lenard, as you mentionned, I downloaded the following :
>
> FC2-i386-rescuecd.iso 13-May-2004 05:38 75.8M
>
> I booted on it (via lilo) but then was asked to indicate path to found ISO
> files for Fedora Core 2 (which I have on my disk so indicated the path)
> then the system was (partially ?) upgraded without any prompt in a rescue
> mode. And from there, as I descibed in my previous post, I have the
> version 4.2.1
>
> Is there something I missed to be able to obtain a rescue prompt mode ?


No, you should be able to boot directly into rescue mode from the CD or
the image by simply hitting the 'Enter' key. All you should need to do is
follow the on screen instructions and directions about where the mounted
partitions are found. If possible try burning the rescue CD image to a CD
(a CD-RW will work) and boot directly off the burned media.


--
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety." -- B. Franklin, 1759

Bruno

2005-01-02, 5:45 pm

Lenard wrote:

> On Sat, 01 Jan 2005 22:03:52 +0100, Bruno wrote:
>
http://download.fedora.redhat.com/p...os/Fedora/RPMS/[vbcol=seagreen]
>
> No, you should be able to boot directly into rescue mode from the CD or
> the image by simply hitting the 'Enter' key. All you should need to do is
> follow the on screen instructions and directions about where the mounted
> partitions are found. If possible try burning the rescue CD image to a CD
> (a CD-RW will work) and boot directly off the burned media.
>
>


Unfortunately I don't have a CD-RW drive so I have to boot from hard-drive.
After downloading the FC2-i386-rescuecd.iso, I mount on the download
location to be able to copy files to my drive (hereafter /tmp/hdimage/)
After that, I setup my lilo.conf as follow:

[snip]

image=/tmp/hdimage/rescue-fc2/isolinux/vmlinuz
label=rescue-fc2
append="root=LABEL=/"
read-only
initrd=/tmp/hdimage/rescue-fc2/isolinux/initrd.img

which works as a boot sequence except that it launch the Fedora Core-2
installation (ie. ask location of the Core-2 .iso files) and not the rescue
mode with a text prompt.
So how to boot a rescue mode from hard-drive ?


Lenard

2005-01-02, 5:45 pm

On Sun, 02 Jan 2005 18:56:27 +0100, Bruno wrote:

<snip>

> So how to boot a rescue mode from hard-drive ?


OK, I understand now......

Boot your system as you normally do (not in rescue mode) and log on as
root and get into the console (text mode) or open a xterm session. The
following should get you working...

Save a copy of everything (just in case);

cd /var/lib

tar czvf /tmp/rpmdb.tar.gz rpm

Next extract the files from the 4.3.1-0.3 rpm packages;

cd <to where the 4 rpm packages are located>

rpm2cpio <rpm-4.3.1-0.3.i386.rpm> rpm.cpio

rpm2cpio <rpm-build-4.3.1-0.3.i386.rpm> rpm-build.cpio

rpm2cpio <rpm-devel-4.3.1-0.3.i386.rpm> rpm-devel.cpio

rpm2cpio <rpm-python-4.3.1-0.3.i386.rpm> rpm-python.cpio

cpio -i -d < rpm.cpio
cpio -i -d < rpm-build.cpio
cpio -i -d < rpm-devel.cpio
cpio -i -d < rpm-python.cpio

The output from the above commands will create a file and directory
structure like (ignore the version numbers in the example below yours will
be different);

/home/lenard/Hold/Installed_RPM/Test/ls

bin rpm-devel.cpio
etc rpm-libs-4.3.3-8.i386.rpm
rpm-4.3.3-8.i386.rpm rpm-libs.cpio
rpm-build-4.3.3-8.i386.rpm rpm-python-4.3.3-8.i386.rpm

rpm-python.cpio rpm-build.cpio
rpm.cpio usr
rpm-devel-4.3.3-8.i386.rpm var


The four directories (bin, etc, usr and var) are where the correct 4.3.1
files are now stored. You need to copy the contents of these directories
to the same directory structure on your root partition. In other words
(for example) the file located in /home/lenard/Hold/Installed_RPM/Test/bin
should be copied to /bin location. You will find some of the
sub-directories (like the var/rpm directory) empty this is OK, you have
nothing to do in this case.

When done with the file copying go beck to the location where the four rpm
packages are stored and do (to fix the database);

rpm -Uvh rpm*.rpm --justdb ;note -- you should have the files installed
rpm -vv --rebuilddb ;note -- this should take a bit of time

When done you should have a corrected database and the output from the
commands 'rpm --version' and 'rpm -qa 'rpm*' without the quotes should
show that you have 4.3.1 installed (examples below).

# rpm --version
RPM version 4.3.1

$ rpm -qa 'rpm*'
rpm-build-4.3.1-0.3
rpm-4.3.1-0.3
rpm-python-4.3.1-0.3
rpm-devel-4.3.1-0.3



--
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety." -- B. Franklin, 1759

Bruno

2005-01-02, 5:45 pm

Lenard wrote:

> On Sun, 02 Jan 2005 18:56:27 +0100, Bruno wrote:
>
> <snip>
>
>
> OK, I understand now......
>
> Boot your system as you normally do (not in rescue mode) and log on as
> root and get into the console (text mode) or open a xterm session. The
> following should get you working...
>
> Save a copy of everything (just in case);
>
> cd /var/lib
>
> tar czvf /tmp/rpmdb.tar.gz rpm
>
> Next extract the files from the 4.3.1-0.3 rpm packages;
>
> cd <to where the 4 rpm packages are located>
>
> rpm2cpio <rpm-4.3.1-0.3.i386.rpm> rpm.cpio
>
> rpm2cpio <rpm-build-4.3.1-0.3.i386.rpm> rpm-build.cpio
>
> rpm2cpio <rpm-devel-4.3.1-0.3.i386.rpm> rpm-devel.cpio
>
> rpm2cpio <rpm-python-4.3.1-0.3.i386.rpm> rpm-python.cpio
>
> cpio -i -d < rpm.cpio
> cpio -i -d < rpm-build.cpio
> cpio -i -d < rpm-devel.cpio
> cpio -i -d < rpm-python.cpio
>
> The output from the above commands will create a file and directory
> structure like (ignore the version numbers in the example below yours will
> be different);
>
> /home/lenard/Hold/Installed_RPM/Test/ls
>
> bin rpm-devel.cpio
> etc rpm-libs-4.3.3-8.i386.rpm
> rpm-4.3.3-8.i386.rpm rpm-libs.cpio
> rpm-build-4.3.3-8.i386.rpm rpm-python-4.3.3-8.i386.rpm
>
> rpm-python.cpio rpm-build.cpio
> rpm.cpio usr
> rpm-devel-4.3.3-8.i386.rpm var
>
>
> The four directories (bin, etc, usr and var) are where the correct 4.3.1
> files are now stored. You need to copy the contents of these directories
> to the same directory structure on your root partition. In other words
> (for example) the file located in /home/lenard/Hold/Installed_RPM/Test/bin
> should be copied to /bin location. You will find some of the
> sub-directories (like the var/rpm directory) empty this is OK, you have
> nothing to do in this case.
>
> When done with the file copying go beck to the location where the four rpm
> packages are stored and do (to fix the database);
>
> rpm -Uvh rpm*.rpm --justdb ;note -- you should have the files installed
> rpm -vv --rebuilddb ;note -- this should take a bit of time
>
> When done you should have a corrected database and the output from the
> commands 'rpm --version' and 'rpm -qa 'rpm*' without the quotes should
> show that you have 4.3.1 installed (examples below).
>
> # rpm --version
> RPM version 4.3.1
>
> $ rpm -qa 'rpm*'
> rpm-build-4.3.1-0.3
> rpm-4.3.1-0.3
> rpm-python-4.3.1-0.3
> rpm-devel-4.3.1-0.3
>
>
>


Works fine.
Lenard, thanks a lot for your help and patience.
From there I'll try to upgrade to FC3.


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com