non removable files

Paolo Galtieri (peg@caffeine.phx.mcd.mot.com)
Thu, 13 May 1999 10:08:11 -0700 (MST)


Recently I had some disk corruption on my IDE drive. What caused the
corruption I don't know, but the result of it was that several files
were turned into device special files, e.g.

pr-SrwS-wT 1 1024 13879 0 Mar 10 2028 if_yfgreg.h
cr---w---- 1 26720 8192 109, 116 Oct 25 2008 pre-patch-2.2.5-1

there are several others. The problem is that I cannot remove them, or
do just about anything else to them even as root. For example:

[root@bitmap peg]# chmod +rw pre-patch-2.2.5-1
chmod: pre-patch-2.2.5-1: Operation not permitted

here is the strace output of the above:

[root@bitmap peg]# strace chmod +rw pre-patch-2.2.5-1
execve("/bin/chmod", ["chmod", "+rw", "pre-patch-2.2.5-1"], [/* 40 vars */]) = 0
brk(0) = 0x804b6ec
open("/etc/ld.so.preload", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 5
fstat(5, {st_mode=030703, st_size=0, ...}) = 0
mmap(0, 26433, PROT_READ, MAP_PRIVATE, 5, 0) = 0x40014000
close(5) = 0
open("/lib/libc.so.6", O_RDONLY) = 5
fstat(5, {st_mode=0, st_size=0, ...}) = 0
read(5, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3"..., 4096) = 4096
mmap(0, 974392, PROT_READ|PROT_EXEC, MAP_PRIVATE, 5, 0) = 0x4001b000
mprotect(0x40101000, 32312, PROT_NONE) = 0
mmap(0x40101000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 5, 0xe5000) = 0x40101000
mmap(0x40106000, 11832, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x40106000
close(5) = 0
munmap(0x40014000, 26433) = 0
personality(PER_LINUX) = 0
getpid() = 10476
brk(0) = 0x804b6ec
brk(0x804b724) = 0x804b724
brk(0x804c000) = 0x804c000
umask(0) = 022
umask(022) = 0
lstat("pre-patch-2.2.5-1", {st_mode=S_IFBLK|S_ISUID|S_ISGID|0564, st_rdev=makedev(196, 25), ...}) = 0
chmod("pre-patch-2.2.5-1", 0664) = -1 EPERM (Operation not permitted)
write(2, "chmod: ", 7chmod: ) = 7
write(2, "pre-patch-2.2.5-1", 17pre-patch-2.2.5-1) = 17
write(2, ": Operation not permitted", 25: Operation not permitted) = 25
write(2, "\n", 1
) = 1
_exit(1) = ?

Notice the EPERM error return on the chmod call.

The question I have is how do I remove them. I've run fsck on it and
it shows up clean. This is an ext2 fs. As a side note du does not
handle these files very well, e.g. du -s Tmp returns total 665299597
and it contains:

-rw-r--r-- 1 peg users 36487 Mar 30 22:40 ChangeLog.html
-rw-r--r-- 1 peg users 2144 Mar 30 22:39 LICENSE.txt
cr-srwS--T 1 18734 18241 123, 250 Dec 22 2010 acenic.zip
drwxr-xr-x 6 peg users 1024 Apr 16 06:23 doc
drwxr-xr-x 2 peg users 1024 Apr 16 06:23 images
drwxr-xr-x 2 peg users 1024 Apr 16 06:23 license
-rw-r--r-- 1 peg users 1641300 Apr 1 08:28 openxml-doc.zip
-rw-r--r-- 1 peg users 626414 Apr 1 08:26 openxml-src.zip
-rw-r--r-- 1 peg users 18167 Mar 30 22:39 openxmlpl.txt
-rw-r--r-- 1 peg users 4119 Nov 16 14:22 sock.c
-rw-r--r-- 1 peg users 624 Mar 30 22:39 xsa.xml

[root@bitmap peg]# du -s Tmp/doc
4757 Tmp/doc
[root@bitmap peg]# du -s Tmp/images
35 Tmp/images
[root@bitmap peg]# du -s Tmp/license/
68 Tmp/license
[root@bitmap peg]#

so the character device file is causing du to return a wrong value.

Any help on removing these files would be appreciated.

As for my IDE tape problems I posted last week, even by patching
ide-tape.c to version 1.15 I still see tar locking up. I also got
this message when I tried to copy a file to the floppy drive while
the tar was hung up:

DMA memory shortage. Temporarily falling back on virtual DMA.

Paolo

-- 
Paolo Galtieri                            Senior Software Engineer
Motorola Computer Group                   INTERNET: peg@phx.mcd.mot.com
2900 S. Diablo Way                        VOICE: (602) 438 - 3754
Tempe, AZ 85282

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/