SD duplication yields slow startup

I have a PocketBeagle image I want to reproduce and put on other units. I had the boot time down to about 35 seconds. I used Win32DiskImager to make an image and then put it on another SD card. When I put this in a new PB, the boot time is closer to 2 minutes! It seems this may not the the right way to do things. Do I need to run some initialization script on each unit, or is there a better way to duplicate things once you have them the way you want them?

I have a PocketBeagle image I want to reproduce and put on other units. I
had the boot time down to about 35 seconds. I used Win32DiskImager to make
an image and then put it on another SD card. When I put this in a new PB,
the boot time is closer to 2 minutes! It seems this may not the the right
way to do things. Do I need to run some initialization script on each
unit, or is there a better way to duplicate things once you have them the
way you want them?

What is the make/model of the new SD Card? Is it actually a Class-10 card?

Does the system still boot fast with the origina card?

Very odd, do you see any speed difference on the 2nd boot, or is that
also around 2 minutes?

Regards,

It stays there. Here is the latest:

multi-user.target @1min 55.789s
└─ssh.service @1min 53.646s +2.132s
└─network.target @1min 53.542s
└─networking.service @3.173s +1min 50.353s
└─local-fs.target @3.093s
└─local-fs-pre.target @3.086s
└─keyboard-setup.service @990ms +2.091s
└─system.slice @963ms
└─-.slice @874ms
debian@beaglebone:/opt/scripts$

Since you are the master of all the startup scripts, your response implies duplicating the image is legitimate. FYI, I have added a Realtek USB wifi adapter which is running hostapd, and I have disabled USB networking in /etc/default/bb-boot. Sounds like I need to go get the original and swap things back and forth.

Also:

systemd-analyze: unrecognized option ‘–blame’
debian@beaglebone:/opt/scripts$ systemd-analyze blame
1min 50.353s networking.service
1min 49.479s generic-board-startup.service
12.323s dev-mmcblk0p1.device
2.679s systemd-udev-trigger.service
2.149s hostapd.service
2.132s ssh.service
2.091s keyboard-setup.service
1.537s udhcpd.service
1.365s ti-ipc-dra7xx.service

Are they the same brand (and even /production run/) SD cards?

  A cheap Class 10 card when used with a journaling file system or with
many scattered small files can perform very badly compared to "slower"
Class 2/4/6 cards from the better brands.

  Class 10 cards are rated for /streaming/ a single file on freshly
FAT(x) formatted card. IE: a single data stream (video) and empty card.
Class 2/4/6 are rated for small files on fragmented media (still photos
where some may have been deleted).

  The higher end cards can keep multiple "allocation units" open in
parallel. Cheap cards may only be able to keep two AUs open at a time (on
FAT that's the FAT itself and one data file; on a journaling system one may
be continuously opening/closing AUs as one navigates inodes, data,
journal).

  Copying from a message I wrote back in May, in a different group...

Thanks, but I’m pretty sure the speed of the SD itself is not the issue. It may have something to do with my networking. The original image was connected to my wifi network, and this one is not connected. Looking at the logs I can find I see this:

Aug 10 14:51:56 beaglebone sh[182]: am335x_evm: g_multi Created

Aug 10 14:51:56 beaglebone sh[182]: am335x_evm: Starting usb0 network

Aug 10 14:51:57 beaglebone sh[182]: am335x_evm: Starting usb1 network

Aug 10 14:51:58 beaglebone sh[182]: Stopping udhcpd (via systemctl): udhcpd.serv

Aug 10 14:51:58 beaglebone sh[182]: am335x_evm: dnsmasq: setting up for usb0/usb

Aug 10 14:53:46 beaglebone sh[182]: am335x_evm: LOG: dnsmasq is disabled in this

Aug 10 14:53:46 beaglebone sh[182]: /bin/chmod: changing permissions of '/sys/ke

It seems that setting dnsmasq is taking a long time (51:58 to 53:46) but I am unaware if there is anything else going on in between.

Thanks, but I'm pretty sure the speed of the SD itself is not the issue. It may have something to do with my networking. The original image was connected to my wifi network, and this one is not connected. Looking at the logs I can find I see this:

Aug 10 14:51:56 beaglebone sh[182]: am335x_evm: g_multi Created
Aug 10 14:51:56 beaglebone sh[182]: am335x_evm: Starting usb0 network
Aug 10 14:51:57 beaglebone sh[182]: am335x_evm: Starting usb1 network
Aug 10 14:51:58 beaglebone sh[182]: Stopping udhcpd (via systemctl): udhcpd.serv

This is a little confusing:

Aug 10 14:51:58 beaglebone sh[182]: am335x_evm: dnsmasq: setting up for usb0/usb

^ https://github.com/RobertCNelson/boot-scripts/blob/master/boot/am335x_evm.sh#L721

Aug 10 14:53:46 beaglebone sh[182]: am335x_evm: LOG: dnsmasq is disabled in this

^ https://github.com/RobertCNelson/boot-scripts/blob/master/boot/am335x_evm.sh#L766

Something fishy with the logic:

if [ ! -f /etc/dnsmasq.d/.SoftAp0 ] ; then
   echo "${log} dnsmasq: setting up for usb0/usb1"
else
   echo "${log} LOG: dnsmasq is disabled in this script"
fi

DId you make any changes to /opt/scripts/boot/*

Ps to speed things up, add your WiFi modules to
/etc/modules-load.d/some_file such that they get loaded very early in
bootup..

Regards,

If I use connman to connect to wifi then boot is 37 seconds, so I need to figure out how to not wait for a wifi connection and dhcp address. So imaging the SD works fine.

I don't think I changed any scripts, however, there are some differences in the areas you highlighted -- such as not testing for SoftAp0 and just creating it every time. I think I'll go ahead and install the latest scripts.

Thanks.

While it's in a different file name, it's now used on non-wifi boards, too:

/etc/default/bb-wl18xx (someday i need to just combine both, without
breaking user's setup..)

Change both of these to "no"

USE_GENERATED_DNSMASQ=yes
USE_GENERATED_HOSTAPD=yes

Then you can use a custom

/etc/dnsmasq.d/SoftAp0

and

/etc/hostapd.conf

Regards,