Boot time optimization

Hi guys,
I boot from SD and it takes to much time (2 min)… is any way to optimize this??

This is my /opt/scripts/tools/version.sh

git:/opt/scripts/:[5fa30ffcf068996ec08e034d2af5c5a133f10709]
eeprom:[A335BNLT000C2006BBBG0129]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[rcn-ee.net Ubuntu Console Image 2020-03-12]
UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
UBOOT: Loaded Overlay:[AM335X-PRU-UIO-00A0]
UBOOT: Loaded Overlay:[BB-ADC-00A0]
UBOOT: Loaded Overlay:[BB-HDMI-TDA998x-00A0]
kernel:[5.4.47-bone30]
/boot/uEnv.txt Settings:
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_addr4=/lib/firmware/FESTO-PINMUX-SETUP.dtbo]
uboot_overlay_options:[disable_uboot_overlay_emmc=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]
pkg:[bb-cape-overlays]:[4.14.20200722.0-0~bionic+20200722]
pkg:[bb-wl18xx-firmware]:[1.20200702.0-0~bionic+20200702]
pkg:[kmod]:[24-1ubuntu3.4rcnee0~bionic+20200525]
WARNING:pkg:[librobotcontrol]:[NOT_INSTALLED]
groups:[ubuntu : ubuntu adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal bluetooth netdev i2c gpio pwm eqep remoteproc admin spi iio docker tisdk weston-launch xenomai cloud9ide]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet cape_universal=enable]
dmesg | grep remote

and this is my systemd-analyze blame

1min 34.446s dev-mmcblk0p2.device
1min 2.259s generic-board-startup.service
50.664s dev-loop8.device
49.671s dev-loop7.device
49.351s dev-loop6.device
48.843s dev-loop4.device
48.804s dev-loop5.device
48.462s dev-loop3.device
48.420s dev-loop1.device
48.392s dev-loop0.device
48.197s dev-loop2.device
24.250s snapd.service
10.326s networkd-dispatcher.service
5.036s nginx.service
3.740s systemd-udev-trigger.service
3.630s apparmor.service
3.419s systemd-journald.service
3.058s ssh.service
2.843s loadcpufreq.service
2.041s keyboard-setup.service
1.935s binfmt-support.service
1.551s grub-common.service
1.534s snap-core-9995.mount
1.448s cpufrequtils.service
1.406s snap-core-9805.mount

thx

kernel:[5.4.47-bone30]

Ooh, kernel 5.4 - how experimental is this?

1min 34.446s dev-mmcblk0p2.device
1min 2.259s generic-board-startup.service
50.664s dev-loop8.device
49.671s dev-loop7.device
49.351s dev-loop6.device
48.843s dev-loop4.device
48.804s dev-loop5.device
48.462s dev-loop3.device
48.420s dev-loop1.device
48.392s dev-loop0.device
48.197s dev-loop2.device

I haven’t seen those dev-loop devices before (perhaps they come with kernel 5.4). They look rather suspicious with the 50 second duration. Have a look at what their logs say, e.g.:

$ journalctl -u dev-loop0

24.250s snapd.service

The snap package system is a bit of a resource hog and it primarily serves as a convenience for some minority use cases. Are you sure you need it on a BBB?
Final thought - maybe your SD card simply has poor performance? I doubt it’ll make a significant difference, but you can try flashing your image into eMMC or using a higher-end SD card.

Hello Tarmo,

you were right I just disabled the snap package and I earned 22 sec, thanks for your help.

At the same time, I’ve realized that I don’t need such a modern kernel, so I decided to test with a more “stable” one.

----- /opt/scripts/tools/version.sh

git:/opt/scripts/:[b39ec679648a6be8f25f48bd1c9784c1fc5a0c46]

eeprom:[A335BNLT000C1908BBBG0612]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Buster IoT TIDL Image 2020-04-06]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2018.09-00002-g0b54a51eee]:[location: dd MBR]
UBOOT: Booted Device-Tree:[am335x-boneblack.dts]
kernel:[4.14.108-ti-r131]
nodejs:[v10.15.2]
/boot/uEnv.txt Settings:
pkg check: to individually upgrade run: [sudo apt install --only-upgrade ]
pkg:[bb-cape-overlays]:[4.14.20200403.0-0rcnee0~buster+20200403]
pkg:[bb-wl18xx-firmware]:[1.20200322.0-0rcnee0~buster+20200322]
pkg:[kmod]:[26-1]
pkg:[librobotcontrol]:[1.0.4-git20190227.1-0rcnee0~buster+20190327]
pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal bluetooth netdev i2c gpio pwm eqep remoteproc admin spi iio docker tisdk weston-launch xenomai cloud9ide]
cmdline:[console=ttyO0,115200n8 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 rng_core.default_quality=100 quiet]
dmesg | grep remote
[ 1.047276] remoteproc remoteproc0: wkup_m3 is available
[ 1.250805] remoteproc remoteproc0: powering up wkup_m3
[ 1.250830] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217168
[ 1.251080] remoteproc remoteproc0: remote processor wkup_m3 is now up
dmesg | grep pru
dmesg | grep pinctrl-single
[ 0.808485] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[ 0.809682] gpio-of-helper ocp:cape-universal: ready
lsusb
Bus 001 Device 002: ID 2357:011e TP-Link
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
END

------ systemd-analyze
Startup finished in 6.764s (kernel) + 1min 16.936s (userspace) = 1min 23.700s
graphical.target reached after 1min 15.777s in userspace

------ NEW systemd-analyze blame

1min 6.796s generic-board-startup.service

44.446s dev-mmcblk0p1.device
4.764s user@0.service
4.016s dnsmasq.service
3.307s loadcpufreq.service
2.724s networking.service
2.387s systemd-udev-trigger.service
1.924s ssh.service
1.786s avahi-daemon.service
1.648s systemd-logind.service
1.405s connman.service
1.401s ti-ipc-dra7xx.service
1.278s systemd-timesyncd.service
1.214s cpufrequtils.service
1.192s systemd-journald.service
1.111s alsa-restore.service
982ms user-runtime-dir@0.service
935ms rsyslog.service
909ms wpa_supplicant.service
902ms systemd-update-utmp-runlevel.service
871ms systemd-fsck-root.service
636ms systemd-user-sessions.service
555ms systemd-modules-load.service
544ms dev-mqueue.mount
503ms sys-kernel-debug.mount
481ms systemd-tmpfiles-setup.service
477ms systemd-udevd.service
457ms kmod-static-nodes.service
456ms systemd-update-utmp.service
440ms cloud9.service
427ms systemd-journal-flush.service
401ms systemd-sysctl.service
401ms systemd-sysusers.service
378ms systemd-random-seed.service
338ms systemd-remount-fs.service
312ms fake-hwclock.service
304ms systemd-tmpfiles-clean.service
290ms ifupdown-pre.service
289ms sys-kernel-config.mount
258ms systemd-tmpfiles-setup-dev.service
218ms sys-fs-fuse-connections.mount

But as you can see the problem is still present, the userspace boot time takes too much time.

so if it’s not the kernel version … how can I do better times?

Oh.. why are you running the TIDL image on an AM335x, it's got so many
packages only for AM57xx devices..

Just go under:

cd /opt/scripts/

Run "git pull"

Then reboot, most of the am57xx boot stuff will be disabled on the
next bootup.. cmem/tipc/etc..

Regards,

Thx Robert for your answer, I did what you say but it did not change the boot time.

if the version I’m using is the problem, what version should I use?

Thx in advance.

And if the version it’s not the problem … how I can decrease the boot time (userspace)… thx

-bone- kernels are booting faster than the -ti- flavors.

Thanks TJF… i’ll try the -bone flavors…