2

When I login to one of my stations I get this output saying I have mail. But then running the mail commands Says I don't have any email.

What can I do to repair this problem?

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have mail.
Last login: Thu Nov 17 01:38:35 2016 from ***.***.***.***
psms1@psms:~$ mail
No mail for psms1
psms1@psms:~$ 
2
  • 1
    rm /var/spool/mail/psms1 ; logout and login to test. Commented Nov 17, 2016 at 9:21
  • 1
    Run that command and its looking good now. Thanks Commented Nov 17, 2016 at 10:35

3 Answers 3

2

Your mailbox is probably corrupted or some email client left there a residual byte/character. Another email client can even say it is empty.

As it is empty, the easier approach it to delete it with the command:

rm /var/spool/mail/psms1

As such, it will be recreated the next time you receive a message, and the mail command will be happy with it.

1

This is reported when the atime on your mail spool file(s) is the same as the mtime (i.e. the last access modified the file). It might be easier to think about the case where the access time is after the modification time - this implies you read your mail and the message is suppressed.

If you don't have new mail then something else most be changing the mtime on your spool file.

0

I tried Ribeiro's solution on a shared Mac with this same problem and was asked for sudo permissions I didn't have.

I tried echo "" > /var/mail/user but it didn't fix the problem.

Instead, cat /dev/null > /var/mail/user worked perfectly as a substitute to bypass the need for sudo permissions.

Edited on Thu, 06 Jul 2023 12:03:17 +0000: The mail path on the Mac was /var/mail/user, not /var/spool/mail/user as was my original answer.

3
  • 1
    That seems odd. Are you sure that cat /dev/null > /var/spool/mail/user worked without any additional changes? Commented Jun 23, 2023 at 2:48
  • Worked for me verbatim ¯\_(ツ)_/¯. Edit: Apologies, the mail file location is different, it's /var/mail/user so it required a change. Commented Jul 6, 2023 at 12:01
  • Your _echo "" > /var/mail/user_ (, assuming the path is corrected for any given system) would have written a newline to the file, leaving it non-empty and with a modification time ≥ access time. These two criteria trigger the message Commented Jul 6, 2023 at 13:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .