Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Impossible to delete a file
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
zbindere
Guru
Guru


Joined: 27 May 2004
Posts: 356
Location: Switzerland

PostPosted: Fri Apr 07, 2006 9:21 am    Post subject: Impossible to delete a file Reply with quote

I have a file in
Code:
/usr/portage/sci-electronics/magic/files

which I cannot delete. Here more information:
Code:

cd /usr/portage/sci-electronics/magic/files
#ls
10magic?
#rm 10*
rm: cannot remove `10magic\b': No such file or directory
#cd ..
#rm -rf files
rm: cannot remove directory `files/': Directory not empty

When I type ls 10 and push the tab I get:
Code:
#ls 10magic^H


what is going on here. I have never seen something like that.
Back to top
View user's profile Send private message
kfiaciarka
Veteran
Veteran


Joined: 20 May 2005
Posts: 1498
Location: Dobre Miasto, Poland

PostPosted: Fri Apr 07, 2006 9:31 am    Post subject: Reply with quote

Try use mc to that:)
Back to top
View user's profile Send private message
zbindere
Guru
Guru


Joined: 27 May 2004
Posts: 356
Location: Switzerland

PostPosted: Fri Apr 07, 2006 10:07 am    Post subject: Reply with quote

does not work with mc
Back to top
View user's profile Send private message
Akkara
Bodhisattva
Bodhisattva


Joined: 28 Mar 2006
Posts: 6702
Location: &akkara

PostPosted: Fri Apr 07, 2006 10:24 am    Post subject: Reply with quote

Could your filesystem have become corrupted? Maybe try to boot from a live-cd and do a fsck -f on it?

What does ls -la in that directory give?
Back to top
View user's profile Send private message
BlackEdder
Advocate
Advocate


Joined: 26 Apr 2004
Posts: 2588
Location: Dutch enclave in Egham, UK

PostPosted: Fri Apr 07, 2006 10:45 am    Post subject: Reply with quote

I just tested a file with a ? and that doesn't seem to be a problem
Code:
edwin@zaphod:~/tmp$ touch bla?
edwin@zaphod:~/tmp$ rm bla\?
Back to top
View user's profile Send private message
Darkael
Veteran
Veteran


Joined: 10 Aug 2004
Posts: 1321
Location: France

PostPosted: Fri Apr 07, 2006 11:54 am    Post subject: Reply with quote

zbindere, can you post the output of these two commands:
Code:

ls -lq
ls -lb


Last edited by Darkael on Fri Apr 07, 2006 12:02 pm; edited 2 times in total
Back to top
View user's profile Send private message
zbindere
Guru
Guru


Joined: 27 May 2004
Posts: 356
Location: Switzerland

PostPosted: Fri Apr 07, 2006 12:00 pm    Post subject: Reply with quote

Code:
#rm 10magic\?
rm: cannot remove `10magic?': No such file or directory

as I said bash completion gives me: 10magic^H
Back to top
View user's profile Send private message
zbindere
Guru
Guru


Joined: 27 May 2004
Posts: 356
Location: Switzerland

PostPosted: Fri Apr 07, 2006 12:02 pm    Post subject: Reply with quote

KarnEvil wrote:
zbindere, can you post the output of these two commands:
Code:

ls -lq
ls -lb


Here the output:
Code:
#ls -lq   
ls: 10magi: No such file or directory
total 0

Code:
#ls -lb
ls: 10magic\b: No such file or directory
total 0

Code:
#ls
10magic?

Code:
#ls -la
ls: 10magi: No such file or directory
total 0
drwxr-xr-x  2 portage portage 72 Apr  7 10:31 .
drwxr-xr-x  3 portage portage 72 Apr  7 10:29 ..

I even cannot move the directory to anoder partition. really strange.


Last edited by zbindere on Fri Apr 07, 2006 12:04 pm; edited 1 time in total
Back to top
View user's profile Send private message
Darkael
Veteran
Veteran


Joined: 10 Aug 2004
Posts: 1321
Location: France

PostPosted: Fri Apr 07, 2006 12:04 pm    Post subject: Reply with quote

Try:
Code:

rm 10magic?

(don't escape the ?)
Back to top
View user's profile Send private message
zbindere
Guru
Guru


Joined: 27 May 2004
Posts: 356
Location: Switzerland

PostPosted: Fri Apr 07, 2006 12:05 pm    Post subject: Reply with quote

KarnEvil wrote:
Try:
Code:

rm 10magic?

(don't escape the ?)

Output:
Code:
#rm 10magic?
rm: cannot remove `10magic\b': No such file or directory
Back to top
View user's profile Send private message
Darkael
Veteran
Veteran


Joined: 10 Aug 2004
Posts: 1321
Location: France

PostPosted: Fri Apr 07, 2006 12:13 pm    Post subject: Reply with quote

:(

Ok, now try to delete it with its inode number. Here is how to do it:
-first find the inode number of the file with ls
Code:

ls -i

-use find to delete the file
Code:

find . -inum XXXXXXX -exec rm -i {} \;

(replace XXXXXXX with the inode)

If it doesn't work, as Akkara said check if your fs is not corrupted or something (unless anyone has another suggestion)

By the way, what is your shell? (bash?)
Back to top
View user's profile Send private message
zbindere
Guru
Guru


Joined: 27 May 2004
Posts: 356
Location: Switzerland

PostPosted: Fri Apr 07, 2006 12:27 pm    Post subject: Reply with quote

I am getting crazy here :?
Code:

#ls -i
ls: 10magi: No such file or directory


Yes its bash.

And yes I am going to do a fscheck.
Back to top
View user's profile Send private message
guduri
Apprentice
Apprentice


Joined: 04 Apr 2005
Posts: 230
Location: Ann Arbor, Michigan

PostPosted: Fri Apr 07, 2006 12:30 pm    Post subject: Reply with quote

I have seen this before. I use reiserfs and it turned out to be a file system corruption. Had to rebuild the tree in single user mode and then the problem went away. It really drove me nuts.
_________________
Power is about what you can control. Freedom is about what you can unleash.
Back to top
View user's profile Send private message
Darkael
Veteran
Veteran


Joined: 10 Aug 2004
Posts: 1321
Location: France

PostPosted: Fri Apr 07, 2006 12:37 pm    Post subject: Reply with quote

zbindere wrote:
I am getting crazy here :?
Code:

#ls -i
ls: 10magi: No such file or directory


Yes its bash.

And yes I am going to do a fscheck.

Try to find the inode with:
Code:

stat -c %i *

It it still doesn't work, do as guduri and Akkara said
Back to top
View user's profile Send private message
zbindere
Guru
Guru


Joined: 27 May 2004
Posts: 356
Location: Switzerland

PostPosted: Fri Apr 07, 2006 12:47 pm    Post subject: Reply with quote

Code:
#stat -c %i *
stat: cannot stat `10magic\b': No such file or directory


OK it is the fs. I will never user reiser again. it is not stable enough. It is the third time I have a
reiserfs issue on my servers. for servers I will use from now on ext3.

thanks everybody for you help.
Back to top
View user's profile Send private message
niskel
Guru
Guru


Joined: 17 Nov 2004
Posts: 457
Location: Fredericton, NB, Canada

PostPosted: Fri Apr 07, 2006 2:21 pm    Post subject: Reply with quote

zbindere wrote:
Code:
#stat -c %i *
stat: cannot stat `10magic\b': No such file or directory


OK it is the fs. I will never user reiser again. it is not stable enough. It is the third time I have a
reiserfs issue on my servers. for servers I will use from now on ext3.

thanks everybody for you help.
I had the same problem, fsck.reiserfs --rebuild-tree fixed it for the moment but it was only a matter of time before 3 more came up. I am thuroughly disappointed with reiser as well. I have since moved to ext3 and have never been happier :).
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum