LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-26-2017, 01:05 AM   #31
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225

Now that I think about it, this laptop has an SSD and hangs while my desktop systems have rotating disks (several) and do not hang.

The root of the matter is that sendmail needs to generate some random numbers for something (probably security related). The way to make it more likely that random numbers generated by the kernel are truly random is to use things such as mouse movements, key strokes, and other difficult-to-predict sources of events. I guess disk head movement was a source of such events (but I don't know that for a fact and haven't looked that hard to find out). That information is stored in a so-called entropy pool (a pool of random, if you will).

If your pool is empty, the system will block on random number requests until you gain enough entropy to generate a new random number.

So the two fixes are to put sendmail in the background so the boot sequence doesn't block waiting for entropy or to add an additional source of entropy so that sendmail doesn't block at all.
 
2 members found this post helpful.
Old 02-26-2017, 02:05 AM   #32
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Rep: Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161
Thank you for replying.

Your speculative explanation provided some information to help me search. Apparently this entropy thing is heavily dependent upon ioctl and interrupts. That is, hardware. Perhaps then there is a connection to the problem when running with an SSD.

Regarding the alleged fixes, well, the thought that pops into my mind is WTF. Classic Picard face palm moment. That's me blabbering out loud and not against you.

You are not responsible, but this is nuts.

Anybody running postfix or exim on an SSD see this problem? Can sendmail be recompiled to avoid the problem?
 
Old 02-26-2017, 02:09 AM   #33
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Rep: Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161
Now here is an interesting twist.

When I boot into run level 1 and then run init 3, sendmail starts normally. No delays. I even added init 3 to .bashrc to avoid additional delays. I was logging in and launching init 3 in far less time than the observed 50 second delay when booting directly into run level 3.

Can anybody explain why this happens?
 
Old 02-26-2017, 02:15 AM   #34
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,264
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
See this page on Postfix random number sources. Using /dev/urandom will not block so if you can configure to use /dev/urandom it should avoid the delay.

This is the sendmail config page for random number config.

Hope there is something helpful there.

Last edited by astrogeek; 02-26-2017 at 02:29 AM. Reason: Forgot link... typos... formatting
 
Old 02-26-2017, 02:41 AM   #35
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Quote:
Originally Posted by upnort View Post
Now here is an interesting twist.

When I boot into run level 1 and then run init 3, sendmail starts normally. No delays. I even added init 3 to .bashrc to avoid additional delays. I was logging in and launching init 3 in far less time than the observed 50 second delay when booting directly into run level 3.

Can anybody explain why this happens?
If you are typing on the keyboard to input stuff (such as your login information), you are adding to the entropy pool.

On my laptop, moving the mouse during the hang also moves things along.
 
Old 02-26-2017, 02:59 AM   #36
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Rep: Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161
Quote:
If you are typing on the keyboard to input stuff (such as your login information), you are adding to the entropy pool.
Apparently enough to resolve the sendmail problem. Would generating fake keyboard input help avoid the problem?

I built and installed haveged. That does work, but I don't know, this whole thing -- sucks.

Poking more around the web indicates people developing embedded systems face a similar challenge.

I only use sendmail locally for sending system email alerts to my server. No emails go out of the private network. Seems this entropy need is based on supporting TLS. Can sendmail be recompiled to avoid this need for entropy?
 
Old 02-26-2017, 09:02 AM   #37
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
Hmmm ...

Interesting problem ( /dev/random at boot on systems with SSD Drives only ).

This paper Linux Random Number Generator – A New Approach is may be relevant.

-- kjh
 
2 members found this post helpful.
Old 02-26-2017, 10:22 AM   #38
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
@kjhambrick for the win!

From the linked article....
Quote:
Thus, for example, on a system with an SSD, no entropy is collected when accessing that disk.
 
Old 02-26-2017, 11:34 AM   #39
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Rep: Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161
Quote:
@kjhambrick for the win!
I read the first few paragraphs and then my head started hurting. The introductory paragraphs were sufficient to at least learn that somebody is aware of the problem. The author confirms that embedded systems, headless servers, and SSDs are affected. The current method of building entropy seems heavily dependent upon moving parts -- input/output. Many modern systems have none of that.

Okay, so the root cause is a design that fails with 21st century hardware.

Still does not explain why sendmail is, um, er, crappily, designed. A lack of entropy should not delay starting the daemon. Sendmail should start promptly and if additional entropy is needed then sendmail should manage that on its own -- in the background -- until that entropy is sufficient.
 
Old 02-26-2017, 12:38 PM   #40
imitheos
Member
 
Registered: May 2005
Location: Greece
Posts: 441

Rep: Reputation: 141Reputation: 141
Quote:
Originally Posted by Richard Cranium View Post
Now that I think about it, this laptop has an SSD and hangs while my desktop systems have rotating disks (several) and do not hang.
I don't remember if the problem started when i migrated to SSD but i also have / on SSD.

Quote:
Originally Posted by upnort View Post
Still does not explain why sendmail is, um, er, crappily, designed. A lack of entropy should not delay starting the daemon. Sendmail should start promptly and if additional entropy is needed then sendmail should manage that on its own -- in the background -- until that entropy is sufficient.
Why do you think it is crap design ? As Richard said, sendmail just needs randomness for something. It doesn't do anything bad.

There are some HASURANDOM checks in the source code so i suppose it should use /dev/urandom (i think it uses openssl and not directly open the device) and not block but when i ran it through strace, i got /dev/random instead.
 
Old 02-26-2017, 02:52 PM   #41
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Rep: Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161
Quote:
Why do you think it is crap design
My bad. I suppose my irritiation with the problem shows. I meant crappy with respect to handling entropy pools and the startup delay, not with respect to handling mail. Even then, perhaps "crappy" is a poor choice of words.

I have been using sendmail for as long as I have been using Slackware, about 15 years. Has worked fine all of that time. I have not looked at the configs since my original configuration because sendmail just worked and behaved all of these years for my simple private network. Now there is breakage. Likely from the kernel since no Slacker saw the problem prior to the 4.4 kernels. Are people using other distros, SSDs, and sendmail seeing the same problem? I suspect the problem is there but few see the delay. The difference is most of the other distros now use systemd, which is designed to empahsize booting services in parallel. My guess is few people have noticed, if at all.

Yes, backgrounding rc.sendmail is one of the work-arounds offered in this thread, which accomplishes much the same as systemd.

P.S. No, no, no, I am not advocating systemd. Please do not go down that road. I am only speculating why others are not reporting the problem.

Last edited by upnort; 02-26-2017 at 03:09 PM.
 
Old 02-26-2017, 03:34 PM   #42
kjhambrick
Senior Member
 
Registered: Jul 2005
Location: Round Rock, TX
Distribution: Slackware64 15.0 + Multilib
Posts: 2,159

Rep: Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512Reputation: 1512
All --

At the bottom of the original link is a link to the source code which apparently includes patches to configure and link into kernels 4.8, 4.9 and 4.10:

Linux Random Number Generator

I run the Postfix SBo SlackBuild myself and I've not seen the delay on my Pure-D SSD Laptop.

Moreover, I've been crazy-busy at work with a dev project, otherwise, I might try the 4.9.x patch ...

Maybe an adventurous Kernel Compiler Person taker will step up to the plate and take a swing ?

HTH.

-- kjh
 
Old 02-26-2017, 04:50 PM   #43
the3dfxdude
Member
 
Registered: May 2007
Posts: 730

Rep: Reputation: 358Reputation: 358Reputation: 358Reputation: 358
I also want to echo that in my experience too, this is likely an SSD vs non-SSD issue. My old server, non-SSD, still running, does not have this issue with 14.2. It's the new server, with an SSD, I put together that has this issue. I was trying to compare boot logs between the two a few months ago, and just noted there seemed to be entropy available earlier and faster, in some sense, the older machine was a bit faster! Who knew that the hardware lacking entropy to draw from causes a fast machine boot to grind to a halt?
 
Old 02-27-2017, 02:43 PM   #44
rutrow
LQ Newbie
 
Registered: Sep 2009
Distribution: Debian
Posts: 20

Rep: Reputation: 1
I agree that having an SSD only system is likely contributing to the problem. However, I was running a headless SSD only system with 14.1 and never saw this problem. In fact no hardware was changed between my 14.1 and 14.2 install.
 
Old 02-27-2017, 03:15 PM   #45
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Rep: Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161
Quote:
In fact no hardware was changed between my 14.1 and 14.2 install.
Previously in the thread Richard Cranium mentioned the problem appeared for him with the 4.4.7 kernel, which was introduced in 14.2 when still in the Current branch.
 
  


Reply

Tags
boot, delay, sendmail



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Linux Foundation UEFI Secure Boot key for Windows 8 PCs delays explained LXer Syndicated Linux News 0 11-23-2012 02:10 PM
"Delays beset the Linux Foundation's Secure Boot workaround" onebuck Linux - General 1 11-23-2012 10:35 AM
[SOLVED] Sendmail delays email delivery in Internal network mode ? Rohit_4739 Linux - Virtualization and Cloud 2 06-28-2012 08:25 AM
Cause of sendmail delivery delays tajamari Linux - Server 2 09-01-2008 06:03 AM
Fedora Core 2 Boot Delays benrose111488 Linux - Software 9 10-04-2004 05:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration