Google

2006-08-09

Installing mailx on Ubuntu Dapper

At work, I frequently use mailx on Solaris and I thought I could make use of it on my linux box too. I did not know how to install it but guessed right:
sudo apt-get install mailx
During the installation, it asked some questions which I did not know how to answer and just chose the defaults. Then I tried something like
ls -l |mailx myemail@address.com
which indeed did not work. Then I started reading and realized that I should have probably used "Satellite" mode during installation....

Removing it should be easy, right? Well, sure, if you know what you are doing! I did not :)
sudo apt-get remove mailx
said it removed the package but when I reinstalled it, it did not really ask me any questions which meant that I had not removed it completely. Reading some more on APT documentation, I learnt a few useful commands like
sudo apt-get --purge remove mailx
(would remove mailx together with "configuration files")
Nope! Then I cleaned the cache:
sudo apt-cache autoclean
(supposed to remove unupgradable packages from /var/cache/apt/archives)
and
sudo apt-cache clean
(Removes everything except locks from apt-cache archives)
Still, I was missing something. The command I was looking for was something like
rpm -qp 
or
rpm -qlp 
that would tell me more about package and its file.

I found something similar:
sudo apt-get depends mailx
mailx
Depends: libc6
Depends: liblockfile1
|Depends: postfix
Depends: <mail-transport-agent>
...
Depends: base-files
Conflicts: <suidmanager>
Aha, I needed to remove postfix too. As expected, after that I was able to get the install menu. I chose satellite and specified smtp.comcast.net as my relay host. I got an error when I tried the above mailx command though:
postdrop: warning: unable to look up public/pickup: No such file or directory

I did not find much info on the error but somebody was talking about authentication... Then, I remembered that comcast needs authentication and did some more google search and found a nice article.

I did everything mentioned but still the same issue. It looks like I am missing SASL now but readme is losing me...

[UPDATE - Aug.17 -2006]
Looking at the /var/log/mail.err files, I found out that it was complaining about a file missing
/etc/postfix/sasl_passwd.db
Then, I remembered that I had entered this line:
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
into /etc/postfix/main.cf
sasl_passwd file included something like this:
smtp.comcast.net myuserid:mypwd
but I had fat fingers and actually named the file not sasl_passwd but sasl_password and the accompanying .db file was named sasl_password.db. The thing is, running
sudo postmap sasl_passwd
gave me an update error. So I left it as is.

So I corrected both and now when I tail /var/log/mail.info, while I run something like
ls -l|mails myemail@address.com
I don't see errors:
Aug 17 00:13:20 ahlnx postfix/pickup[17245]: 6823B64707: uid=1000from=Aug 17 00:13:20 ahlnx postfix/cleanup[17973]: 6823B64707: message-id=<20060817041320.6823b64707@ahlnx>Aug 17 00:13:20 ahlnx postfix/qmgr[11714]: 6823B64707: from=, size=788, nrcpt=1 (queue active)

Bad news is, mail still does not arrive and I see this warning:
Aug 17 00:29:45 ahlnx postfix/master[4870]: warning: /usr/lib/postfix/smtp: bad command startup -- throttling

I still had a hunch that there not being able to update that .db file was not good. Even stopping postfix was not enough:
sudo /etc/init.d/postfix stop
So, I removed it. Then changed the permissions on /etc/postfix
sudo chmod 777 /etc/postfix
and ran the command again while I was in /etc/postfix directory :
sudo postmap sasl_passwd
I got relatively better results:
Aug 17 00:39:22 ahlnx postfix/pickup[18775]: CC18F63A35: uid=1000 from=
Aug 17 00:39:22 ahlnx postfix/cleanup[18784]: CC18F63A35:
message-id=<20060817043922.cc18f63a35@ahlnx>
Aug 17 00:39:22 ahlnx postfix/qmgr[18776]: CC18F63A35: from=,
size=788, nrcpt=1 (queue active)
Aug 17 00:39:23 ahlnx postfix/smtp[18781]: CC18F63A35: to=,
relay=smtp.comcast.net[63.240.77.77], delay=1, status=bounced (host 
smtp.comcast.net[63.240.77.77] said: 550 [PERMFAIL]
comcast.net requires valid sender
domain (in reply to RCPT TO command))
So, I needed to enter a valid address somewhere. Examining /etc/postfix/main.cf, I guessed that I had to activate this line:
myorigin=/etc/mailname
and created the file /etc/mailname, which included a single line like
comcast.net

That did the trick, and after reloading postfix
sudo /etc/init.d/postfix reload
I was able to send e-mails:
Aug 17 00:45:22 ahlnx postfix/master[18772]: reload configuration /etc/postfix

Aug 17 00:46:08 ahlnx postfix/pickup[19101]: 87A5163A35: uid=1000 from=

Aug 17 00:46:08 ahlnx postfix/cleanup[19148]: 87A5163A35:
message-id=<20060817044608.87a5163a35@ahlnx>

Aug 17 00:46:08 ahlnx postfix/qmgr[19102]: 87A5163A35: from=, size=2033, nrcpt=1 (queue active)Aug 17 00:46:09 ahlnx postfix/smtp[19150]: 87A5163A35: to=<destination@comcast.net>, relay=smtp.comcast.net[216.148.227.147], delay=1, status=sent (250 ok ; id=20060817044626m12001a30fe)
Aug 17 00:46:09 ahlnx postfix/qmgr[19102]: 87A5163A35: removed


That was some experience! But as always, it feels good to make something finally work :)
Post a Comment