Re: rm -R /usr/

2000-06-15 Thread M. Tavasti
"Jacob I. Stowell" <[EMAIL PROTECTED]> writes:

> i am a new debian user and i just learned a hard lesson.  I guess it is
> a bad idea to issue the following command:
> 
> rm -R /usr/

Maybe that isn't that bad, or is it? Still have /etc and /var
remaining. Is it possible to get dpkg from any other computer, and
re-install all packets which were installed before?

Anyway, it may be hard way, harder than re-install everything...


-- 
M. Tavasti /  [EMAIL PROTECTED]  /   +358-40-5078254
 Poista sähköpostiosoitteesta molemmat x-kirjaimet
 Remove x-letters from my e-mail address



Re: rm -R /usr/

2000-06-11 Thread Brian Stults
I've made countless mistakes being overly cavalier with "rm".  As others
have mentioned, "rm -i" didn't work for me because I just got in the
habit of always using "-f".  About a year ago, I decided to start
fiddling with a "trash can" script.  I ended up with several shell
scripts that alias rm to move all deleted files and directories to a
temporary directory until logout.  I can then "undelete" anything that I
realize I still need later on.

If anyone has some time to waste and is interested in taking a look at
what I came up with, I put the scripts and a brief explanation here:

http://www.albany.edu/~bs7452/trash.html

I realize there are countless better ways to make a system such as
this.  I even hesitate to put my scripts out there because they are so
embarrassingly amateur.  Oh well.  Any comments would be greatly
appreciated.

-- 

Brian J. Stults
Doctoral Candidate
Department of Sociology
University at Albany - SUNY
Phone: (518) 442-4652  Fax: (518) 442-4936
Web: http://www.albany.edu/~bs7452



Re: rm -R /usr/

2000-06-11 Thread kmself
On Sat, Jun 10, 2000 at 08:31:56PM -0400, Jacob I. Stowell wrote:
> hello
> 
> i am a new debian user and i just learned a hard lesson.  I guess it is
> a bad idea to issue the following command:
> 
> rm -R /usr/

Reminds me of the time I did an "rm -rf * /" as root.

Here's what happened:

 - I blew away my root partition.
 - I blew away the mounted disk I was trying to clear.

I was doing some partition shuffling, so I'd mounted the rest of my
partitions read-only.  I was trying to restore a backup and had botched
the process, so the partition I had mounted rw was the one I was trying
to delete.

Because I was running admin mode, I had booted off a boot image.

The net result was that I didn't actually do any damage to my system --
the boot image was still safe on disk, nothing but the one partition I
was trying to kill was writable.  I *did* have to reboot to get a useful
system (interesting moving around when all you've got is your current
shell process running).

The lesson:  if you're going to do something potentially dangerous to
your system, minimize the potential for danger first.



I personally vote *against* aliasing 'rm' to 'rm -i' or similar.  It's
far too easy to fall into bad habits, like counting on the fact that
'rm' is in fact aliased, or typing '-f' as a matter of course, or
running as root.  None of which will do you any good, and all of which
become difficult to unlearn.

Rather, I do one of the following:

 - Sit on my hands for 10 seconds before issuing any 'rm' as root.
   Literally.

 - Do the following:

$ su -c 'chown -R  karsten.karsten'
$ rm -rf 

...with both commands being issued from my user account.

The first changes ownership of the directory tree I want to nuke to some
unprivileged user.  The second nukes the tree.  I get two chances to see
if I'm doing something stupid.  If I make a typo the first time, I've
got a mild PITA to restore ownerships.  If I make a typo the second
time, chances are I can't do anything.

-- 
Karsten M. Self  http://www.netcom.com/~kmself
  Evangelist, Opensales, Inc.   http://www.opensales.org
   What part of "Gestalt" don't you understand?  Debian GNU/Linux rocks!
 http://gestalt-system.sourceforge.net/  K5: http://www.kuro5hin.org
GPG fingerprint: F932 8B25 5FDD 2528 D595  DC61 3847 889F 55F2 B9B0


pgp2dZpBnhp5N.pgp
Description: PGP signature


Re: rm -R /usr/ - undelete....

2000-06-10 Thread Alvin Oga

hi ya...

"interactive" mode for rm -i  foo is fine...as long
as you don't remove too many files ???

think the trick is if "rm -rf /usr" is a directory.
rm should query you.

if you do "rm /usr/blah"...than just go ahead and don't
botheras if "-f" was specified ???

if you do "rm -rf /any_dir" as rootalias it ???

... a simple aliase "rm -i"  drives me nuts...
and too lazy to type rm -f  too

and better still if you can find a usable/workable
"undelete" programeven better...
- long ago found something that works only for
small files/dirs

-

oh welll...too many possibilities.just have a good
backup/recovery/undelete system in place...that will get you up
and running within the hour...

c ya
alvin


On Sat, 10 Jun 2000, S. Salman Ahmed wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> >>>>> "JIS" == Jacob I Stowell <[EMAIL PROTECTED]> writes:
> JIS>  hello i am a new debian user and i just learned a hard lesson.
> JIS> I guess it is a bad idea to issue the following command:
> JIS> 
> JIS> rm -R /usr/
> JIS> 
> JIS> i try to look at the bright side, you know make lemonade and
> JIS> all that, so at least i get a new system as a result of my
> JIS> bonehead mistake.  Hopefully i will make different, and yet
> JIS> equally idiotic mistakes in the future.
> JIS> 
> JIS> thanks for listening, i just needed to vent.
> JIS> 
> 
> One way to reduce the likelihood of sth like that from happening again
> is to alias rm to "rm -i" which puts rm in interactive mode. That way rm
> will prompt you for everything but at least it will remind you whether
> or not you really should go ahead.
> 
> Its not foolproof, however, since you could still type "rm -f" or "rm
> - -fr" which will override the interactive mode ...
> 
> Be esp. careful when logged in as root.
> 
> - -- 
> Salman Ahmed
> ssahmed AT pathcom DOT com
> 
> http://www.pathcom.com/~ssahmed
> GnuPG Key fingerprint = A6DB 6C85 DE5A 33BB E873  E437 58B2 09CD 977B 900B
> 
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.0.1 (GNU/Linux)
> Comment: Processed by Mailcrypt 3.5.5 and Gnu Privacy Guard 
> <http://www.gnupg.org/>
> 
> iD8DBQE5QuQRWLIJzZd7kAsRAqIQAKDCk6ep7HVLsbpR2Za97TJgd/4suwCeOzI6
> QIcQnoYVQrQHTW3Q8/D8Nw8=
> =qM9X
> -END PGP SIGNATURE-
> 
> 
> -- 
> Unsubscribe?  mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
> 



Re: rm -R /usr/

2000-06-10 Thread Alvin Oga

hi ya

yeahand luckily... /usr is already backed up on cdrom...
just need to update the missing files/bins/libs  ( i hope it works ? )...
and than apply your new apps/patches ??
i like /usr/src to be in a separate partition
that is backed up or mirrored... all clients 
mount /usr/src (ro) to minimize duplication of stuff

we all did rm -rf / at MOST once i hope...eheheeh

"experience" is the best teacher...many lessons to learn
from rm -R 'anything" or rm -rf or 

c ya
alvin

On Sun, 11 Jun 2000, Colin Watson wrote:

> [EMAIL PROTECTED] wrote:
> >i am a new debian user and i just learned a hard lesson.  I guess it is
> >a bad idea to issue the following command:
> >
> >rm -R /usr/
> >
> >i try to look at the bright side, you know make lemonade and all that,
> >so at least i get a new system as a result of my bonehead mistake. 
> >Hopefully i will make different, and yet equally idiotic mistakes in the
> >future.
> 
> Hmm. Bad luck there. At least it wasn't /, so you get to keep /home. The
> mind boggles as to how much I'd lose if I zapped that and didn't have
> backups ...
> 



Re: rm -R /usr/

2000-06-10 Thread Peter Palfrader
Hi Aaron!

On Sat, 10 Jun 2000, Aaron Solochek wrote:

> Now I have it aliased to interactive mode, which is annoying at times, but
   [ ^^ rm -- PP]
> I haven't made a mistake like that again.

Does not work for me. After 2 days I started using -f with rm all the
times. Even more dangerous.  :)

yours,
peter
-- 
http://www.cosy.sbg.ac.at/~ppalfrad



Re: rm -R /usr/

2000-06-10 Thread Aaron Solochek
Yep... I was working with a filesystem I had mounted in /slink, and I
issued rm -r /etc, trying to remove the mounted etc... oops...  

Now I have it aliased to interactive mode, which is annoying at times, but
I haven't made a mistake like that again.

-Aaron

On Sat, 10 Jun 2000, Jacob I. Stowell wrote:

> hello
> 
> i am a new debian user and i just learned a hard lesson.  I guess it is
> a bad idea to issue the following command:
> 
> rm -R /usr/
> 
> i try to look at the bright side, you know make lemonade and all that,
> so at least i get a new system as a result of my bonehead mistake. 
> Hopefully i will make different, and yet equally idiotic mistakes in the
> future.
> 
> thanks for listening, i just needed to vent.
> 
> -jake
> 
> 
> -- 
> Unsubscribe?  mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
> 
> 



Re: rm -R /usr/

2000-06-10 Thread Colin Watson
[EMAIL PROTECTED] wrote:
>i am a new debian user and i just learned a hard lesson.  I guess it is
>a bad idea to issue the following command:
>
>rm -R /usr/
>
>i try to look at the bright side, you know make lemonade and all that,
>so at least i get a new system as a result of my bonehead mistake. 
>Hopefully i will make different, and yet equally idiotic mistakes in the
>future.

Hmm. Bad luck there. At least it wasn't /, so you get to keep /home. The
mind boggles as to how much I'd lose if I zapped that and didn't have
backups ...

-- 
Colin Watson [EMAIL PROTECTED]



rm -R /usr/

2000-06-10 Thread Jacob I. Stowell
hello

i am a new debian user and i just learned a hard lesson.  I guess it is
a bad idea to issue the following command:

rm -R /usr/

i try to look at the bright side, you know make lemonade and all that,
so at least i get a new system as a result of my bonehead mistake. 
Hopefully i will make different, and yet equally idiotic mistakes in the
future.

thanks for listening, i just needed to vent.

-jake



Re: What to do after "rm -r /usr"?

1998-01-14 Thread Daniel Martin at cush
[EMAIL PROTECTED] (Andy Spiegl) writes:

> Oh, boy!  A friend just called me and said he did a
> "rm -r /usr" by mistake.  He did stop it after a while,
> though, so that he can at least still do a little bit
> on his system.
> 
> Now, he asked me, what he should do in order to get back
> to a stable system again.  I suggested letting dselect
> install all packages again.  But how can he make dselect
> think that the packages aren't installed yet??
> 
> Or is there a better method?  Please help me helping him.
> BTW, he has "bo" installed.

To tell dpkg that nothing is installed, your friend can do the
following:  (sed is in /bin, so should still be around)

cd /var/lib/spkg
cp status status-old
sed -e '\f^Status: fs/ installed$/ not-installed/' < status-old > status

However, before he then turns dpkg loose on his system, I suggest that
he get a copy of the file base1_3.tgz on put it into /tmp (on my 1.3.1
cd, this file is in bo/disks-i386/current/; it's also the file that
goes into the base disk images - if all your friend has is these base
disks, there is a way to reconstruct this file - let me know) and do:

cd /
tar -xvkzf /tmp/base1_3.tgz usr
tar -xzOf /tmp/base1_3.tgz var/lib/dpkg/status > /tmp/base-status
# That's a capital "o", not the digit zero in the previous line

Then, so that dpkg can know about the packages installed by the base
install, he needs to run the following perl script (since perl was
restored by the preceding tar statement):

#!/usr/bin/perl
# This script takes the file /var/lib/dpkg/status and the file
# /tmp/base-status and creates a new status file (called
# /var/lib/dpkg/status-new) which looks just like /var/lib/dpkg/status
# except that it has the installed/not-installed status taken from
# /tmp/base-status

$/ = "\n\n";
open(BASESTATUS, ") {
  ($package) = m/^Package: (.*)$/m;
  ($stat1, $stat2, $stat3) = m/^Status: ([^ ]*) ([^ ]*) ([^ ]*)$/m;
  $packhash{$package} = $stat3;
}

open(CURSTATUS, "/var/lib/dpkg/status-new");

while() {
  ($package) = m/^Package: (.*)$/m;
  if (defined($packhash{$package})) {
s/^Status: ([^ ]*) ([^ ]*) ([^ ]*)$/Status: \1 \2 $packhash{$package}/m;
  }
  print NEWSTATUS $_;
}

# end script

Then do a
  cd /var/lib/dpkg
  diff status status-new | more

Just to make certain that the above script didn't mess things up, then 
do a 
  mv status-new status
And dpkg's status file should now list everything installed that comes
installed on the base distribution, and everything else as
not-installed.  Hopefully, dselect can then be safely used to install
everything again.


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
[EMAIL PROTECTED] .
Trouble?  e-mail to [EMAIL PROTECTED] .


Re: What to do after "rm -r /usr"?

1998-01-14 Thread Richard E. Hawkins Esq.
> Oh, boy!  A friend just called me and said he did a
> "rm -r /usr" by mistake.  He did stop it after a while,
> though, so that he can at least still do a little bit
> on his system.
> 
> Now, he asked me, what he should do in order to get back
> to a stable system again.  I suggested letting dselect
> install all packages again.  But how can he make dselect
> think that the packages aren't installed yet??


I solved an ugly problem like this a while back.  I believe the solution was 
to make /var/lib/dpkg/available an empty file.

rick


-- 
These opinions will not be those of ISU until it pays my retainer.



--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .


What to do after "rm -r /usr"?

1998-01-14 Thread Andy Spiegl
Oh, boy!  A friend just called me and said he did a
"rm -r /usr" by mistake.  He did stop it after a while,
though, so that he can at least still do a little bit
on his system.

Now, he asked me, what he should do in order to get back
to a stable system again.  I suggested letting dselect
install all packages again.  But how can he make dselect
think that the packages aren't installed yet??

Or is there a better method?  Please help me helping him.
BTW, he has "bo" installed.

Thanks so much in advance!
 Andy.

 Andy Spiegl, University of Technology, Muenchen, Germany
 E-Mail: [EMAIL PROTECTED] OR: [EMAIL PROTECTED]
 URL:http://www.appl-math.tu-muenchen.de/~spiegl
 PGP fingerprint: B8 48 24 7B DB 96 6F 1C  D9 6D 8E 6C DB C2 E7 E9
o  _ _ _
  - __o   __o  /\_   _ \\o  (_)\__/o  (_)
  --- _`\<,__`\<,__>(_) (_)/<_\_| \   _|/' \/
  -- (_)/ (_)  (_)/ (_)  (_)(_)   (_)(_)'  _\o_
 ~~~


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .