From owner-freebsd-hackers Wed Feb 14 19:54:27 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id TAA07979 for hackers-outgoing; Wed, 14 Feb 1996 19:54:27 -0800 (PST) Received: from fw.ast.com (fw.ast.com [165.164.6.25]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id TAA07974 for ; Wed, 14 Feb 1996 19:54:23 -0800 (PST) Received: from nemesis by fw.ast.com with uucp (Smail3.1.29.1 #2) id m0tmulq-000859C; Wed, 14 Feb 96 21:54 CST Received: by nemesis.lonestar.org (Smail3.1.27.1 #20) id m0tmuiw-000CU4C; Wed, 14 Feb 96 21:51 WET Message-Id: Date: Wed, 14 Feb 96 21:51 WET To: hackers@freebsd.org From: uhclem@nemesis.lonestar.org (Frank Durda IV) Sent: Wed Feb 14 1996, 21:51:14 CST Subject: Is "immutable" supposed to be a good idea? Sender: owner-hackers@freebsd.org Precedence: bulk I ran into a very annoying support call yesterday. A 2.1 system had crashed badly and had rebooted and fscked automatically, causing some key directories to be "lost" and some files to be corrupted. It may have actually rebooted several times before it could not proceed further. After wading through the debris, it became obvious that several of the shared libraries were corrupted and needed to be replaced. Almost none of the dynamically linked applications would run, or they would dump core immediately. Some of the /stand directory files were also missing, but "mt" and "restore" still worked, so I took the latest backup and used it to restore /usr/lib. But guess what I found once the restore was complete? Thanks to those lovely "immutable" flags on the shared libraries, the restore had no effect on them! So after the restore was completed, the garbled files were still there. Of course, /stand/rm would not work to get rid of these files, chflags wasn't around anymore (and it probably relies on the shared libraries anyway since it isn't in /stand). Finally, (thankfully) I realized I could "/stand/mv" the entire /usr/lib directory out of the way, delete all I could out of the copy, then restore /usr/lib from tape. Then I could get to fixing the rest of the damage with tools that worked. The result of this was that the immutable flags on the libraries extended the amount of time to recover the system by some hours. I noted some recent discussion about the "hole" created by being able to move a directory containing an immutable file elsewhere. Thank goodness for this "hole"! Don't plug it! I probably would have had to nuke the entire system otherwise. If restore isn't really doing a restore, then it would be Really Nice if it said so, something like "I can't replace this file", or "%d files could not be restored". Personally, if this immutable thing has to stay (of which currently I see no benefit except to prevent people running as root from doing stupid things and to prevent people running as root or in maintenance mode from doing smart things), I would rather see restore, tar, cpio, rm and any other system recovery tools all be able to replace files with these flags, if the utility is running suid==root. We should not make the system impossible to maintain or to recover. It would also be nice if a static version of chflags existed in /stand too, NOT A LINK. If this utility is so bloody important there ought to be a couple of copies of it around. Strangely, one of the directories with these immutable files was moved into /tmp to get it out of the way. On the next reboot, the normal system start was able to get rid of all of the files. That seems curious. What has rc got that I haven't got? Unless someone knows a really good reason, I plan to turn off immutable on all files on the customer systems I have to maintain. This was too big of a hassle to revisit and cost everybody involved. Oh, weird party trick: some time just before nuking a system to do a fresh install or something, rm /sbin/init, halt and reboot and watch. That is certainly not what other UNIX systems do... Frank Durda IV |"You are in a maze of twisty or uhclem%nemesis@rwsystr.nkn.net | little symlinks, all alike." ^------(this is the fastest route)| or ...letni!rwsys!nemesis!uhclem |