LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Where's the mail? No <user> directory in /var/mail (https://www.linuxquestions.org/questions/linux-newbie-8/wheres-the-mail-no-user-directory-in-var-mail-823365/)

genogebot 08-01-2010 07:33 AM

Where's the mail? No <user> directory in /var/mail
 
I've got Linux Mint 9 as my desktop system, and yesterday I installed Ubuntu Server 10.04 as a file server and backup storage.

I've read (and been told in forums) that I should have received system mail in the /var/mail/<user> directory - but in both systems the /var/mail/ directory is empty.

I set up smartmontools on Ubuntu Server with a configuration option to send me a test mail each time it starts, but again I have received no mail.

Has the sending of system mail been removed from recent linux releases, or is there something wrong with the both of my systems? Do I need to configure something to make it work?

zirias 08-01-2010 08:09 AM

Quote:

Originally Posted by genogebot (Post 4051626)
Has the sending of system mail been removed from recent linux releases, or is there something wrong with the both of my systems? Do I need to configure something to make it work?

First please understand email is not a /Linux/ feature so can't be added or removed. Most distributions will include an MTA (Mail Transport Agent) in their default installations -- this normally includes an MDA (Mail Delivery Agent) that is responsible to store incoming mail -- uhm -- somewhere :)

So, first thing if you THINK there should be mail for you: Find out what MTA/MDA is installed on your system. Popular choices are postfix, exim or sendmail. All of them are heavily configurable. /var/mail/$user is the /traditional/ location for mailboxes in mbox format, but it is not obligatory. Many mail systems nowadays use something like $HOME/.mail/ instead and there are several newer formats like e.g. mdir or maildir. As soon as you know which MTA/MDA is installed on your system, you can examine its configuration to find out.

genogebot 08-01-2010 09:13 AM

Quote:

Originally Posted by zirias (Post 4051641)
First please understand email is not a /Linux/ feature so can't be added or removed.

Ok thanks I didn't realise that - I assumed they were all pretty much the same in that regard.

Quote:

Originally Posted by zirias (Post 4051641)
As soon as you know which MTA/MDA is installed on your system, you can examine its configuration to find out.

Hunting around I discovered that Ubuntu Server uses the postfix mail system, which I remember seeing during the installation process.

Searching further I discovered that postfix writes logs into /var/log/, and looking at the mail.err log file showed a couple of different errors. Still more searching on those errors led me to find that there are some longstanding configuration problems that can happen with postfix (https://bugs.launchpad.net/ubuntu/+s...fix/+bug/42947 and http://ubuntuforums.org/archive/index.php/t-6392.html). I didn't find any explanation for the bugs, but by following the suggested fixes I got my mail working.

I assumed that Linux Mint, being derived from Ubuntu, would use the same system, but postfix isn't installed on Mint so maybe it uses a different system, or maybe none at all. It's after midnight here so I'm not doing any more searching tonight to find out.

Xanios 08-01-2010 09:34 AM

Hello genogebot, may i know how you got your mail working? I mean, the steps. I tried to install and configure postfix, but it ain't working.

Thanks.

themanwhowas 08-01-2010 10:38 AM

Xanios: http://www.howtoforge.com/sitemap/email/postfix

genogebot 08-01-2010 04:18 PM

Quote:

Originally Posted by Xanios (Post 4051691)
Hello genogebot, may i know how you got your mail working? I mean, the steps. I tried to install and configure postfix, but it ain't working.

Thanks.

Ok the fixes I applied to get the mail working in Ubuntu Server were at the end of each of the pages I linked to above. Specifically:

Quote:

sudo apt-get remove postfix
sudo dpkg --purge postfix
sudo apt-get -V install postfix

no reboot needed
then

Quote:

cd /etc
postfix stop
newaliases
postfix start
Hope this helps. I still haven't worked out whether this is relevant for Linux Mint 9.

genogebot 08-01-2010 04:25 PM

... and it turns out the /var/mail/<user> entry is a file, not a directory. It's a text file in which new mail is appended to the file. Presumably there are utilities to read and manage this file, but I'm just opening it in a text editor and deleting the contents when I've read it.

zirias 08-01-2010 06:54 PM

That's NOT a good idea. If you want to read mail from an mbox file directly, use for example mutt. As an alternative, there are several IMAP servers available that can serve mail from mbox files, for example dovecot.

Xanios 08-01-2010 07:57 PM

But, how do you know your mail is working? For me, at the last step i reloaded postfix, as given in the link above:

Code:

xanios@ubuntu:~$ sudo /etc/init.d/postfix reload
 * Reloading Postfix configuration...                                [ OK ]

And for /etc/postfix/main.cf, not sure if it's written correctly:

Code:

myhostname = ubuntu
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, $mydomain, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
myorigin = /etc/mailname
inet_protocols = ipv4
myorigin=$mydomain


genogebot 08-01-2010 09:37 PM

Quote:

Originally Posted by zirias (Post 4052073)
That's NOT a good idea.

Why? Does it damage something? I've done it several times with a few computer shutdowns in between and so far everything still seems to be working. But thanks, I'll hunt around for info on mutt.


Quote:

Originally Posted by Xanios (Post 4052073)
But, how do you know your mail is working?

Quote:

Originally Posted by genogebot (Post 4052073)
I set up smartmontools on Ubuntu Server with a configuration option to send me a test mail each time it starts

... and I have now received mail messages from smartmontools.

Xanios 08-01-2010 10:02 PM

Oh i see. Too bad my linux (ubuntu 9.10) doesn't support smartmontools.

genogebot 08-01-2010 10:27 PM

Quote:

Originally Posted by Xanios (Post 4052136)
Oh i see. Too bad my linux (ubuntu 9.10) doesn't support smartmontools.

Are you sure?

From the Wikipedia entry for smartmontools (http://en.wikipedia.org/wiki/Smartmontools) :

Quote:

Initial release October 2002
Quote:

All Linux distributions provide the smartmontools package

Xanios 08-02-2010 12:46 AM

Hi,

Ya.

i typed this to see if the "drive supports SMART"

Code:

xanios@ubuntu:~$ sudo smartctl -i /dev/sda
smartctl version 5.38 [i686-pc-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

Device: VMware,  VMware Virtual S Version: 1.0
Device type: disk
Local Time is: Sun Aug  1 20:03:08 2010 PDT
Device does not support SMART
xanios@ubuntu:~$


genogebot 08-02-2010 12:54 AM

Quote:

Originally Posted by Xanios (Post 4052233)
Device: VMware, VMware Virtual S Version: 1.0

Ah, ok you're running Ubuntu in a virtual machine - that's why smartmontools won't work for you.

Xanios 08-02-2010 01:37 AM

Oh i see. No wonder.


All times are GMT -5. The time now is 10:48 AM.