# Reiser4: can't delete a directory after corruption recovery

## EricHsu

Hi all, yesterday my system hung on "Deactivating swap..." and then I wrongly pressed the power button to force shutdown (I should have pressed the "reboot" button instead...), then my system was unable to boot, since the / filesystem was corrupted.

Then I fsck.reiser4 it to check for error, and followed the instruction to run "fsck.reiser4 --build-fs". Then my system was back. However, I found something weird: there is a directory: 

```

/var/db/pkg/app-arch/tar-1.15.1/

```

seems can't be deleted!

```

# rm -rf tar-1.15.1/

rm: cannot remove directory `tar-1.15.1/': No such file or directory

```

However, it IS there:

```

# ls -ld tar-1.15.1/

drwxr-xr-x  2 root root 1 Jan  8 23:44 tar-1.15.1/

```

And it can be renamed and get the following error:

```

# mv tar-1.15.1 tar-1.15.1.bak

mv: cannot move `tar-1.15.1/' to a subdirectory of itself, `tar-1.15.1.bak'

```

Now it's name is "tar-1.15.1.bak", it IS there, I could see it with "ls" the current directory and bash autocomplete, but, when I:

```

# ls -l tar-1.15.1.bak

ls: tar-1.15.1.bak: No such file or directory

```

After I "ls" & "ls -l" about two times, now there it is again:

```

# ls -ld tar-1.15.1.bak/

drwxr-xr-x  2 root root 1 Jan  8 23:44 tar-1.15.1.bak/

```

Notice that there is a "/" after it now... try to rm it again:

```

# rm -rf tar-1.15.1.bak/

rm: cannot remove directory `tar-1.15.1.bak/': No such file or directory

```

OK, here is my question: how can I possibly delete this directory?? Why can't I delete it?

TIA!

----------

## ()

I think the same thing happened to me once, looks like the filesystem is messed up. You could always back up everything but the corrupt entry, reformat the partition, and extract the data back.

----------

## Jake

Did "fsck.reiser4 --check" come up clean after --build-fs?

----------

## EricHsu

 *Jake wrote:*   

> Did "fsck.reiser4 --check" come up clean after --build-fs?

 

Jake, thank you very much for your hint! The first time I did the "fsck.reiser4 --build-fs", the result came up with "the filesystem is consistent", and my system was usable again, then I thought everything should be OK. However, after I read ()'s (OMG, what a nickname  :Wink:  ) and your post, I tar'd up my whole system and ran "fsck.reiser4 --check" again last night. Then - fsck.reiser4 ended with "a fatal error" and suggested me to run "--build-fs" to fix it. oh my!

Then I ran "--build-fs", the verbose output told me that it found some errors & fixed them, deleted some nodes which pointed to nowhere... and I double checked - ran "fsck.reiser4 --check" twice after "--build-fs" - to make sure everything did get fixed.

After rebooted back to my system, wow, I deleted that ghost "tar-1.15.1/" directory!!  :Laughing: 

However (I "hate" this word, hehe), there is still a problem: I can't delete some entries in the /lost+found directory, they look like this:

```

eric@gentux ~ $ ls /lost+found/

ls: /lost+found/lost_name_10001:6d6f64756c6573:411d92Z±¤¹:0     @õ°:0 : No such file or directory

[snip]

ls: /lost+found/lost_name_10001:6d7461622e746d:3e2ac9Z±¤¹:0     @õ°:0 : No such file or directory

eric@gentux ~ $

```

"No such file or directory" - but they ARE there... I can't delete them... I know, I could tar up my system, reformat the partition & extract the system back again as () suggested, but, isn't there a more elegant way to delete them?

TIA  :Very Happy: 

----------

## Rainmaker

bit late, but this is probably because of those special chars in the file name, which get eaten up by your shell.

Try a very basic shell, which will eat less special characters, such as sh, ash or something.

Also try putting the names in " "

----------

