SD card not working properly

Which system do you use? Android, Ubuntu, OOWOW or others?

22.04 self built or standard server image

I’ve tried now severall things with the sd card slot. It seems to be not working properly. (Severall sd cards, all properly working in other systems and formated with SD Card Formatter)

  • Image build with fenix booted from sd seems to start but will fall into read only mode after some time
  • Using sd card from emmc booted instance will show the card but can not format it or create a partition table newly.

See my try to format sd: (Error: Input/output error during write …)
khadas@Khadas:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
mmcblk1 179:0 0 59.5G 0 disk
└─mmcblk1p1 179:1 0 59.5G 0 part
mmcblk0 179:32 0 29.1G 0 disk
mmcblk0boot0 179:64 0 4M 0 disk
mmcblk0boot1 179:96 0 4M 0 disk
zram0 253:0 0 0B 0 disk
zram1 253:1 0 256M 0 disk [SWAP]
zram2 253:2 0 256M 0 disk [SWAP]
zram3 253:3 0 256M 0 disk [SWAP]
zram4 253:4 0 256M 0 disk [SWAP]
zram5 253:5 0 0B 0 disk
khadas@Khadas:~$ sudo parted /dev/mmcblk1 --script print
Error: /dev/mmcblk1: unrecognised disk label
Model: SD SN64G (sd/mmc)
Disk /dev/mmcblk1: 63.9GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:
khadas@Khadas:~$ sudo parted /dev/mmcblk1 --script – mklabel gpt
Error: Input/output error during write on /dev/mmcblk1
khadas@Khadas:~$ sudo mkfs.ext4 -F /dev/mmcblk1p1
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 15587840 4k blocks and 3899392 inodes
Filesystem UUID: bdd5872d-776d-4eeb-8f84-9c5c75db454b
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424

Allocating group tables: done
Writing inode tables: done
Creating journal (65536 blocks): done
Writing superblocks and filesystem accounting information: mkfs.ext4: Input/output error while writing out and closing file system

dmesg | grep mmcblk1p is full of:
[ 779.419063] Buffer I/O error on dev mmcblk1p1, logical block 7435296, lost async page write
[ 779.420134] Buffer I/O error on dev mmcblk1p1, logical block 7435297, lost async page write
[ 779.421207] Buffer I/O error on dev mmcblk1p1, logical block 7435298, lost async page write
[ 779.422280] Buffer I/O error on dev mmcblk1p1, logical block 7435299, lost async page write
[ 779.423353] Buffer I/O error on dev mmcblk1p1, logical block 7435300, lost async page write
[ 779.424425] Buffer I/O error on dev mmcblk1p1, logical block 7435301, lost async page write
[ 779.425497] Buffer I/O error on dev mmcblk1p1, logical block 7435302, lost async page write
[ 779.426569] Buffer I/O error on dev mmcblk1p1, logical block 7435303, lost async page write
and
[ 783.607173] meson-gx-mmc fe08a000.sd: 25 [0x38c7d58], CRC[0x0100]
[ 783.617383] meson-gx-mmc fe08a000.sd: 25 [0x38c7750], CRC[0x0100]
[ 783.633561] meson-gx-mmc fe08a000.sd: 25 [0x38c7f60], CRC[0x0100]
[ 783.646551] meson-gx-mmc fe08a000.sd: 25 [0x55c8000], CRC[0x0100]

What does this output.

$ dmesg | grep mmcblk1*

You should only need to have the ethernet connected and oowow will boot and the wizard will install the OS. Have you done this and are trying to install from SD.

dmesg output see above.

when I use same sd card via usb sd adapter it is operating as intended:
khadas@Khadas:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 1 59.5G 0 disk
mmcblk0 179:0 0 29.1G 0 disk
mmcblk0boot0 179:32 0 4M 0 disk
mmcblk0boot1 179:64 0 4M 0 disk
zram0 253:0 0 0B 0 disk
zram1 253:1 0 256M 0 disk [SWAP]
zram2 253:2 0 256M 0 disk [SWAP]
zram3 253:3 0 256M 0 disk [SWAP]
zram4 253:4 0 256M 0 disk [SWAP]
zram5 253:5 0 0B 0 disk
khadas@Khadas:~$ sudo parted /dev/sda --script print
Model: SanDisk SDDR-113 (scsi)
Disk /dev/sda: 63.9GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags

khadas@Khadas:~$ sudo parted /dev/sda --script – mklabel gpt
khadas@Khadas:~$ sudo parted /dev/sda --script – mkpart primary ext4 0% 100%
khadas@Khadas:~$ sudo parted /dev/sda --script print
Model: SanDisk SDDR-113 (scsi)
Disk /dev/sda: 63.9GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
1 1049kB 63.9GB 63.9GB primary

khadas@Khadas:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 1 59.5G 0 disk
└─sda1 8:1 1 59.5G 0 part
mmcblk0 179:0 0 29.1G 0 disk
mmcblk0boot0 179:32 0 4M 0 disk
mmcblk0boot1 179:64 0 4M 0 disk
zram0 253:0 0 0B 0 disk
zram1 253:1 0 256M 0 disk [SWAP]
zram2 253:2 0 256M 0 disk [SWAP]
zram3 253:3 0 256M 0 disk [SWAP]
zram4 253:4 0 256M 0 disk [SWAP]
zram5 253:5 0 0B 0 disk
khadas@Khadas:~$ sudo mkfs.ext4 -F /dev/sda1
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 15591424 4k blocks and 3899392 inodes
Filesystem UUID: f4f09809-9817-47b1-b05f-f96a0f96e3a5
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424

Allocating group tables: done
Writing inode tables: done
Creating journal (65536 blocks): done
Writing superblocks and filesystem accounting information: done

Using the card (that was formatted in usb sd reader and mounted succesfully) within the onboard slot is also not possible:
khadas@Khadas:~$ dmesg | grep mmcblk1*
[ 0.808078] mmcblk1: mmc1:aaaa SN64G 59.5 GiB
[ 0.813575] mmcblk1: p1
[ 1.285746] mmcblk0: mmc0:0001 BJTD4R 29.1 GiB
[ 1.286045] mmcblk0boot0: mmc0:0001 BJTD4R partition 1 4.00 MiB
[ 1.286362] mmcblk0boot1: mmc0:0001 BJTD4R partition 2 4.00 MiB
[ 1.286891] mmcblk0rpmb: mmc0:0001 BJTD4R partition 3 4.00 MiB, chardev (240:0)
[ 1.289011] [mmcblk0p01] bootloader offset 0x000000000000, size 0x000000400000
[ 1.289444] [mmcblk0p02] reserved offset 0x000002400000, size 0x000004000000
[ 1.289871] [mmcblk0p03] cache offset 0x000006c00000, size 0x000000000000
[ 1.290309] [mmcblk0p04] env offset 0x000007400000, size 0x000000800000
[ 1.290740] [mmcblk0p05] rootfs offset 0x000008400000, size 0x00073f800000
[ 10.412998] EXT4-fs (mmcblk0p5): mounted filesystem with writeback data mode. Opts: data=writeback
[ 10.953401] EXT4-fs (mmcblk0p5): re-mounted. Opts: commit=600,errors=remount-ro
khadas@Khadas:~$ sudo mkdir /mnt/sd
[sudo] password for khadas:
khadas@Khadas:~$ sudo chmod 777 /mnt/sd/
khadas@Khadas:~$ sudo mount /dev/mmcblk1p1 /mnt/sd/
mount: /mnt/sd: can’t read superblock on /dev/mmcblk1p1.
khadas@Khadas:~$ dmesg | grep mmcblk1*
[ 0.808078] mmcblk1: mmc1:aaaa SN64G 59.5 GiB
[ 0.813575] mmcblk1: p1
[ 1.285746] mmcblk0: mmc0:0001 BJTD4R 29.1 GiB
[ 1.286045] mmcblk0boot0: mmc0:0001 BJTD4R partition 1 4.00 MiB
[ 1.286362] mmcblk0boot1: mmc0:0001 BJTD4R partition 2 4.00 MiB
[ 1.286891] mmcblk0rpmb: mmc0:0001 BJTD4R partition 3 4.00 MiB, chardev (240:0)
[ 1.289011] [mmcblk0p01] bootloader offset 0x000000000000, size 0x000000400000
[ 1.289444] [mmcblk0p02] reserved offset 0x000002400000, size 0x000004000000
[ 1.289871] [mmcblk0p03] cache offset 0x000006c00000, size 0x000000000000
[ 1.290309] [mmcblk0p04] env offset 0x000007400000, size 0x000000800000
[ 1.290740] [mmcblk0p05] rootfs offset 0x000008400000, size 0x00073f800000
[ 10.412998] EXT4-fs (mmcblk0p5): mounted filesystem with writeback data mode. Opts: data=writeback
[ 10.953401] EXT4-fs (mmcblk0p5): re-mounted. Opts: commit=600,errors=remount-ro
[ 179.512690] blk_update_request: I/O error, dev mmcblk1, sector 2048 op 0x1:(WRITE) flags 0x800 phys_seg 1 prio class 0
[ 179.513365] Buffer I/O error on dev mmcblk1p1, logical block 0, lost sync page write
[ 179.514372] EXT4-fs (mmcblk1p1): I/O error while writing superblock
[ 179.515184] EXT4-fs (mmcblk1p1): mount failed
khadas@Khadas:~$

You don’t need chmod or mnt. It should appear on your favorites bar if it mounts.

Have you tried a different SD card, some of those are touchy. You do need to fully erase SD cards to avoid having issues when laying down new data.

hi, thanks for your reply. I am on a headless system, no favorites bar or auto mount.

I’ve now tried 5 different sd cards, all are acting up on the vim4 and working fine on everything els, including usb to sd adapter plugged into vim4

When I get back to testing the headless ubuntu server I will check that. Only have one VIM4 and its on desktop at the moment.

Try this:

$ sudo mkdir /mnt/sd1
$ blkid -o list
$ sudo mount -t exfat /dev/mmcblk1p2 /mnt/sd1


mount -t <type> <device> <directory>

This will not auto mount at boot unless you modify fstab.

Hi,

I will try this when I get home but to my understanding there was nothing wrong with my way of mounting and I think this might be a specific HW issue on my board. Are you also using a VIM4?

$ mount -t ext4 /dev/mmcblk1p1 /mnt/sd

I honestly do not get it. I shall not have to be explicit about the fstype, usually auto guess works (at least for a common fs like ext4) quite reliable. So omitting -t ext4 should be no difference.

And, the same card with the same file system is fully working with the same mount cmd (adjusted for location) on the vim4 with a usb to sd adapter. But not with the onboard sdcard slot.

What’s the SD card model?

Have you checked other SD card ? What’s the kerenl log about insert & remove the SDcard?

The one from the mentioned test is a SanDisk Extreme A2 U3 V30 64GB. However I did test (not to the same extend) other cards, mostly sandisk (16GB Class 10, 32GB A1)

I will do some more testing and report my results incl. kernel logs.

64GB A2 SanDisk Extreme Insert:

[30856.894448] r: b_s = 0, b_sz = 40, f: b_s = 26, b_sz = 1a
[30856.894456] the final result: sel = 1, rx = 20
[30856.894464] mmc1: new ultra high speed SDR104 SDXC card at address aaaa
[30856.894468] mmc1: clock 199999997, 4-bit-bus-width

[30856.895133] mmcblk1: mmc1:aaaa SN64G 59.5 GiB
[30856.900051]  mmcblk1: p1
[30856.900832] Enter aml_emmc_partition_ops

Remove:

[30917.305289] meson-gx-mmc fe08a000.sd: 13 [0xaaaa0000], TIMEOUT[0x2800]
[30917.305476] meson-gx-mmc fe08a000.sd: 13 [0xaaaa0000], TIMEOUT[0x2800]
[30917.306306] meson-gx-mmc fe08a000.sd: 13 [0xaaaa0000], TIMEOUT[0x2800]
[30917.307150] meson-gx-mmc fe08a000.sd: 13 [0xaaaa0000], TIMEOUT[0x2800]
[30917.308014] mmc1: card aaaa removed

32GB A1 SanDisk Extreme Insert

[30967.132330] r: b_s = 13, b_sz = 2d, f: b_s = 0, b_sz = 24
[30967.132338] the final result: sel = 1, rx = 29
[30967.132347] mmc1: new ultra high speed SDR104 SDHC card at address aaaa
[30967.132350] mmc1: clock 199999997, 4-bit-bus-width

[30967.133025] mmcblk1: mmc1:aaaa SE32G 29.7 GiB
[30967.134465]  mmcblk1: p1 p2
[30967.135197] Enter aml_emmc_partition_ops

Remove:

[30992.730454] meson-gx-mmc fe08a000.sd: 13 [0xaaaa0000], TIMEOUT[0x2800]
[30992.730635] meson-gx-mmc fe08a000.sd: 13 [0xaaaa0000], TIMEOUT[0x2800]
[30992.731468] meson-gx-mmc fe08a000.sd: 13 [0xaaaa0000], TIMEOUT[0x2800]
[30992.732312] meson-gx-mmc fe08a000.sd: 13 [0xaaaa0000], TIMEOUT[0x2800]
[30992.733175] mmc1: card aaaa removed

All others report similar when inserting/removing. Nothing particular in the log (for my eye)
What seems odd to me is that every card tested (even a no name 16GB Class10 card) will report 200MHz interface speed which I can not imagine working on sdhc card (but i might be wrong there)

I checked the SanDisk Extreme PRO A2 card on my side, I can format it without problems.

khadas@Khadas:~$ sudo parted /dev/mmcblk1 --script print
Model: SD SR64G (sd/mmc)
Disk /dev/mmcblk1: 63.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
 1      16.8MB  268MB   252MB   primary  ext4         boot
 2      268MB   63.2GB  63.0GB  primary  ext4

khadas@Khadas:~$ sudo mkfs.ext4 -F /dev/mmcblk1p1
mke2fs 1.46.5 (30-Dec-2021)
/dev/mmcblk1p1 contains a ext4 file system
        created on Mon Jun 13 22:30:16 2022
Creating filesystem with 61440 4k blocks and 61440 inodes
Filesystem UUID: d869de2e-282d-4fd5-99db-2588e4c9629e
Superblock backups stored on blocks: 
        32768

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

khadas@Khadas:~$ 

I guess it is my specific unit then.

Do you have the new m2x attached? I currently have and nothing is plugged in to it.
Edit: Without m2x attached same results

My test procedure:

  • format in external reader with script format_dev.sh
  • swap card into internal reader
  • try to mount it with “sudo mount /dev/mmcblk1p1 /mnt/sd”

→ Always fails with mount: /mnt/sd: can’t read superblock on /dev/mmcblk1p1.

And this appears in the dmesg output
[ 898.982023] meson-gx-mmc fe08a000.sd: 25 [0x800], CRC[0x0100]
[ 898.992207] meson-gx-mmc fe08a000.sd: 25 [0x800], CRC[0x0100]
[ 899.002366] meson-gx-mmc fe08a000.sd: 25 [0x800], CRC[0x0100]
[ 899.012512] meson-gx-mmc fe08a000.sd: 25 [0x800], CRC[0x0100]
[ 899.022680] meson-gx-mmc fe08a000.sd: 25 [0x800], CRC[0x0100]
[ 899.032845] meson-gx-mmc fe08a000.sd: 25 [0x800], CRC[0x0100]
[ 899.042993] blk_update_request: I/O error, dev mmcblk1, sector 2048 op 0x1:(WRITE) flags 0x800 phys_seg 1 prio class 0
[ 899.043667] Buffer I/O error on dev mmcblk1p1, logical block 0, lost sync page write
[ 899.044677] EXT4-fs (mmcblk1p1): I/O error while writing superblock
[ 899.045484] EXT4-fs (mmcblk1p1): mount failed

When I then try to reboot VIM4 will be stuck and not boot (LED will never start to blink). If I remove the card and reset it will boot again.

I think my unit is defective then.

format_dev.sh

#!/bin/bash

DUT_DEVICE=/dev/sda
DUT_PART=${DUT_DEVICE}1

echo "Device under Test   " $DUT_DEVICE
echo "Partition under Test" $DUT_PART

sudo mkdir /mnt/sd

sudo parted $DUT_DEVICE --script -- mklabel gpt
sudo parted $DUT_DEVICE --script -- mkpart primary ext4 0% 100%
sudo mkfs.ext4 -F $DUT_PART

sudo parted $DUT_DEVICE --script print

sudo mount $DUT_PART /mnt/sd
lsblk

sudo chmod 777 /mnt/sd

#echo
#echo "F3 Test"
#f3write -e 1 /mnt/sd
#f3read /mnt/sd

sudo umount /mnt/sd

I’ve now tested all of them:

All with the same results, can not even mount. trying to format (in the onboard sd slot) will result in unresponsive system.

Shall I contact support for replacement or what to do next?

Have you tried the server image we released and install via OOWOW?

Could you also try to check on Android?

Yes, vanilla server image from oowow shows the same behaviour and android (64) is stuck at ‘checking’ the sd card and will after a minute or so just display the boot animation.


Swapping SD into USB Reader will work just fine without a system reset stuck somewhere:

I will check some nets from the sd card slot on my board (whatever i can reach to measure connection)

I can not find anything obvious.

DFN ESD Diodes all are a bit unevenly soldered but they all have contact (I guees a bit to much solder paste is used) Resistors and caps also look well connected but I did not check for value except 9R5 which should be 10k and it is. Flux is visible in the area of sd shield but this should not matter. (Anyhow I’ll try to clean with some flux remover)

So I can only conclude that there is a HW level issue either to the a311d2 soc or on the connection to it.

Hello @aXe_111

I will provide you a new image to check the SD card issue later.

1 Like