Bug 11429 - mailx does not work
Summary: mailx does not work
Status: RESOLVED INVALID
Alias: None
Product: Mageia
Classification: Unclassified
Component: Installer (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal major
Target Milestone: ---
Assignee: Mageia Bug Squad
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-10 12:50 CEST by Barry Jackson
Modified: 2014-12-17 18:48 CET (History)
1 user (show)

See Also:
Source RPM:
CVE:
Status comment:


Attachments

Description Barry Jackson 2013-10-10 12:50:43 CEST
Description of problem:
I am not a regular CLI mail(x) user, but have been attempting to get this working.

At the CLI as user:

$ mail -s "Hello" baz

initially complains that sendmail is missing.
After installing sendmail, the mail appears to be sent OK, however on checking mail:
[baz@jackodesktop ~]$ mail
No mail for baz
[baz@jackodesktop ~]$

On inspecting the /var/spool/mail/ directory there is no /var/spool/mail/baz
which is my user created at install.
However creating a new user "joe" in mcc does create a /var/spool/mail/joe.

Changing to user joe and sending a mail to joe produces "no mail for joe"

Doubting my sanity I did exactly the same test in Pedora on my Raspberry-Pi and it just works:

[baz@raspi ~]$ mail -s "test for bug report" baz
Hi just testing mail in raspi :)
.
EOT
[baz@raspi ~]$ mail
Heirloom Mail version 12.5 7/5/10.  Type ? for help.
"/var/spool/mail/baz": 2 messages 1 new
    1 Barry Jackson         Fri Aug 30 15:37  21/732   "hello"
>N  2 Barry Jackson         Sat Aug 31 03:01  20/762   "test for bug report"
& Held 2 messages in /var/spool/mail/baz
[baz@raspi ~]$

Seems raspi's clock is wrong ;)

So, this is broken in Cauldron and tests in 3 were no better, unless I am just doing something wrong?

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.


Reproducible: 

Steps to Reproduce:
Comment 1 Bit Twister 2013-10-10 13:34:48 CEST
(In reply to Barry Jackson from comment #0)
> Description of problem:
> I am not a regular CLI mail(x) user, but have been attempting to get this
> working.
> 
> At the CLI as user:
> 
> $ mail -s "Hello" baz


I use mail -s "test shot" $USER < /dev/null        :)
 
> initially complains that sendmail is missing.
> After installing sendmail, 

sendmail is not installed on my system.

> the mail appears to be sent OK, however on

You might consider clicking up a terminal and doing
su - root

journal -fa


Now in another terminal run
mail -s "test shot" $USER < /dev/null
and see if there are any messages in the journal.

> checking mail:
> [baz@jackodesktop ~]$ mail
> No mail for baz

You need a Mail Transport Agent (MTA) to receive the mail. Mine has postfix which is enabled by default.

> [baz@jackodesktop ~]$
> 
> On inspecting the /var/spool/mail/ directory there is no /var/spool/mail/baz
> which is my user created at install.
> However creating a new user "joe" in mcc does create a /var/spool/mail/joe.

That is neat. I will get a /var/spool/mail/$USER when mail needs to be delivered so it should not be mandatory to have one created.

What happens when I install from a DVD iso, it always installs postfix and that rpm creates a /usr/sbin/sendmail link to /etc/alternatives/sendmail-command
which points to /usr/sbin/sendmail.postfix

Postfix would like for you to modify  /etc/aliases file to point root's email to a user on the system, Example
    # Person who should get root's mail.  This alias
    # must exist.
    # CHANGE THIS LINE to an account of a HUMAN
root:           bittwister


run "postalias aliases" and postfix restart.

CC: (none) => junknospam

Comment 2 Bit Twister 2013-10-10 13:37:46 CEST
(In reply to Bit Twister from comment #1)
> 
> journal -fa

Sorry, that should read
  journalctl -fa
Comment 3 Barry Jackson 2013-10-10 14:57:35 CEST
Hi,

After installing postfix (which is not installed by the Alpha3 DVD in a full KDE install) it removed sendmail due to conflict.

installing libpostfix1-2.10.2-1.mga4.i586.rpm postfix-2.10.2-1.mga4.i586.rpm from /var/cache/urpmi/rpms       
Preparing...                     ############################################################################
      1/2: libpostfix1           ############################################################################
      2/2: postfix               ############################################################################
Generating a 1024 bit RSA private key
........................++++++
.................................++++++
writing new private key to '/etc/pki/tls/private/postfix.pem'
-----
postfix.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig postfix on
removing package sendmail-8.14.7-2.mga4.i586
      1/1: removing sendmail-8.14.7-2.mga4.i586
                                 ############################################################################

Now an attempt to send mail outputs this:

[baz@localhost ~]$ mail -s "mail shot" $USER < /dev/null
[baz@localhost ~]$ postdrop: warning: unable to look up public/pickup: No such file or directory

journal:
Oct 10 13:35:51 localhost postfix/postdrop[4294]: warning: unable to look up public/pickup: No such file or directory
Comment 4 Bit Twister 2013-10-10 15:49:29 CEST
(In reply to Barry Jackson from comment #3)
> Hi,
> 
> After installing postfix (which is not installed by the Alpha3 DVD in a full
> KDE install) 

Sounds like that should be fixed. I always use Mageia-*-x86_64-DVD.iso because I use both gnome and kde apps.

> postfix.service is not a native service, redirecting to /sbin/chkconfig.
> Executing /sbin/chkconfig postfix on

Yes, I have been meaning to write up a bug report about handshaking between the sysinit and systemd handoff. Seems like a postfix restart, causes constant FAILED when running systemctl --failed     :(


> [baz@localhost ~]$ mail -s "mail shot" $USER < /dev/null
> [baz@localhost ~]$ postdrop: warning: unable to look up public/pickup: No
> such file or directory
> 
> journal:
> Oct 10 13:35:51 localhost postfix/postdrop[4294]: warning: unable to look up
> public/pickup: No such file or directory

As root
systemctl enable postfix.service

and reboot your system and see if that helps.
Comment 5 Barry Jackson 2013-10-10 18:07:43 CEST
OK thanks, it works, postfix.service was not running. Now it is 'I got mail' and as you suggested /var/spool/mail/baz has been created :)

I didn't reboot - I just enabled and then started the service.

So it seems to me that postfix should be installed and enabled by default in all Mageia installations, as 'mail' is just expected to work in 'nixes out of the box, if what I have been reading is correct.
It certainly does in Pidora.
Comment 6 Bit Twister 2013-10-10 18:35:10 CEST
(In reply to Barry Jackson from comment #5)
> OK thanks, it works, postfix.service was not running. Now it is 'I got mail'
> and as you suggested /var/spool/mail/baz has been created :)
> 
> I didn't reboot - I just enabled and then started the service.

As root, I hope you changed 
from     root:           postfix
to       root:           baz
at the bottom of /etc/postfix/aliases and
cd /etc/postfix
postalias aliases
systemctl restart postfix.service
mail -s "root mail test shot" $USER < /dev/null

Then in a baz terminal, verified baz received a mail from root to root.

> So it seems to me that postfix should be installed and enabled by default in
> all Mageia installations, as 'mail' is just expected to work in 'nixes out
> of the box, if what I have been reading is correct.

I agree that the KDE DVD should have installed/enabled postfix.
I never checked if the Mageia DVD does or not. I pick the custom install, and check the mail server box http://doc.mageia.org/installer/3/en/content/choosePackageGroups.html
Comment 7 James Kerr 2013-10-10 20:00:47 CEST
IIRC postfix has never been installed by default in Mandriva/Mageia. I'm fairly sure that I've always had to choose to install it.

There was a discussion some time ago (I think in the dev ML) about installing by default a "light-weight" MTA so that users could receive mails from MSEC etc, but I don't remember what decision, if any, was reached.
Comment 8 Barry Jackson 2013-10-10 22:50:12 CEST
(In reply to James Kerr from comment #7)
> IIRC postfix has never been installed by default in Mandriva/Mageia. I'm
> fairly sure that I've always had to choose to install it.
> 
> There was a discussion some time ago (I think in the dev ML) about
> installing by default a "light-weight" MTA so that users could receive mails
> from MSEC etc, but I don't remember what decision, if any, was reached.

Thanks Jim - yes seaching back I found it, http://archives.mageia.org/zarb-ml/mageia-dev/2011-September/008289.html

Seems I trod on a hornet's nest :\

However this is the same issue - basically mailx (nail) is required by msec and is therefore installed by default, but it does not work.

For my purposes installing postfix with Bit Twister's help has solved my immediate issue (I want to set up journal-triggerd to mail me when certain journal messages occur).

So, the basic issue is unchanged, we have an MTA installed by default that seems to not work.

@ Bit Twister,
No I hadn't set up the alias bit, but I have now and all works fine - many thanks.
Having read that enormous thread, and taken on board some of the arguments there, I think I would on balance agree that inflicting postfix on all users would probably be a bad idea, however mailx should work, as it does (out of the box) on my RasPi where mailx and sendmail are installed.
Barry Jackson 2013-10-10 22:51:22 CEST

Summary: mail(x) does not work and /var/spool/mail/user not created for primary user at install => mailx does not work

Comment 9 Barry Jackson 2013-10-11 13:15:58 CEST
On attempting to send mail in a fresh clean cauldron installation (VM) (with sendmail installed) using:
[baz@localhost ~]$ mail -s "Hello" $USER </dev/null

There is no error message in terminal however the journal reports:

Oct 11 12:09:35 localhost sendmail[16743]: My unqualified host name (localhost) unknown; sleeping for retry
Oct 11 12:10:35 localhost sendmail[16743]: unable to qualify my own domain name (localhost) -- using short name
Oct 11 12:10:35 localhost sendmail[16743]: r9BBAZBZ016743: from=baz, size=209, class=0, nrcpts=1, msgid=<201310111110.r9BBAZBZ016743@localhost>, relay=baz@localhost
Oct 11 12:10:35 localhost sendmail[16743]: r9BBAZBZ016743: to=baz, ctladdr=baz (500/500), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30209, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
Comment 10 Barry Jackson 2013-10-11 13:26:52 CEST
I realized that shorewall was running and stopped it, however the only change is that the line:
Oct 11 12:22:27 localhost sendmail[18474]: unable to qualify my own domain name (localhost) -- using short name
no longer appears - the connection is still refused by 127.0.0.1
Comment 11 Bit Twister 2013-10-11 14:17:34 CEST
(In reply to Barry Jackson from comment #9)
> 
> There is no error message in terminal however the journal reports:
> 
> Oct 11 12:09:35 localhost sendmail[16743]: My unqualified host name
> (localhost) unknown; sleeping for retry

Yep, a few applications like a FQDN, examples mysqld, postfix, sendmail, leafnode, dovecot,.
http://www.rfc-editor.org/rfc/rfc2606.txt

This is not a shorewall problem. Warning, anytime you change node name/FQDN you should reboot the system. When node name changes, you can lose access to your GUI desktop.

Pick a name for your node and whatever you want for the domain as long as it ends in invalid or test. My router hands out dhcp ip addresses. I picked the ip address farther down the list so all my nodes have a static ip address and yet allow any other devices to obtain a dynamic address. As a result my /etc/hosts has my static ip address, FQDN, alias, and my /etc/hostname has a matching FQDN
/etc/hostname is used to set your node name during boot.

$ cat /etc/hostname 
wb.home.test

$ grep wb.home.test /etc/hostname
wb.home.test

If you are not going to hard code your ip address, you might try a /etc/hosts entry like
127.0.0.2 darkstar.myplace.test darkstar

and /etc/hostname contains darkstar.myplace.test
Comment 12 Bit Twister 2013-10-11 14:21:00 CEST
(In reply to Bit Twister from comment #11)
> $ grep wb.home.test /etc/hostname
> wb.home.test
Sorry that should have been
$ grep wb.home.test /etc/hosts
192.168.1.132 wb.home.test wb

Snippet of my hosts file
$ head -4 /etc/hosts
127.0.0.1 localhost.localdomain localhost
192.168.1.1 gateway.home.test gateway
192.168.1.100 tb.home.test tb
192.168.1.132 wb.home.test wb
Comment 13 Barry Jackson 2013-10-11 15:04:44 CEST
OK - this seems to be an issue with drakconnect.
In a fresh install /etc/hosts has:
                                                                            
# generated by drakconnect                                                                     
127.0.0.1 localhost

Changing ONLY this to:

127.0.0.1 localhost.localdomain localhost

fixes the issue.

Suddenly on re-boot I have:
[baz@localhost ~]$ mail
Heirloom mailx version 12.4 7/29/08.  Type ? for help.
"/var/spool/mail/baz": 5 messages 5 new
>N  1 Barry Jackson      Fri Oct 11 13:52   20/849   Hello
 N  2 Barry Jackson      Fri Oct 11 13:52   20/849   Hello
 N  3 Barry Jackson      Fri Oct 11 13:52   20/849   Hello
 N  4 Barry Jackson      Fri Oct 11 13:52   20/849   Hello                                                     
 N  5 Barry Jackson      Fri Oct 11 13:52   20/849   Hello                                                     
? Held 5 messages in /var/spool/mail/baz

So I'm guessing that if sendmail was installed by default and drakconnect wrote the /etc/hosts as above (as IIRC it used to do) then mail would work out of the box?
Comment 14 Barry Jackson 2013-10-11 15:14:08 CEST
I just looked in my /etc/hosts for Mageia 1 and guess what:
# generated by drakconnect
127.0.0.1 localhost.localdomain localhost
Comment 15 David Walser 2014-12-17 18:48:49 CET
Didn't Mandriva used to run postfix by default?

Anyway, this bug is INVALID, it just needs an MTA to be running and works fine.

As to whether we should have one by default, obviously that's an old debate.  Fedora actually traditionally had one, but recently (Fedora 20 IIRC) stopped installing sendmail by default.

Status: NEW => RESOLVED
Resolution: (none) => INVALID


Note You need to log in before you can comment on or make changes to this bug.