LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 02-08-2007, 11:55 AM   #1
a.tsilfidis
LQ Newbie
 
Registered: Feb 2007
Location: Patras, Greece
Distribution: Debian, Slackware
Posts: 14

Rep: Reputation: 0
rm: cannot remove files(spam messages)


Hi everyone!

I'm running a small mail server. It has installed the slackware distro + qmail+spamassassin + clamav.
It's been a few days that I can't erase the spam messages from the folder they are stored.
When I 'm trying to see the contents of my spam directory with the ls command I take an output of many lines who look like this:

/usr/bin/ls: 'the_name_of_a_spam_message1' : No such file or directory
/usr/bin/ls: 'the_name_of_a_spam_message2' : No such file or directory
.
.
.

The du command shows that the directory is 25GB large but it also outputs:

du: cannot access 'the_names_of_a_spam_messages' : No such file or directory
.
.
.
and when I' trying to remove a message :

rm: cannot remove 'the_name_of_a_spam_message1': No such file or directory

Ive tried to change the ownership of these files to root
but the chown command outputs

chown: cannot access 'the_names_of_a_spam_messages' : No such file or directory

Any ideas??Is there a way to remove these files and free my precious diskspace??

THANX in advance to anyone that can give a solution!

this forum rules!
 
Old 02-08-2007, 12:45 PM   #2
ChrisScott
Member
 
Registered: Nov 2006
Location: St Albans, England
Distribution: Fedora c3/5, Suse pro 10/openSuse 10.2, RHES, Zenwalk.....
Posts: 97

Rep: Reputation: 15
have you tried:
Code:
rm -f spam_message
the -f or --force flag ignores non-existent files
 
Old 02-08-2007, 12:51 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,693
Blog Entries: 54

Rep: Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961
...and if that doesn't work:

/usr/bin/ls: 'the_name_of_a_spam_message1' : No such file or directory
I thought it was "/bin/ls"?

Are you executing all commands as root account user?
Is the partition that holds the spam directory mounted readwrite?
What is the partitions' filesystem (Ext, Reiser, etc, etc)?
What are the access rights and ownership of the spam directory itself (stat or ls -d)?
What are the access rights and ownership of the spam files (find /the/spam/dir -ls)?
Any extended attributes set (lsattr)?
Is any process holding the files open (lsof -w -n +/the/spam/dir)?

And please post *exact* lines of commands and results if you're gonna post any.
 
Old 02-09-2007, 08:08 AM   #4
a.tsilfidis
LQ Newbie
 
Registered: Feb 2007
Location: Patras, Greece
Distribution: Debian, Slackware
Posts: 14

Original Poster
Rep: Reputation: 0
Thanx for the replies!

1.Unfortunately, it seems that the rm -f does nothing .

When I execute it (for example 'rm -f filename1') I see nothing on the screen as if everything went ok.
But after that the 'ls' command still gives me:
/usr/bin/ls: 'filename1' : No such file or directory

2.I've found the server as it is from anotherperson and for a reason that I don't know he/she decided to put the majority of the commands into /usr/bin instead of /bin

3. Yes I'm running the commands as root and the partition is mounted readwrite. (in fact everything worked fine 2 weeks ago. then I got seek and I wasn't able to check the server for 10 days and then oops the problem was there...)

4. My mtab file looks like this (for the hdc6 where home is mounted):
/dev/hdc6 /home reiserfs rw,noatime,nodiratime,notail 0 0

5.The stat command for the spam directory gives me :
File: `new'
Size: 3155224 Blocks: 6162 IO Block: 131072 directory
Device: 1606h/5638d Inode: 294 Links: 2
Access: (0700/drwx------) Uid: ( 0/ root) Gid: ( 501/services)
Access: 2006-10-12 22:12:50.000000000 +0300
Modify: 2007-02-09 14:13:53.000000000 +0200
Change: 2007-02-09 14:13:53.000000000 +0200

6. The "find /myspamdirectory -ls" outputs:

294 3081 drwx------ 2 root services 3155224 Feb 9 14:13 new

but then it stucks and the Ctrl+C command is needed to go on.

7.the lsattr command gives me

------------- ./new
I thing this means that no extended attributes are set into this directories. The same happens for the files in that directory.

8. Finally the lsof -w -n +/the/spam/dir command gives no output. I suppose that this means that no service is holding this directory.


Another thing that I've pointed out is that the du -h /myspamdirectory doesn't work: the computer stucks and a Ctrl+C is needed again. (sometimes the ls stucks too and then I take ls: memory exhausted...)

A possibly stupid idea that came into my head: is there any possibility that spamassassin who is responsible for writing the files in there gave to many different files the same name and this completely messes up the system?

Appart from all that a final point that gave me a nervous breakdown today: the 'tmp' folder in the Mailbox where the spam messages are stored is not acessible anymore. In fact all the related commands result to a 'permission denied'.
Yesterday (and I'm really sure about that) I was in there and I was comparing the messages behaviour to that of the other problematic folder(and of course I'sure I didn't touch the permissions....).
 
Old 02-09-2007, 08:35 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,693
Blog Entries: 54

Rep: Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961
OK. Only things come to mind are checking syslogs for clues or else it might be a Reiser-centric problem. Some people swear Reiser is "safe", performant and otherwise generally OK but I've never seen the spontaneous and blocking errors it gives in say Ext.*... Maybe run some Reiserfs checks first to validate its integrity.
 
Old 02-09-2007, 09:51 AM   #6
ChrisScott
Member
 
Registered: Nov 2006
Location: St Albans, England
Distribution: Fedora c3/5, Suse pro 10/openSuse 10.2, RHES, Zenwalk.....
Posts: 97

Rep: Reputation: 15
Know it sounds silly but you don't have any bad characters in there (/, \ or \0 namely). If so you can delete them using inode numbers...

Last edited by ChrisScott; 02-09-2007 at 09:53 AM.
 
Old 02-09-2007, 09:55 AM   #7
a.tsilfidis
LQ Newbie
 
Registered: Feb 2007
Location: Patras, Greece
Distribution: Debian, Slackware
Posts: 14

Original Poster
Rep: Reputation: 0
ok I will try to run reiserfsck so as to see what's happening.
(i will wait until a moment that my server isn't busy and i'll try to make a backup of the hd before running this...)
i'll post the results here...
thanx a lot unSpawn!
 
Old 02-09-2007, 09:58 AM   #8
a.tsilfidis
LQ Newbie
 
Registered: Feb 2007
Location: Patras, Greece
Distribution: Debian, Slackware
Posts: 14

Original Poster
Rep: Reputation: 0
well in fact thanx a lot everyone!!!!))
 
Old 02-09-2007, 10:13 AM   #9
a.tsilfidis
LQ Newbie
 
Registered: Feb 2007
Location: Patras, Greece
Distribution: Debian, Slackware
Posts: 14

Original Poster
Rep: Reputation: 0
just checked that : I can't delete them with the inode number and the primary reason is that I can't find the inode numbers of these files.
All the related commands refuse to work...
 
Old 02-09-2007, 10:33 AM   #10
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
There is a "feature" to Linux.

If you delete a file that some other application has locked, it will appear to delete, but not really. The directory entries will vanish and you'll get the symptoms you describe. However, the app that had the lock on that file can and will continue to write to it.

Try doing an lsof to see who is holding that file open (your mail server perhaps?). When you find the culprit, shut down that service so that the file gets closed, which should cause it to vanish.
 
Old 02-09-2007, 11:18 AM   #11
a.tsilfidis
LQ Newbie
 
Registered: Feb 2007
Location: Patras, Greece
Distribution: Debian, Slackware
Posts: 14

Original Poster
Rep: Reputation: 0
Yeah I did try the lsof.
But lsof can't see these strange files...

lsof: status error on filename: No such file or directory
 
Old 02-09-2007, 11:57 AM   #12
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
no, you do an lsof on all open files and look to see if yours is there anyplace.

lsof | grep myfile

If you specify the file then lsof checks the directory structure first. Well, we already know your file has been removed from the directory structure.
 
Old 02-09-2007, 12:41 PM   #13
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,693
Blog Entries: 54

Rep: Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961
If it really is about deleted files it might be easier to spot with "lsof|grep '(del' ".
It does explain the "No such file or directory" but it doesn't explain commands getting stuck.
 
Old 02-09-2007, 01:31 PM   #14
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
Quote:
Originally Posted by unSpawn
If it really is about deleted files it might be easier to spot with "lsof|grep '(del' ".
It does explain the "No such file or directory" but it doesn't explain commands getting stuck.
I cannot tell you exactly why it happens, but I have seen this kind of thing (commands getting stuck) when there is a file in the directory that has been deleted (but "not really") and you do anything that might access that file.

I first encountered this and posted about it regarding the .xsession-errors file and kplayer. Posted last summer or fall; it's here someplace but I haven't done a search to find the thread.
 
Old 02-09-2007, 05:52 PM   #15
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,693
Blog Entries: 54

Rep: Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961Reputation: 2961
I cannot tell you exactly why it happens, but I have seen this kind of thing (commands getting stuck) when there is a file in the directory that has been deleted (but "not really") and you do anything that might access that file.
No, I'm not asking you to explain, it's just that I find it fascinating. I've been in some situations too where I didn't even have rights as root user: all rights gone, recursively. Luckily there's debugfs. (BTW your thread is http://www.linuxquestions.org/questi...d.php?t=435420 but I see no relation to this one, could be me.)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Need to remove relays.visi.com from spam verification Brydon Linux - Networking 1 01-21-2007 12:59 PM
procmail won't remove spam from fetchmail'ed mail alesz Linux - Networking 4 06-08-2006 02:13 PM
yahoo marks Gmail messages as spam arunswarup General 8 11-04-2005 10:45 AM
Whats the solution to remove spam at the server site? Niceman2005 Linux - General 1 09-22-2005 11:30 PM
Identifying incoming spam vs. bounced messages chud67 Linux - General 0 07-26-2004 01:32 PM


All times are GMT -5. The time now is 12:53 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration