BelaPlatform/bela-image-builder

`/opt/Bela/bela_flash_emmc.sh` error

Opened this issue Β· 5 comments

Ran this. Stopped with following log immediately. Ran again straight away, it worked. This must be the error that occasionally causes a self-flashing SD to fail.

We should probably add something like trap "<<make LEDs blink in an error pattern forever>>" ERR and perhaps remove -e from the shebang.

root@bela:/opt/Bela# ./bela_flash_emmc.sh
Checking that no-one is using this disk right now ... OK

Disk /dev/mmcblk1: 3.5 GiB, 3791650816 bytes, 7405568 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Old situation:

Device         Boot Start     End Sectors  Size Id Type
/dev/mmcblk1p1 *     2048 7405567 7403520  3.5G 83 Linux

>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Created a new DOS disklabel with disk identifier 0x68a0906e.
/dev/mmcblk1p1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 67.4 MiB.
Partition #1 contains a ext4 signature.
/dev/mmcblk1p2: Created a new partition 2 of type 'Linux' and of size 3.5 GiB.
/dev/mmcblk1p3: Done.

New situation:

Device         Boot  Start     End Sectors  Size Id Type
/dev/mmcblk1p1 *      2048  140000  137953 67.4M  c W95 FAT32 (LBA)
/dev/mmcblk1p2      141312 7405567 7264256  3.5G 83 Linux

The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
Syncing disks.
mkfs.fat 4.1 (2017-01-24)
mke2fs 1.43.4 (31-Jan-2017)
The file /dev/mmcblk1p2 does not exist and no size was specified.

Got another one. Pasting in case it is different:

# /opt/Bela/bela_flash_emmc.sh
Checking that no-one is using this disk right now ... OK

Disk /dev/mmcblk1: 3.6 GiB, 3867148288 bytes, 7553024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Old situation:

Device         Boot Start     End Sectors  Size Id Type
/dev/mmcblk1p1 *     2048 7553023 7550976  3.6G 83 Linux

>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Script header accepted.
>>> Created a new DOS disklabel with disk identifier 0x68a0906e.
/dev/mmcblk1p1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 67.4 MiB.
Partition #1 contains a ext4 signature.
/dev/mmcblk1p2: Created a new partition 2 of type 'Linux' and of size 3.5 GiB.
/dev/mmcblk1p3: Done.

New situation:

Device         Boot  Start     End Sectors  Size Id Type
/dev/mmcblk1p1 *      2048  140000  137953 67.4M  c W95 FAT32 (LBA)
/dev/mmcblk1p2      141312 7471103 7329792  3.5G 83 Linux

The partition table has been altered.
Calling ioctl() to re-read partition table.
Re-reading the partition table failed.: Device or resource busy
The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
Syncing disks.
mkfs.fat 4.1 (2017-01-24)
mke2fs 1.43.4 (31-Jan-2017)
The file /dev/mmcblk1p2 does not exist and no size was specified.

another one

May 01 19:30:09 bela bela_flash_emmc.sh[625]: Calling ioctl() to re-read partition table.
May 01 19:30:09 bela bela_flash_emmc.sh[625]: Re-reading the partition table failed.: Device or resource busy
May 01 19:30:10 bela bela_flash_emmc.sh[625]: The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
May 01 19:30:10 bela bela_flash_emmc.sh[625]: Syncing disks.
May 01 19:30:11 bela bela_flash_emmc.sh[625]: mkfs.fat 4.1 (2017-01-24)
May 01 19:30:13 bela bela_flash_emmc.sh[625]: mke2fs 1.43.4 (31-Jan-2017)
May 01 19:30:13 bela bela_flash_emmc.sh[625]: The file /dev/mmcblk1p2 does not exist and no size was specified.
May 01 19:30:13 bela systemd[1]: bela_flash_emmc.service: Main process exited, code=exited, status=1/FAILURE
May 01 19:30:13 bela systemd[1]: bela_flash_emmc.service: Unit entered failed state.
May 01 19:30:13 bela systemd[1]: bela_flash_emmc.service: Failed with result 'exit-code'.

a different one:

+ sfdisk /dev/mmcblk1
sfdisk: cannot open /dev/mmcblk1: Input/output error

Flashing RTDSP kits with v0.3.6b

/dev/mmcblk1p1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 67.4 MiB.
Partition #1 contains a vfat signature.
/dev/mmcblk1p2: Created a new partition 2 of type 'Linux' and of size 3.5 GiB.
Partition #2 contains a ext4 signature.
/dev/mmcblk1p3: Done.

New situation:

Device         Boot  Start     End Sectors  Size Id Type
/dev/mmcblk1p1 *      2048  140000  137953 67.4M  c W95 FAT32 (LBA)
/dev/mmcblk1p2      141312 7471103 7329792  3.5G 83 Linux

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
+ mkfs.vfat /dev/mmcblk1p1
mkfs.fat 4.1 (2017-01-24)
+ mkfs.ext4 -F /dev/mmcblk1p2
mke2fs 1.43.4 (31-Jan-2017)
/dev/mmcblk1p2 contains a ext4 file system labelled 'BELAROOTFS'
    last mounted on / on Thu Nov  3 17:16:44 2016
Discarding device blocks: failed - Input/output error
Warning: could not erase sector 2: Input/output error
Creating filesystem with 916224 4k blocks and 229376 inodes
Filesystem UUID: eac6b1af-23dd-4ca7-8c6f-4d629ca989b2
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done                            
Warning: could not read block 0: Input/output error
Warning: could not erase sector 0: Input/output error
Writing inode tables: done                            
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information:      
Warning, had trouble writing out superblocks.

another one, v0.3.8b

root@bela:~# journalctl -u bela_flash_emmc | cat
-- Logs begin at Thu 2016-11-03 17:16:43 UTC, end at Thu 2016-11-03 17:49:56 UTC. --
Nov 03 17:16:48 bela systemd[1]: Started Bela eMMC flasher.
Nov 03 17:16:48 bela bela_flash_emmc.sh[158]: + β€˜[’ -z β€˜β€™ β€˜]’
Nov 03 17:16:48 bela bela_flash_emmc.sh[158]: + FLASH_DESTINATION=emmc
Nov 03 17:16:48 bela bela_flash_emmc.sh[158]: + β€˜[’ emmc == emmc β€˜]’
Nov 03 17:16:48 bela bela_flash_emmc.sh[158]: + DEVICE=/dev/mmcblk1
Nov 03 17:16:48 bela bela_flash_emmc.sh[158]: + MMCID=1
Nov 03 17:16:48 bela bela_flash_emmc.sh[158]: + THIS_DEVICE=/dev/mmcblk0
Nov 03 17:16:48 bela bela_flash_emmc.sh[158]: ++ mktemp -d /tmp/emmc_boot.XXXXXX
Nov 03 17:16:48 bela bela_flash_emmc.sh[158]: + MNT_BOOT=/tmp/emmc_boot.ZyxsLj
Nov 03 17:16:49 bela bela_flash_emmc.sh[158]: ++ mktemp -d /tmp/emmc_root.XXXXXX
Nov 03 17:16:49 bela bela_flash_emmc.sh[158]: + MNT_ROOT=/tmp/emmc_root.ViHXmH
Nov 03 17:16:49 bela bela_flash_emmc.sh[158]: ++ mktemp -d /tmp/boot.XXXXX
Nov 03 17:16:49 bela bela_flash_emmc.sh[158]: + MNT_THIS_BOOT=/tmp/boot.AnXtD
Nov 03 17:16:49 bela bela_flash_emmc.sh[158]: + USR1=/sys/class/leds/beaglebone:green:usr1/trigger
Nov 03 17:16:49 bela bela_flash_emmc.sh[158]: + USR2=/sys/class/leds/beaglebone:green:usr2/trigger
Nov 03 17:16:49 bela bela_flash_emmc.sh[158]: + USR3=/sys/class/leds/beaglebone:green:usr3/trigger
Nov 03 17:16:49 bela bela_flash_emmc.sh[158]: + SUCCESS=0
Nov 03 17:16:49 bela bela_flash_emmc.sh[158]: + trap final_check EXIT
Nov 03 17:16:49 bela bela_flash_emmc.sh[158]: + make --no-print-directory -C /root/Bela stop
Nov 03 17:16:51 bela bela_flash_emmc.sh[158]: make: Warning: File β€˜libraries/OnePole/build/OnePole.d’ has modification time 128404946 s in the future
Nov 03 17:16:51 bela bela_flash_emmc.sh[158]: No process to kill
Nov 03 17:16:51 bela bela_flash_emmc.sh[158]: make: warning: Clock skew detected. Your build may be incomplete.
Nov 03 17:16:51 bela bela_flash_emmc.sh[158]: + echo default-on
Nov 03 17:16:51 bela bela_flash_emmc.sh[158]: + echo default-on
Nov 03 17:16:51 bela bela_flash_emmc.sh[158]: + mount
Nov 03 17:16:51 bela bela_flash_emmc.sh[158]: + grep -q β€˜on / ’
Nov 03 17:16:51 bela bela_flash_emmc.sh[158]: + grep /dev/mmcblk1p2
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: + umount -A /dev/mmcblk1p1
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: umount: /dev/mmcblk1p1: not mounted
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: + true
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: + umount -A /dev/mmcblk1p2
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: umount: /dev/mmcblk1p2: not found
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: + true
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: + mount
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: + grep /dev/mmcblk1
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: + sfdisk /dev/mmcblk1
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: + echo '
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: label: dos
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: label-id: 0x68a0906e
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: device: /dev/mmcblk1
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: unit: sectors
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: /dev/mmcblk1p1 : start=    2048, size=   137953, type=c, bootable
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: /dev/mmcblk1p2 : start=   141312,          type=83
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: '
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: Checking that no-one is using this disk right now ... OK
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: Disk /dev/mmcblk1: 3.5 GiB, 3791650816 bytes, 7405568 sectors
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: Units: sectors of 1 * 512 = 512 bytes
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: Sector size (logical/physical): 512 bytes / 512 bytes
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: I/O size (minimum/optimal): 512 bytes / 512 bytes
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: Disklabel type: dos
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: Disk identifier: 0xf6a1c1d5
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: Old situation:
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: Device     Boot Start   End Sectors Size Id Type
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: /dev/mmcblk1p1 *   8192 7405567 7397376 3.5G 83 Linux
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: >>> Script header accepted.
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: >>> Created a new DOS disklabel with disk identifier 0x68a0906e.
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: /dev/mmcblk1p1: Created a new partition 1 of type β€˜W95 FAT32 (LBA)’ and of size 67.4 MiB.
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: /dev/mmcblk1p2: Created a new partition 2 of type β€˜Linux’ and of size 3.5 GiB.
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: /dev/mmcblk1p3: Done.
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: New situation:
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: Device     Boot Start   End Sectors Size Id Type
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: /dev/mmcblk1p1 *   2048 140000 137953 67.4M c W95 FAT32 (LBA)
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: /dev/mmcblk1p2   141312 7405567 7264256 3.5G 83 Linux
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: The partition table has been altered.
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: Calling ioctl() to re-read partition table.
Nov 03 17:16:52 bela bela_flash_emmc.sh[158]: Re-reading the partition table failed.: Device or resource busy
Nov 03 17:16:53 bela bela_flash_emmc.sh[158]: The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8).
Nov 03 17:16:53 bela bela_flash_emmc.sh[158]: Syncing disks.
Nov 03 17:16:53 bela bela_flash_emmc.sh[158]: + mkfs.vfat /dev/mmcblk1p1
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: mkfs.fat 4.1 (2017-01-24)
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: + mkfs.ext4 -F /dev/mmcblk1p2
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: mke2fs 1.43.4 (31-Jan-2017)
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: The file /dev/mmcblk1p2 does not exist and no size was specified.
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: + final_check
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: + β€˜[’ 0 -eq 0 β€˜]’
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: + cleanup
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: + for a in $MNT_BOOT $MNT_ROOT $MNT_THIS_BOOT
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: + umount /tmp/emmc_boot.ZyxsLj
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: umount: /tmp/emmc_boot.ZyxsLj: not mounted
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: + true
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: + for a in $MNT_BOOT $MNT_ROOT $MNT_THIS_BOOT
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: + umount /tmp/emmc_root.ViHXmH
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: umount: /tmp/emmc_root.ViHXmH: not mounted
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: + true
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: + for a in $MNT_BOOT $MNT_ROOT $MNT_THIS_BOOT
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: + umount /tmp/boot.AnXtD
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: umount: /tmp/boot.AnXtD: not mounted
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: + true
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: + set +x
Nov 03 17:16:54 bela bela_flash_emmc.sh[158]: An error occurred while flashing the emmc