Slow boot times with 4.14.32

I have a Beaglebone Black attached to a 7" Newhaven LCD display.

The goal of the device is to show an HTML page on the LCD as soon as possible, and to boot up a Ruby-on-Rails server running on PostgreSQL.

I’ve read online and tried many things to improve the boot speed - it’s still not as good as I’d ideally like.

Here’s my bootup information:

systemd-analyze:

Startup finished in 13.669s (kernel) + 53.496s (userspace) = 1min 7.166s

systemd-analyze blame:

`

1min 5.686s dev-mmcblk1p1.device

12.846s postgresql@9.6-main.service

4.923s networking.service

2.669s systemd-logind.service

2.442s udhcpd.service

2.153s at-hid.service

1.626s generic-board-startup.service

1.554s systemd-udev-trigger.service

1.540s bb-wl18xx-wlan0.service

1.470s wpa_supplicant.service

1.463s connman.service

1.314s sysstat.service

1.076s ssh.service

616ms systemd-update-utmp-runlevel.service

607ms systemd-journald.service

439ms rsyslog.service

380ms sys-kernel-config.mount

360ms kmod-static-nodes.service

338ms sys-kernel-debug.mount

307ms systemd-udevd.service

269ms systemd-user-sessions.service

264ms dev-mqueue.mount

229ms systemd-tmpfiles-setup-dev.service

225ms systemd-sysctl.service

223ms systemd-tmpfiles-setup.service

216ms systemd-update-utmp.service

198ms systemd-journal-flush.service

181ms user@1000.service

168ms hostapd.service

167ms sys-fs-fuse-connections.mount

157ms systemd-remount-fs.service

142ms systemd-random-seed.service

129ms systemd-tmpfiles-clean.service

112ms systemd-backlight@backlight:backlight.service

41ms postgresql.service

`

dmesg:

`
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.14.32-ti-r42 (root@a4-imx6q-wandboard-2gb) (gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)) #1 SMP Thu Apr 5 23:13:09 UTC 2018
[ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: TI AM335x BeagleBone Black
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] efi: Getting EFI parameters from FDT:
[ 0.000000] efi: UEFI not found.
[ 0.000000] cma: Reserved 48 MiB at 0x9c800000
[ 0.000000] On node 0 totalpages: 130560
[ 0.000000] free_area_init_node: node 0, pgdat c15ecb00, node_mem_map df961000
[ 0.000000] Normal zone: 1148 pages used for memmap
[ 0.000000] Normal zone: 0 pages reserved
[ 0.000000] Normal zone: 130560 pages, LIFO batch:31
[ 0.000000] CPU: All CPU(s) started in SVC mode.
[ 0.000000] AM335X ES2.1 (sgx neon)
[ 0.000000] random: fast init done
[ 0.000000] percpu: Embedded 18 pages/cpu @df925000 s41100 r8192 d24436 u73728
[ 0.000000] pcpu-alloc: s41100 r8192 d24436 u73728 alloc=18*4096
[ 0.000000] pcpu-alloc: [0] 0
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 129412
[ 0.000000] Kernel command line: console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait uboot_detected_capes=BB-BONE-NH7C-01, coherent_pool=1M net.ifnames=0 quiet
[ 0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[ 0.000000] Memory: 440800K/522240K available (13312K kernel code, 1166K rwdata, 4364K rodata, 1024K init, 672K bss, 32288K reserved, 49152K cma-reserved, 0K highmem)
[ 0.000000] Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
vmalloc : 0xe0000000 - 0xff800000 ( 504 MB)
lowmem : 0xc0000000 - 0xdfe00000 ( 510 MB)
pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
.text : 0xc0008000 - 0xc0e00000 (14304 kB)
.init : 0xc1400000 - 0xc1500000 (1024 kB)
.data : 0xc1500000 - 0xc1623854 (1167 kB)
.bss : 0xc162dbb0 - 0xc16d5f9c ( 673 kB)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] ftrace: allocating 42720 entries in 126 pages
[ 0.000000] Hierarchical RCU implementation.
[ 0.000000] RCU restricting CPUs from NR_CPUS=2 to nr_cpu_ids=1.
[ 0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
[ 0.000000] OMAP clockevent source: timer2 at 24000000 Hz
[ 0.000015] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000031] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000040] OMAP clocksource: timer1 at 24000000 Hz
[ 0.000811] timer_probe: no matching timers found
[ 0.001032] Console: colour dummy device 80x30
[ 0.001057] WARNING: Your ‘console=ttyO0’ has been replaced by ‘ttyS0’
[ 0.001061] This ensures that you still see kernel messages. Please
[ 0.001064] update your kernel commandline.
[ 0.001086] Calibrating delay loop… 995.32 BogoMIPS (lpj=1990656)
[ 0.046878] pid_max: default: 32768 minimum: 301
[ 0.047148] Security Framework initialized
[ 0.047162] Yama: becoming mindful.
[ 0.047200] AppArmor: AppArmor disabled by boot time parameter
[ 0.047389] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.047399] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.048358] CPU: Testing write buffer coherency: ok
[ 0.048828] CPU0: thread -1, cpu 0, socket -1, mpidr 0
[ 0.049351] Setting up static identity map for 0x80100000 - 0x80100060
[ 0.049518] Hierarchical SRCU implementation.
[ 0.052969] EFI services will not be available.
[ 0.053269] smp: Bringing up secondary CPUs …
[ 0.053280] smp: Brought up 1 node, 1 CPU
[ 0.053290] SMP: Total of 1 processors activated (995.32 BogoMIPS).
[ 0.053296] CPU: All CPU(s) started in SVC mode.
[ 0.054845] devtmpfs: initialized
[ 0.069173] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[ 0.069589] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[ 0.069613] futex hash table entries: 256 (order: 2, 16384 bytes)
[ 0.073557] xor: measuring software checksum speed
[ 0.110889] arm4regs : 1218.000 MB/sec
[ 0.150878] 8regs : 1092.000 MB/sec
[ 0.190877] 32regs : 1089.000 MB/sec
[ 0.230876] neon : 1749.000 MB/sec
[ 0.230883] xor: using function: neon (1749.000 MB/sec)
[ 0.230902] pinctrl core: initialized pinctrl subsystem
[ 0.231679] DMI not present or invalid.
[ 0.232106] NET: Registered protocol family 16
[ 0.235706] DMA: preallocated 1024 KiB pool for atomic coherent allocations
[ 0.258263] omap_hwmod: debugss: _wait_target_disable failed
[ 0.298574] cpuidle: using governor menu
[ 0.304312] OMAP GPIO hardware version 0.1
[ 0.316432] No ATAGs?
[ 0.316450] hw-breakpoint: debug architecture 0x4 unsupported.
[ 0.316824] omap4_sram_init:Unable to allocate sram needed to handle errata I688
[ 0.316832] omap4_sram_init:Unable to get sram pool needed to handle errata I688
[ 0.394895] raid6: neonx2 gen() 1894 MB/s
[ 0.462876] raid6: neonx2 xor() 1432 MB/s
[ 0.462882] raid6: using algorithm neonx2 gen() 1894 MB/s
[ 0.462886] raid6: … xor() 1432 MB/s, rmw enabled
[ 0.462892] raid6: using neon recovery algorithm
[ 0.469798] edma 49000000.edma: TI EDMA DMA engine driver
[ 0.473064] SCSI subsystem initialized
[ 0.473491] libata version 3.00 loaded.
[ 0.473758] usbcore: registered new interface driver usbfs
[ 0.473810] usbcore: registered new interface driver hub
[ 0.473910] usbcore: registered new device driver usb
[ 0.474435] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c0_pins, deferring probe
[ 0.475944] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 100 kHz
[ 0.476195] media: Linux media interface: v0.10
[ 0.476260] Linux video capture interface: v2.00
[ 0.476406] pps_core: LinuxPPS API ver. 1 registered