Very slow boot
Created by: oliwer
I have tested alpine-ami-3.9 on several t2.* instances and I have noticed they take several minutes to boot. More precisely, i have to wait at least 3 minutes before OpenSSH starts listening for connections. These logs from a t2.nano confirm this:
Feb 14 20:21:24 localhost syslog.info syslogd started: BusyBox v1.29.3
Feb 14 20:21:24 localhost daemon.info init: starting pid 2276, tty '': '/sbin/openrc default'
Feb 14 20:21:26 localhost daemon.info chronyd[2401]: chronyd version 3.4 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP -SCFILTER +SIGND +A
SYNCDNS -SECHASH +IPV6 -DEBUG)
Feb 14 20:21:26 localhost daemon.warn chronyd[2401]: Could not read valid frequency and skew from driftfile /var/lib/chrony/chrony.drift
Feb 14 20:21:30 localhost daemon.info chronyd[2401]: System's initial offset : 0.277395 seconds slow of true (slew)
Feb 14 20:21:36 localhost daemon.info chronyd[2401]: Selected source 169.254.169.123
Feb 14 20:24:48 localhost auth.info sshd[2431]: Server listening on 0.0.0.0 port 22.
Feb 14 20:24:48 localhost auth.info sshd[2431]: Server listening on :: port 22.
Notice how sshd starts about 3 minutes after chrony.
I suspected this was due to a lack of entropy during the host keys generation process, and indeed, after I installed haveged the problem was gone.
Feb 14 20:47:51 ip-172-31-36-235 daemon.info chronyd[2410]: System's initial offset : 0.096570 seconds slow of true (slew)
Feb 14 20:47:53 ip-172-31-36-235 auth.info sshd[2440]: Server listening on 0.0.0.0 port 22.
So I guess it would be a good idea to ship haveged by default, unless you have a better idea?
edit: I just found the corresponding issue on Redmine. Adding the flag in the kernel's command line would certainly be less invasive, unless you're highly paranoid.