[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Package cleanup following demise of /usr



On Fri, Feb 14, 2003 at 11:08:10AM +0000, John M. Adams wrote:
> Dear Friends,
> 
> I recently lost the disk dedicated to /usr.  I happened to have plenty
> of extra partition space and a /usr from a recent debian install on
> another partition, so getting back up was only a matter of a few
> minutes; no reboot required.
> 
> Needless to say, the package system now requires some attention as
> many things which are still thought to be installed are missing all of
> the files that were in /usr.  The state of the package system seems to
> be recorded on /var.
> 
> I have been able to remove and reinstall and so forth to bring some
> things back into a good state, but things are not quite there yet.
> For example I wrote a script to recursively check and install or
> reinstall based on dependency info from apt-cache depends.  That
> helped somewhat as mozilla is involved in complex dependency
> relationships.  The script uses dpkg -L to check whether a package's
> files are really there.  Is there some kind of built in validator
> similar to this?

What I would do is 
dpkg --get-selections|grep -w install|cut -f 1|xargs apt-get install --reinstall

This will basically reinstall all your packages. The only disadvantage I
see is that it will probably ask what to do about just about every
configuration file you have. IIRC the default is to leave the one you
have, so just pressing return should do the trick.
This will take some time (it has to get every package from cd/net and
unpack it again), but I think it is very likely to produce an exact copy
of the system you had.

Frank

> In fact, the better to be instructed, perhaps I should simply display
> my ignorance explicitly.  Basically, I piped this apt-cache command
> into the the following script.
> 
> # apt-cache --recurse depends mozilla-browser|grep "Depends: [^<]"|awk '{print $2}'|sort -u|xargs -n 1 /chkpkg
> 
> 
> # script chkpkg
> # Check whether all files of a package are there.
> # If not, perform a reinstall.
> 
> if ! dpkg -s $1 >/dev/null 2>&1; then
>     echo chkpkg installing
>     apt-get --assume-yes install $1
>     exit
> fi
> 
> dpkg -L $1 | \
> while read x; do
>   if [ ! -e $x ]; then
>     echo $x is missing for $1
>     apt-get --reinstall --assume-yes install $1
>     echo Reinstall attempt complete.
>     exit
>   fi
> done
> 
> I have no doubt that I am laboring under various and sundry
> misconceptions.
> 
> Can anybody offer me some general advice on how to repair the
> situation?
> 
> I guess I could reinstall and start with a clean slate, but I'd rather
> learn how to fix things directly.  Moreover, when I installed from CD,
> the boot kernel did not see my scsi, so it was somewhat inconvenient
> to get the filesystems spread across several ide and scsi disks.
> Someone suggested to me that perhaps I should have booted from a
> different CD in the set.  I am using a Linux Central CD set.
> 
> Anyway, clearly it should be possible to tell the package system
> things like:
> 
> "I know it looks like this is installed, but it isn't." and "Please
> stop trying to autoconfigure and deconfigure on the basis of
> dependency".
> 
> I have been busy for a day learning all about these things, having
> read over various manpages many times, but, as a brand-new debian user
> I would be exceedingly grateful for any advice.
> 
> Thanks very much,
> 
> -- 
> John M. Adams
> 
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: