WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: HELP: msmtp + gmail = ???  (Read 5632 times)

Offline sudoer

  • Newbie
  • *
  • Posts: 6
HELP: msmtp + gmail = ???
« on: April 19, 2012, 05:42:36 PM »
I'm trying to send email from the command line and going nowhere fast...

$ ls -l ~/.wbar
-rw-r--r-- 1 tc staff 45 Mar 25 18:19 /home/tc/.wbar
$ cat .wbar | msmtp --debug --from=default sudoer@gmail.com
ignoring system configuration file /usr/local/etc/msmtprc: No such file or directory
loaded user configuration file /home/tc/.msmtprc
falling back to default accountusing account default from /home/tc/.msmtprc
host                  = smtp.gmail.com
port                  = 587
timeout               = off
protocol              = smtp
domain                = localhost
auth                  = choose
user                  = sudoer
password              = *
passwordeval          = (not set)
ntlmdomain            = (not set)
tls                   = on
tls_starttls          = on
tls_trust_file        = /home/tc/.certs/Equifax_Secure_CA.pem
tls_crl_file          = (not set)
tls_fingerprint       = (not set)
tls_key_file          = (not set)
tls_cert_file         = (not set)
tls_certcheck         = on
tls_force_sslv3       = off
tls_min_dh_prime_bits = (not set)
tls_priorities        = (not set)
auto_from             = off
maildomain            = (not set)
from                  = default
dsn_notify            = (not set)
dsn_return            = (not set)
keepbcc               = off
logfile               = (not set)
syslog                = (not set)
reading recipients from the command line and the mail
<-- 220 mx.google.com ESMTP tx2sm4003835obb.8
--> EHLO localhost
<-- 250-mx.google.com at your service, [63.225.223.32]
<-- 250-SIZE 35882577
<-- 250-8BITMIME
<-- 250-STARTTLS
<-- 250 ENHANCEDSTATUSCODES
--> STARTTLS
<-- 220 2.0.0 Ready to start TLS
Illegal instruction
$

Not sure what the SIZE refers to (certainly not the message content!) but my .msmptrc
[ETA - note to self , size is maximum message size allowed by server]

$ cat ~/.msmptrc
account default
host smtp.gmail.com
port 587
protocol smtp
auth on
from sudoer@gmail.com
user sudoer
password freakingnuts
tls on
tls_starttls on
tls_trust_file /home/tc/.certs/Equifax_Secure_CA.pem
$

I thought perhaps it was the need for a tls_trust_file since my last experience years ago with msmtp (sarge)
didn't require it (what TC extension installs these files?). I copied this one from the internet, but I don't believe
it is the culprit to my immediate problem. Removing its spec from .msmtprc and using --tls-certcheck=off gave the same fatal result

"Illegal instruction"

After almost 10 hours at this game of solitaire (I'm losing), I need a new perspective.

$ msmtp --version
msmtp version 1.4.24
Platform: i686-pc-linux-gnu
TLS/SSL library: GnuTLS
Authentication library: built-in
Supported authentication methods:
plain cram-md5 external login
IDN support: enabled
NLS: enabled, LOCALEDIR is /usr/local/share/locale
Keyring support: none
System configuration file name: /usr/local/etc/msmtprc
User configuration file name: /home/tc/.msmtprc

Copyright (C) 2010 Martin Lambers and others.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
$

Anybody sucessfully set up msmtp with gmail under TC? If so, how?

TIA

:(
« Last Edit: April 19, 2012, 10:28:28 PM by sudoer »

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: HELP: msmtp + gmail = ???
« Reply #1 on: April 19, 2012, 08:04:57 PM »
What is your CPU? Whilst uname -m provides an answer, a better way to answer this question would be IMHO to post the output of: cat /proc/cpuinfo

AFAIK the 'Illegal instruction' error gets thrown when one executes an opcode on an older CPU (e.g. 'i486') that is only available on a newer one (e.g. 'i686') . For that reason the wiki suggest to compile extensions with 'CFLAGS' containing 'march=i486', which should limit the compiler to only produce code that is compatible with CPUs from 'i486' onwards.

Therefore chances are if you have an older CPU that one of the executables (or shared libraries) was not compiled with the necessary care.

Offline sudoer

  • Newbie
  • *
  • Posts: 6
Re: HELP: msmtp + gmail = ???
« Reply #2 on: April 19, 2012, 10:25:53 PM »
Thanks.

$ cat /proc/cpuinfo
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 6
model           : 8
model name      : AMD Athlon(tm)
stepping        : 0
cpu MHz         : 1143.916
cache size      : 256 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse syscall mmxext 3dnowext 3dnow up
bogomips        : 2288.15
clflush size    : 32
cache_alignment : 32
address sizes   : 34 bits physical, 32 bits virtual
power management: ts

I can do this OK ...

$ msmtp --host=smtp.gmail.com --port=587 --serverinfo --debug
using account specified on command linehost                  = smtp.gmail.com
port                  = 587
timeout               = off
protocol              = smtp
domain                = localhost
auth                  = none
user                  = (not set)
password              = (not set)
passwordeval          = (not set)
ntlmdomain            = (not set)
tls                   = off
tls_starttls          = on
tls_trust_file        = (not set)
tls_crl_file          = (not set)
tls_fingerprint       = (not set)
tls_key_file          = (not set)
tls_cert_file         = (not set)
tls_certcheck         = on
tls_force_sslv3       = off
tls_min_dh_prime_bits = (not set)
tls_priorities        = (not set)
<-- 220 mx.google.com ESMTP m2sm4726270obk.9
--> EHLO localhost
<-- 250-mx.google.com at your service, [63.225.223.32]
<-- 250-SIZE 35882577
<-- 250-8BITMIME
<-- 250-STARTTLS
<-- 250 ENHANCEDSTATUSCODES
--> QUIT
<-- 221 2.0.0 closing connection m2sm4726270obk.9
SMTP server at smtp.gmail.com (smtp.gmail.com [173.194.77.108]), port 587:
    mx.google.com ESMTP m2sm4726270obk.9
Capabilities:
    SIZE 35882577:
        Maximum message size is 35882577 bytes = 34.22 MiB
    STARTTLS:
        Support for TLS encryption via the STARTTLS command
This server might advertise more or other capabilities when TLS is active.
$

but if I try to enable TLS (either via .msmtp's default account or command line options)
to see "more or other capabilities" I encounter the "Illegal instruction"

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: HELP: msmtp + gmail = ???
« Reply #3 on: April 20, 2012, 04:40:54 AM »
Well, this is now starting to make some sense: you've got a (rather old) AMD CPU and one of the dependencies (i.e. 'gmp.tcz') contains a shared library (i.e. 'libgmp.so.10.0.2') that (in function 'gmpn_mul_basecase') uses an opcode (i.e. 'pmuludq') that according to this Wikipedia page is a 'SSE2' instruction. BUT your CPU only supports 'SSE' instructions, as can be seen by the fact that 'sse' is amongst the 'flags' in the '/proc/cpuinfo' output (but not 'sse2').

In case you are wondering how I've came up with all these details, I've got to first admit that I still own a (rarely used) system with an almost as old CPU (i.e. 'Athlon XP'). After a bit of poking around I managed to replicate your reported failure using the details for '~/.msmptrc' from the OP (and after also creating '~/.certs/Equifax_Secure_CA.pem'). I then observed that I'd also run into the same issue with just msmtp sudoer@gmail.com

So I next installed 'gdb.tcz' and prepared to use the debugger (e.g. via gdb --args msmtp sudoer@gmail.com). I just had to use 'gdb' command 'run' to start it, and it failed with:
Quote
Starting program: /usr/local/bin/msmtp sudoer@gmail.com
...
Program received signal SIGILL, Illegal instruction.
0xb7563c5e in __gmpn_mul_basecase () from /usr/local/lib/libgmp.so.10
I then used 'gdb' command 'disassemble' to get an assembler listing of the surrounding function. After hitting the 'Enter' key a few times one gets to the "offending" opcode (that stood out due to the marker in front of it):
Code: [Select]
   ...
   0xb7563c56 <+406>:   sub    0x18(%esp),%ecx
   0xb7563c5a <+410>:   mov    %ecx,0x18(%esp)
=> 0xb7563c5e <+414>:   pmuludq %mm7,%mm3
   0xb7563c61 <+417>:   movd   0x4(%eax),%mm0
   0xb7563c65 <+421>:   pmuludq %mm7,%mm0
   ...

I've since done a quick rebuild of the problematic shared library, and using this new one (where I set 'CFLAGS' to "-march=i486 -mtune=i686 -Os -pipe" as recommended in the Wiki) the 'Illegal instruction' was not seen any more.

I guess this means that 'gmp.tcz' will need to be properly rebuild for the benefit of the whole community (maybe even "bumped up" to v5.0.4).

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: HELP: msmtp + gmail = ???
« Reply #4 on: April 20, 2012, 08:28:23 AM »
I guess I've been a bit too hasty in my conclusion: After I had created a test version of 'gmp.tcz' on my AMD CPU (where it seemed to have resolved the original problem) I went back to an Intel system and ran another build. As it turned out this one worked fine on the Intel CPU, but back on the AMD system it became clear that the same 'SSE2' instructions had found their way back into it (even though 'CFLAGS' was properly set).

So there has to be a further setting required to ensure that not the native CPU is used to determine the level of opcode compatibility. I have a certain hunch what might be needed, but it's already way too late to take this any further tonight.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: HELP: msmtp + gmail = ???
« Reply #5 on: April 20, 2012, 09:33:14 AM »
It seems GMP configure checks the host cpu. On a quick look --host=i486-pc-linux-gnu might work.
The only barriers that can stop you are the ones you create yourself.

Offline sudoer

  • Newbie
  • *
  • Posts: 6
Re: HELP: msmtp + gmail = ???
« Reply #6 on: April 20, 2012, 09:39:37 AM »
WOW, you guys are great! Looks like I'll have a go at gmp.tcz here on this obsolete machine myself (hey it still works, mostly) later today.

Thanks again

:2T:

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14815
Re: HELP: msmtp + gmail = ???
« Reply #7 on: April 21, 2012, 07:33:20 AM »
Rebuilt as follows:
Code: [Select]
CFLAGS='-march=i486 -mtune=i686 -Os -pipe' CXXFLAGS='-march=i486 -mtune=i686 -Os -pipe' ABI=32 ./configure --prefix=/usr/local --enable-cxx --enable-mpbsd --host=i486-pc-linux-gnu

...
using ABI="32"
      CC="gcc -std=gnu99"
      CFLAGS="-march=i486 -mtune=i686 -Os -pipe"
      CPPFLAGS=""
      CXX="g++"
      CXXFLAGS="-march=i486 -mtune=i686 -Os -pipe"
      MPN_PATH=" x86/i486 x86 generic"

Maybe you could test the rebuilt extension from here:

http://distro.ibiblio.org/tinycorelinux/4.x/x86/tcz/src/gmp

..and let me know if it works

Offline sudoer

  • Newbie
  • *
  • Posts: 6
Re: HELP: msmtp + gmail = ??? (RESOLVED)
« Reply #8 on: April 21, 2012, 11:19:20 AM »
100% "legal" Juanito

Thank you so much for your help

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14815
Re: HELP: msmtp + gmail = ???
« Reply #9 on: April 21, 2012, 12:15:38 PM »
No problem - updated version posted