LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-06-2007, 03:35 PM   #1
shinystuffrox
LQ Newbie
 
Registered: Jan 2005
Posts: 25

Rep: Reputation: 15
rm: cannot remove 'filename.extension' Operation not permitted


Recently I had a a hard drive failure, but luckily I had backed all of my stuff up on a friend's pc (mostly music) (all legal, I ripped most of these CDs myself from my own collection)..anyways a few weeks ago I got my new drive and had all the stuff sent back to my new drive. Anyways, I've been going through my old collection and found myself wondering why I even listened to any of this stuff and tried to delete a good portion of the stuff I stopped listening to.

anyways there's a file I can't delete no matter how hard I try.

path to file: /home/media/music/..blah blah/Disc\ 2/04\ Two\ Pi�a\ Coladas.mp3 the ? is probably the spanish n in Pina..whatever that char is called.

anyways i'd like it gone.

so I logged in as root user
and issued a rm -f 04\ Two\ Pi�a\ Coladas.mp3 I wrote out the name using tab completion and this is what it did..but I got an Operation not permitted error...

rm: cannot remove `04 Two Pi\361a Coladas.mp3': Operation not permitted

as you can see the error msg provides a different set of chars to represent the file's name...so I began to wonder... so I did rm -i * for interactive mode so that it would ASK me what file I wanted to delete yes/no
this is what I got..
linbox Disc 2 # rm -i *
rm: remove regular file `04 Two Pi\361a Coladas.mp3'? yes
rm: cannot remove `04 Two Pi\361a Coladas.mp3': Operation not permitted

also, in this directory I cant create a file..for instance
mkdir foo results in
linbox Disc 2 # mkdir foo
mkdir: cannot create directory `foo': Operation not permitted

okay, lets look at the file permissions...
linbox Disc 2 # ls -alh
total 4.2M
drwxrwxrwx 1 pubert root 4.0K Mar 6 07:29 .
drwxrwxrwx 1 pubert root 4.0K Mar 6 07:34 ..
-rw------- 2 root root 4.1M Aug 17 2006 04 Two Pi?a Coladas.mp3

ls -lah ../ #the parent directory Disc 2

linbox Disc 2 # ls -hal ../
total 12K
drwxrwxrwx 1 pubert root 4.0K Mar 6 07:34 .
drwxrwxrwx 1 pubert root 4.0K Mar 6 07:34 ..
drwxrwxrwx 1 pubert root 4.0K Mar 6 07:29 Disc 2


Here's the octal dump of the file
man od or info od can get info on octal dump

any help appreciated...I may have to resort to writing my own del program in C which I cant help but feel is unnecessary. I just want the file gone anyway possible.
using od --strings 04\ Two\ Pi�a\ Coladas.mp3

the od wont fit in one post, so if you need it lemme know and ill post a link to it.
 
Old 03-06-2007, 04:24 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
First make sure that the first character of the file isn't a hyphen. If it is, add two hyphens after the rm command to tell it that there are no more options. Sometimes the unlink command will work where the rm command fails. Another thing to try is to use wild cards. First make sure that they will select only one file.
ls "*Two*Colodas*"
rm "*Two*Colodas*"
 
Old 03-06-2007, 09:56 PM   #3
shinystuffrox
LQ Newbie
 
Registered: Jan 2005
Posts: 25

Original Poster
Rep: Reputation: 15
no hyphens, already tried using wildcards w/ same response in post....just forgot to mention them, sorry for not including that information.

I think I may have figured out a possible portion of the problem...since I don't think octal permissions exist in Windows (not sure on this though since I dont have Windows installed to check), anyways I think somehow the permissions on this directory are messed up from going from a linux ext3 fs to a windows ntfs and back to my current fs which is xfs...clearly there is some kinda permission problem..how to fix it i'm not sure of.

I think I'm going to have to drink a few cups of coffee, sit down and read over the od man page and info page thoroughly and see if there's a way to output the filename in something other than ascii chars and try deleting it in c program that way... at least that's what my professor says I could try. I'm not familiar with much C or od or file permissions other than the 421 rwx 2^2 2^1 2^0. I've tried chmod and chown with no success, get errors on permission for allowing chmod...this file has turned into a science project...and i hate it.

There are some similar issues in Windows with people having problems with getting windows to let go of using files where you can't delete them which makes me wonder if a fresh reboot will change anything...possibly boot into knoppiz and see if I cant delete through that. I don't use automount (saw a thread about that) at least I dont think I do...I dont remember installing it and equery list | grep automount doesnt produce anything, so I'm out of ideas...anyone else willing to bounce an idea off this is more than welcome, if your idea sucks it doesnt matter it may inspire me to think of something else from a different angle at the very least.

Last edited by shinystuffrox; 03-06-2007 at 10:06 PM.
 
Old 03-07-2007, 12:33 AM   #4
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
I've found that sometimes using konqueror to delete files works when cli doesn't - usually with files with strange characters.
 
Old 03-07-2007, 01:37 AM   #5
shinystuffrox
LQ Newbie
 
Registered: Jan 2005
Posts: 25

Original Poster
Rep: Reputation: 15
was worth the try dive, but unfortunately it didn't work...had my hopes up and everything!
 
Old 03-07-2007, 02:37 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You should also try mc (midnight commander)
 
Old 03-07-2007, 02:44 AM   #7
shinystuffrox
LQ Newbie
 
Registered: Jan 2005
Posts: 25

Original Poster
Rep: Reputation: 15
#include <stdio.h>
int main(int argc, char* argv[])
{
char *x[]={"/usr/bin/rm","/home/media/music/CD Files/Garth Brooks/Double Live/Disc 2/04 Two Piņa Coladas.mp3",NULL};
execve("/usr/bin/rm",x,x);
return 0;
}

okay where it says Two Pina Coladas.mp3 is the main point of interest here.
In my original post it was returning Pi\361a Coladas.mp3, so I looked up 0361 and that's i, the char before it, so i tried doing Piia with no luck...so when I do Pi<spanish n>a it returns

`/home/media/music/CD Files/Garth Brooks/Double Live/Disc 2/04 Two Pi\303\261a Coladas.mp3

so, what gives? i'm missing something..times like this i wish i had windows installed and could go through a charmap..but I dont

so, what char can I insert between the i and a in Pina to return Pi\361a...plz help me i am going insane.

also since it's a string do i need to do double backspaces or is quotes fine for this?

Last edited by shinystuffrox; 03-07-2007 at 02:46 AM.
 
Old 03-07-2007, 03:20 AM   #8
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Using wildcards with "*olodas*" didn't delete it?

Does the filename contain an "!"? A "!" in a filename has to be escaped or it will try to execute a previous command.
It might also contain curser or backspace characters.
Something else you could try is enabling the vim input method. Pressing "[CTRL]V and then 361 in the keypad might enter that character.

Something else to try is to copy the characters in the konsole, and past those characters into the end of the rm command. I've done this to cd into a directory that used Japanese or Chinese characters.

Is the filesystem OK. If it's bad it will be mounted readonly.


Also, what are the permissions on the file. What is the filesystem it is on. Can you write and delete other files there?

Last edited by jschiwal; 03-07-2007 at 03:28 AM.
 
Old 03-07-2007, 05:09 AM   #9
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
In addition to ls try lsattr to see if somehow the immutable flag got set.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
libgthread-1.2.so.0.0.10 operation not permitted dalmatyn Linux - Software 1 10-14-2005 01:49 PM
Operation not permitted jakkals Linux - General 3 09-26-2005 07:30 PM
su - operation not permitted jrtayloriv Linux - Newbie 2 06-09-2005 09:27 PM
operation not permitted jamaso Slackware 2 05-08-2004 05:55 AM
Operation not permitted FrozenShadow23 Linux - Newbie 6 10-05-2003 05:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration