Solved /usr/bin/mail hangs

Strange problem. Just upgraded a FreeBSD 12.4 server to 13.3, then updated all packages. No problems, as usual and expected.

EXCEPT: Since then, the command /usr/bin/mail just hangs for normal users. It works for root. The command /usr/local/bin/mail (comes from the mailtools package, installed due to emacs) works fine, as does using sendmail directly. The machine is configured with sendmail turned off, instead using ssmtp, for direct delivery of mail to an outside smarthost; that part can't be completely broken, since invoking sendmail directly and using the mailtools version are working.

Here are the last 10 lines from "truss /usr/bin/mail -s test ralph@valid.example.com":
Code:
mmap(0x0,1112,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 68978910466048 (0x3ebc67749000)
minherit(0x3ebc67749000,1112,INHERIT_ZERO)     = 0 (0x0)
getrandom("\M-zd\^\B\M-'bE\M^\\M^Ab3\M-k""...,40,0) = 40 (0x28)
openat(AT_FDCWD,"/tmp/mail.Rs0LF1ve4nN2",O_RDWR|O_CREAT|O_EXCL,0600) = 3 (0x3)
fcntl(3,F_GETFL,)                 = 2 (0x2)
fcntl(3,F_SETFD,FD_CLOEXEC)             = 0 (0x0)
fstatat(AT_FDCWD,"/tmp/mail.Rs0LF1ve4nN2",{ mode=-rw------- ,inode=2648459,size=0,blksize=32768 },0x0) = 0 (0x0)
unlink("/tmp/mail.Rs0LF1ve4nN2")         = 0 (0x0)
sigprocmask(SIG_BLOCK,0x0,{ })             = 0 (0x0)
fstat(0,{ mode=crw--w---- ,inode=113,size=0,blksize=4096 }) = 0 (0x0)
ioctl(0,TIOCGETA,0x3ebc63fde1c4)         = 0 (0x0)
And there is no fork, exec, thread stuff, or locking in the trace. Hanging there makes no sense to me.

I suspect it is some sort of permission problem, but I don't know where to start looking.
 
There is only a guess, it might be related to the switch from sendmail to dma. This has caused a change in /etc/mail/mailer.conf. I am not sure if the file has changed or the expected content but it might be something to check.
 
The ioctl(2) is the clue. It's trying to read from standard input, and not yet read the end of file, thus hung.

Try echo hello | truss /usr/bin/mail -s test ralph@valid.example.com
 
The ioctl(2) is the clue. It's trying to read from standard input, and not yet read the end of file, thus hung.

Try echo hello | truss /usr/bin/mail -s test ralph@valid.example.com
Completely correct. I have no idea why I failed to enter something followed by control D, while for the other test I did. My fault. Thank you for the clue.
 
That's FreeBSD 14, though, isn't it? Not the 13.x line?
That can be, I am not sure. But it seems as if the issue has been completely elsewhere.

Completely correct. I have no idea why I failed to enter something followed by control D, while for the other test I did.
I do not use control-D but a line with a single dot as below. My last key stroke is the enter key following the dot key. The "EOT" is the response of the command printed on the terminal. I like to avoid key combinations if possible.
Code:
> mail -s testmail chris
surprise
.
EOT
>
 
Back
Top