SD duplication yields slow startup

31 views
Skip to first unread message

Paul Beam

unread,
Aug 17, 2020, 12:51:20 PM8/17/20
to BeagleBoard
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?

Robert Heller

unread,
Aug 17, 2020, 12:55:37 PM8/17/20
to beagl...@googlegroups.com, BeagleBoard, Robert Heller
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?

>

--
Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
hel...@deepsoft.com -- Webhosting Services

Robert Nelson

unread,
Aug 17, 2020, 1:09:57 PM8/17/20
to Beagle Board
On Mon, Aug 17, 2020 at 11:51 AM Paul Beam <rpau...@gmail.com> wrote:
>
> 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?

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

Regards,
--
Robert Nelson
https://rcn-ee.com/

Paul Beam

unread,
Aug 17, 2020, 1:15:10 PM8/17/20
to BeagleBoard
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.

Paul Beam

unread,
Aug 17, 2020, 1:16:35 PM8/17/20
to BeagleBoard
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

Dennis Lee Bieber

unread,
Aug 17, 2020, 2:50:18 PM8/17/20
to Beagleboard
On Mon, 17 Aug 2020 09:51:20 -0700 (PDT), in
gmane.comp.hardware.beagleboard.user Paul Beam
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...

-=-=-=-=-
Well, https://www.pidramble.com/wiki/benchmarks/microsd-cards would be
a start.

-=-=-=- 16 GB Kingston Class 10 in an R-Pi 3B+ (1.2GHz)
pi@rpi3bplus-1:~/benchmark$ sudo ./benchmark.sh

Raspberry Pi Dramble microSD benchmarks
microSD clock: 50.000 MHz

Running hdparm test...

/dev/mmcblk0:
HDIO_DRIVE_CMD(identify) failed: Invalid argument
Timing buffered disk reads: 66 MB in 3.02 seconds = 21.85 MB/sec

Running dd test...

51200+0 records in
51200+0 records out
419430400 bytes (419 MB, 400 MiB) copied, 54.3339 s, 7.7 MB/s

Running iozone test...
Iozone: Performance Test of File I/O
Version $Revision: 3.434 $
Compiled for 32 bit mode.
Build: linux-arm

Contributors:William Norcott, Don Capps, Isom Crawford, Kirby
Collins
Al Slater, Scott Rhine, Mike Wisner, Ken Goss
Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,
Randy Dunlap, Mark Montague, Dan Million, Gavin
Brebner,
Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy, Dave
Boone,
Erik Habbinga, Kris Strecker, Walter Wong, Joshua
Root,
Fabrice Bacchella, Zhenghua Xue, Qin Li, Darren
Sawyer,
Vangel Bojaxhi, Ben England, Vikentsi Lapa,
Alexey Skidanov.

Run began: Tue May 19 13:38:19 2020

Include fsync in write timing
O_DIRECT feature enabled
Auto Mode
File size set to 102400 kB
Record Size 4 kB
Command line used: ./iozone -e -I -a -s 100M -r 4k -i 0 -i 1 -i 2
Output is in kBytes/sec
Time Resolution = 0.000001 seconds.
Processor cache size set to 1024 kBytes.
Processor cache line size set to 32 bytes.
File stride size set to 17 * record size.
random random
bkwd record stride
kB reclen write rewrite read reread read write
read rewrite read fwrite frewrite fread freread
102400 4 264 242 5349 5803 5136 239

iozone test complete.

microSD card benchmark complete!




-=-=-=- 8 GB SanDisk Class 4 in a BeagleBone Black (1GHz)
debian@beaglebone:~/benchmark$ sudo ./benchmark.sh
[sudo] password for debian:

Raspberry Pi Dramble microSD benchmarks

Running hdparm test...

/dev/mmcblk0:
HDIO_DRIVE_CMD(identify) failed: Invalid argument
Timing buffered disk reads: 66 MB in 3.01 seconds = 21.89 MB/sec

Running dd test...

51200+0 records in
51200+0 records out
419430400 bytes (419 MB, 400 MiB) copied, 70.7736 s, 5.9 MB/s

Running iozone test...
Iozone: Performance Test of File I/O
Version $Revision: 3.434 $
Compiled for 32 bit mode.
Build: linux-arm

Contributors:William Norcott, Don Capps, Isom Crawford, Kirby
Collins
Al Slater, Scott Rhine, Mike Wisner, Ken Goss
Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain CYR,
Randy Dunlap, Mark Montague, Dan Million, Gavin
Brebner,
Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy, Dave
Boone,
Erik Habbinga, Kris Strecker, Walter Wong, Joshua
Root,
Fabrice Bacchella, Zhenghua Xue, Qin Li, Darren
Sawyer,
Vangel Bojaxhi, Ben England, Vikentsi Lapa,
Alexey Skidanov.

Run began: Tue May 19 13:26:14 2020

Include fsync in write timing
O_DIRECT feature enabled
Auto Mode
File size set to 102400 kB
Record Size 4 kB
Command line used: ./iozone -e -I -a -s 100M -r 4k -i 0 -i 1 -i 2
Output is in kBytes/sec
Time Resolution = 0.000001 seconds.
Processor cache size set to 1024 kBytes.
Processor cache line size set to 32 bytes.
File stride size set to 17 * record size.
random random
bkwd record stride
kB reclen write rewrite read reread read write
read rewrite read fwrite frewrite fread freread
102400 4 1192 1249 6587 6597 6541 635

iozone test complete.

microSD card benchmark complete!

debian@beaglebone:~/benchmark$
-=-=-=-

The BBB with a Class 4 card took 7 minutes for iozone... I'm still
waiting for the R-Pi Class 10 after over 10 minutes. Heck -- I killed that
run and restarted, just in case my moving PuTTY windows around somehow
froze the output.

... Finally finished, it took 22 minutes for iozone!

Things to note:

* HDPARM speeds are very close, the R-Pi at 21.85 MB/s, the "slower" BBB
at 21.89 MB/s

* DD test, R-Pi at 7.7 MB/s, BBB at 5.9 MB/s

* But iozone shows extreme differences!
Random Random
Write Rewrite Read Reread Read Write
R-Pi: 102400 4 264 242 5349 5803 5136 239
BBB: 102400 4 1192 1249 6587 6597 6541 635

Speed multiple 4.5X 5.2X 1.2X 1.1X 1.3X 2.7X

The high-grade "slow" Class 4 SanDisk, in a slower computer,
outperforms the low-bidder "faster" Class 10 Kingston in the faster
computer. The Kingston appears to be killed by the swapping between data
and journal metadata, and later commit of the journal.

-=-=-=-=-


--
Dennis L Bieber

Paul Beam

unread,
Aug 17, 2020, 4:56:58 PM8/17/20
to BeagleBoard
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.   

Paul Beam

unread,
Aug 17, 2020, 5:24:33 PM8/17/20
to BeagleBoard
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.

Robert Nelson

unread,
Aug 17, 2020, 5:24:42 PM8/17/20
to Beagle Board
On Mon, Aug 17, 2020 at 3:57 PM Paul Beam <rpau...@gmail.com> wrote:
>>
>> 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..

rpau...@gmail.com

unread,
Aug 17, 2020, 5:44:50 PM8/17/20
to beagl...@googlegroups.com
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.
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CAOCHtYh_1L_Rx47K1fFQ5sX2_cQ28gDFoyyRdzhOOhwpDEUyBA%40mail.gmail.com.

Robert Nelson

unread,
Aug 17, 2020, 5:54:00 PM8/17/20
to Beagle Board
On Mon, Aug 17, 2020 at 4:44 PM <rpau...@gmail.com> wrote:
>
> 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.

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
Reply all
Reply to author
Forward
0 new messages