Tag Archive: sd


Time to test my Raspberry Pi with my new “Power Board”. In order to do so, I’m writing a clean image to my SD card.

[root@hplaptop raspberry_pi]# dd of=/dev/mmcblk0 if=archlinux-hf-2013-07-22.img bs=1M
1870+0 records gelezen
1870+0 records geschreven
1960837120 bytes (2,0 GB) gekopieerd, 317,354 s, 6,2 MB/s
[root@hplaptop raspberry_pi]# sync

Now, something weird is going on. It appears nothing has been written, as when I boot it up, it boots my previous image. It is set to it’s hostname and accepting my username and password. But this is supposed to be a clean, unconfigured instance of ArchLinuxARM. Now, I have been experiencing problems with my laptop’s SD card slot when the laptop is running hot. Now my laptop has been running for hours, but it’s not that hot I think. Anyhow. I’ll remove the existing partitions before I am going to write the image:


[root@hplaptop raspberry_pi]# fdisk /dev/mmcblk0
Opdracht (m voor hulp): o
Aanmaken van een nieuw DOS-schijflabel met schijf-ID 0x67404a92.

Opdracht (m voor hulp): w
De partitietabel is gewijzigd!

Aanroepen van ioctl() om partitietabel opnieuw in te lezen…
Leegmaken van schijfbuffers…
[root@hplaptop raspberry_pi]# ls /dev/mmcblk0*
/dev/mmcblk0 /dev/mmcblk0p1 /dev/mmcblk0p2 /dev/mmcblk0p5

What is going on here? Looking at my dmesg output, there indeed appears to be a problem with my SD slot

[12272.101180] WARNING: at drivers/mmc/host/sdhci.c:838 sdhci_send_command+0xa35/0xd90 [sdhci]()
[12272.101184] Modules linked in: nfsv3 nfs_acl rpcsec_gss_krb5 auth_rpcgss oid_registry nfsv4 fuse cpufreq_powersave uvcvideo videobuf2_vmalloc videobuf2_memops vide
obuf2_core videodev media pata_pcmcia joydev iTCO_wdt coretemp iTCO_vendor_support kvm_intel hp_wmi ppdev sparse_keymap kvm arc4 r852 sm_common nand nand_ecc nand_ids
mtd iwldvm snd_hda_codec_analog mac80211 pcmcia microcode nouveau pcspkr r592 psmouse yenta_socket memstick pcmcia_rsrc serio_raw pcmcia_core evdev mxm_wmi lpc_ich t
tm drm_kms_helper iwlwifi cfg80211 drm i2c_algo_bit i2c_core snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_page_alloc snd_timer snd rfkill soundcore parport_pc pa
rport hp_accel fan lis3lv02d e1000e ptp thermal wmi intel_agp acpi_cpufreq input_polldev mperf button pps_core intel_gtt processor ac battery video
[12272.101283] nfs lockd sunrpc fscache ext4 crc16 mbcache jbd2 sd_mod sr_mod cdrom mmc_block sdhci_pci ahci sdhci libahci mmc_core libata firewire_ohci scsi_mod fir
ewire_core crc_itu_t ehci_pci uhci_hcd ehci_hcd usbcore usb_common
[12272.101319] CPU: 1 PID: 7658 Comm: mmcqd/0 Tainted: G W 3.10.6-2-ARCH #1
[12272.101323] Hardware name: Hewlett-Packard HP EliteBook 8530w/30E7, BIOS 68PDV Ver. F.0E 07/31/2009
[12272.101327] 0000000000000009 ffff88013934bbc8 ffffffff814c239c ffff88013934bc00
[12272.101335] ffffffff81055881 ffff8800a26e78e8 ffff8800a26e7958 0000000000000001
[12272.101342] ffff880138b954c0 0000000000000001 ffff88013934bc10 ffffffff8105595a
[12272.101350] Call Trace:
[12272.101359] [] dump_stack+0x19/0x1b
[12272.101366] [] warn_slowpath_common+0x61/0x80
[12272.101373] [] warn_slowpath_null+0x1a/0x20
[12272.101389] [] sdhci_send_command+0xa35/0xd90 [sdhci]
[12272.101396] [] ? strlcpy+0x42/0x60
[12272.101402] [] ? elv_rb_del+0x2a/0x40
[12272.101417] [] sdhci_request+0x147/0x1d0 [sdhci]
[12272.101433] [] mmc_start_request+0x124/0x250 [mmc_core]
[12272.101440] [] ? sg_init_table+0x1a/0x40
[12272.101457] [] mmc_start_req+0x325/0x400 [mmc_core]
[12272.101471] [] mmc_blk_issue_rw_rq+0xe1/0xb50 [mmc_block]
[12272.101487] [] ? __mmc_claim_host+0x131/0x1c0 [mmc_core]
[12272.101501] [] mmc_blk_issue_rq+0x1d3/0x540 [mmc_block]
[12272.101509] [] ? blk_dequeue_request+0x88/0xd0
[12272.101522] [] mmc_queue_thread+0xc3/0x1c0 [mmc_block]
[12272.101535] [] ? mmc_blk_compat_ioctl+0x20/0x20 [mmc_block]
[12272.101543] [] kthread+0xc0/0xd0
[12272.101550] [] ? kthread_create_on_node+0x120/0x120
[12272.101558] [] ret_from_fork+0x7c/0xb0
[12272.101565] [] ? kthread_create_on_node+0x120/0x120
[12272.101570] ---[ end trace c0b8a10a2230b2df ]---
[12272.104585] DMA: Out of SW-IOMMU space for 4096 bytes at device 0000:86:09.1

It seems, nothing is being written to this SD card. Is it my laptop’s SD slot, or is there something wrong with the SD card? Well…. I’ll attempt to use an USB Card Reader in stead. But that thing also refuses with stange messages in smesg

[12585.412195] usb 6-2: new full-speed USB device number 13 using uhci_hcd
[12585.412716] DMA: Out of SW-IOMMU space for 8 bytes at device 0000:00:1d.2
[12585.615960] DMA: Out of SW-IOMMU space for 8 bytes at device 0000:00:1d.2
[12585.818833] usb 6-2: device not accepting address 13, error -11
[12585.818876] hub 6-0:1.0: unable to enumerate USB device on port 2

Rebooting the system doesn’t solve the problem. Even though no SD/MMC related error messages appear in the dmesg output, nothing is being written to the card. The USB card reader appears to be working after reboot. However, I am not sure if the image was written correctly this time. After writing the 2 GB image it appears to be hanging and dmesg shows


[ 1680.563508] INFO: task systemd-udevd:1853 blocked for more than 120 seconds.
[ 1680.563518] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 1680.563524] systemd-udevd D 0000000000000246 0 1853 127 0x00000004
[ 1680.563535] ffff88004bb8db10 0000000000000086 0000000000014340 ffff88004bb8dfd8
[ 1680.563545] ffff88004bb8dfd8 0000000000014340 ffff88012232b2a0 7fffffffffffffff
[ 1680.563552] ffff88004bb8db18 ffff88004bb8db10 ffff88012232b2a0 ffff88004bb8dad0
[ 1680.563559] Call Trace:
[ 1680.563578] [] ? wait_for_common+0x136/0x180
[ 1680.563588] [] ? wake_up_process+0x40/0x40
[ 1680.563595] [] ? wait_for_completion+0x1d/0x20
[ 1680.563603] [] schedule+0x29/0x70
[ 1680.563610] [] schedule_preempt_disabled+0x23/0x30
[ 1680.563617] [] __mutex_lock_slowpath+0x168/0x3b0
[ 1680.563656] [] mutex_lock+0x12/0x30
[ 1680.563664] [] __blkdev_get+0x6b/0x4e0
[ 1680.563671] [] blkdev_get+0x1c5/0x330
[ 1680.563677] [] blkdev_open+0x5b/0x80
[ 1680.563685] [] do_dentry_open+0x190/0x2b0
[ 1680.563693] [] ? __inode_permission+0x41/0xb0
[ 1680.563700] [] ? blkdev_get_by_dev+0x50/0x50
[ 1680.563707] [] finish_open+0x31/0x40
[ 1680.563714] [] do_last+0x2fa/0xf10
[ 1680.563721] [] path_openat+0xb0/0x4f0
[ 1680.563730] [] ? handle_mm_fault+0x2bd/0x650
[ 1680.563739] [] do_filp_open+0x38/0x80
[ 1680.563748] [] ? __alloc_fd+0xa7/0x130
[ 1680.563755] [] do_sys_open+0xe9/0x1c0
[ 1680.563762] [] SyS_open+0x1e/0x20
[ 1680.563771] [] system_call_fastpath+0x1a/0x1f

However, dd unfroze and appears to have completed normally.
[root@hplaptop raspberry_pi]# dd of=/dev/sdb if=archlinux-hf-2013-07-22.img bs=1M
1870+0 records gelezen
1870+0 records geschreven
1960837120 bytes (2,0 GB) gekopieerd, 367,65 s, 5,3 MB/s
1870+0 records gelezen
1870+0 records geschreven
1960837120 bytes (2,0 GB) gekopieerd, 612,42 s, 3,2 MB/s

Please note the multiple output due running

[root@hplaptop 1000]# while true; do kill -USR1 `pidof dd`; sleep 1; done

in another terminal window.

Anyways, I’m will obtain a new laptop soon. But that doesn’t mean this one has my permission to fall apart now. Well… it has some overheating issues, but I believe a little dusting will solve that. I just don’t feel like opening up this laptop before I have a working spare.

I mean… I have been writing about SD card problems in the past. I believe they’ve appeared especially when my laptop was running hot. But since I’m running it at 800 MHz, heat should not be an issue. However…. the problems with the USB card reader, I don’t know.

The BeagleBoard, the Raspberry Pi. They both use an SD card. The CubieBoard uses a µSD card. Basically the same card in a different form factor. Flash memory to store your operating system. As these ARM Boards commonly run a regular Linux distro compiled for ARM, usually logs are written to the file system, updates are installed frequently, and often you see an ext3 file system, which is a journalling file system. This all means there will be frequently written to an SD card in an ARM board, and knowing the write cycles of such a card are limited, makes you wonder, how long will it last. I believe I have hit the end of such an SD card yesterday night.

Kingston SD4/8GB

I bought this card, back in 2009 when I bought my BeagleBoard. When I first tried to use my BeagleBoard, I was stopped by the unstable USB bus, therefore it hasn’t been used much. The SD card has probably been used in cameras in the mean time. When I read the USB problems where probably hardware related and a capacitor might fix them, I’ve started using the BeagleBoard again, yet, experiencing various instability issues.

BeagleBoard Rev. C3

Regular crashes and rebooting, not good for the condition of a file system, and such fsck running on the file system, what are the results for write cycles? Anyhow, when I got my Raspberry Pi, I bought some 16 GB SD cards it. However, wanting to test RISCOS, I didn’t want to use such a 16 GB card for it. So I took this 8 GB card and wrote that image to it. RISCOS booted fine on the Raspberry Pi. However, now I think about it. I once had some boot problems, which disappeared as spontaneous as they came.

Now, I wanted to play around with my BeagleBoard again. I took the 8 GB SD card, I made an image of its contents (the RISCOS image), ran the BeagleBoard SD card script, to correctly partition it for use with a BeagleBoard, which also makes a FAT and ext3 file system. I wanted to try geexbox, an XBMC distro, which also has a version for OMAP3, which includes the BeagleBoard, IGEPv2, and others.

So, I copied the bootloader files to the FAT partition, the rootfs to the ext3 parition, put the card in the BeagleBoard and booted it up. This distro uses systemd, which is also in use by ArchLinux. Anyhow, I was conducting some experiments with the hdmi and svideo outputs of the BeagleBoard.

The HDMI to VGA converter worked fine with my Raspberry Pi and CubieBoard, so I was like, let’s give it a try on the BeagleBoard. Even though it would probably not work without modification to the BeagleBoard, as it shows here, it has overcurrent protection on the HDMI output. Such an HDMI to VGA adaptor without own power supply violates the HDMI/DVI specs and draws much more current from the HDMI port that officially allowed. Actually, the BeagleBoard is the only board (known to me) that restricts HDMI devices to the standards.

In general, specifications about maximal current drawn are violated everywhere, especially on USB busses. And then those cables with an extra USB plug to allow more current in case one port is restricted. Or USB fans, lights and even warming plates for a cup of coffee….. all just drawing current without any USB logic, no identification to the host. Well… enough ranting about that. What was I talking about?

Anyhow, after a few seconds the screen would go off, due the HDMI to VGA adaptor drawing too much current. I went to try the svideo output. Where the video output goes is a kernel parameter, so chaging the files in the boot partition and rebooting. Also note, the manual of the BeagleBoard states I should only (un)plug the cable from the HDMI port when the device is unpowered. Anyhow. When I plugged in the power supply again, nothing happened. Of course I was like, “WTF?!?!?!”. After measuring the power adaptor, it turned out this one just decided to die.

Dead power adaptor

This power adaptor belonged to an USB HUB I’ve decided to retire, as it was causing trouble on the USB bus. Please note this was a 4 port USB hub, and the adaptor is rated 2.5 Amps, as it should. Nowadays you see only 1 Amp for a 4 port USB hub. So, in these days, USB devices draw more power then they should, and USB hubs provide less power then they should. Can someone please explain how on earth this is supposed to work???

Anyhow, the fact the power adaptor just died may make me re-evaluate that USB hub, as its misbehaviour might be related to unstable power. Nevertheless, it’s an old hub, perhaps it even belongs to the first generation of USB 2.0 hubs?

IMG_0985

Anyhow, recently I had some more USB hub issues. I have announced a couple of time again I should write about them. And I should just do it otherwise it will never happen, as I have said I am supposed to write about a certain subject before, but never done in the end. But there are more things to write about so.

I almost forgot, I should still get to the point of this story. So, I had a booting geexbox distro, but I wasn’t able to get anything xbmc on the tv out for some reason. I decided to install ArchLinuxARM in stead. So, I formatted the ext3 partition again and copied the ArchLinuxARM OMAP3 root fs over, I copies the uImage over to the FAT partition, and….. it doesn’t boot. Kernel Panic! Cannot find init! and such. I’ve been testing all night, re-creating the file system, boot loader and everything. I couldn’t find anything wrong. But missing init? it’s right there! I’ve copied a statically linked “hello world” binary (compiled on the Raspberry Pi. ARMv6 Hard Float binaries run fine on ARMv7 Hard Float) over there to test, which ran perfectly fine.

In the end, I noticed the umount command was hanging, when unmounting the card on my laptop. Now, I believe this is related to the SD card malfunctioning. I’ve noticed this before, but I assumed this was some kind of bug instead.

While the umount command was hanging, in another terminal, we see data is being written to the card at a very slow rate:

[andre@hplaptop ~]$ iostat
Linux 3.6.11-1-ARCH (hplaptop) 25-01-13 _x86_64_ (2 CPU)

avg-cpu: %user %nice %system %iowait %steal %idle
9,95 0,00 4,02 21,73 0,00 64,30

Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn
sda 4,41 51,38 57,41 547377 611549
mmcblk0 0,61 0,35 28,54 3745 30402

When we look at dmesg, it doesn’t complain about anything to do with the sd card, but it noticed the umount being blocked for over two minutes.


[10680.535700] INFO: task umount:3089 blocked for more than 120 seconds.
[10680.535709] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[10680.535714] umount D ffff880127dd58b0 0 3089 2881 0x00000000
[10680.535724] ffff88011e23dc08 0000000000000086 ffff880127dd58b0 ffff88011e23dfd8
[10680.535733] ffff88011e23dfd8 ffff88011e23dfd8 ffffffff81814420 ffff880127dd58b0
[10680.535741] ffff880127f330a8 ffff88013fc13e70 ffff88011e23db98 ffffffff810145b3
[10680.535749] Call Trace:
[10680.535765] [] ? __switch_to+0x163/0x410
[10680.535776] [] ? finish_task_switch+0x49/0xe0
[10680.535787] [] schedule+0x29/0x70
[10680.535794] [] schedule_timeout+0x204/0x260
[10680.535802] [] ? check_preempt_curr+0x75/0xa0
[10680.535809] [] ? ttwu_stat+0xaa/0x120
[10680.535816] [] wait_for_common+0xcd/0x160
[10680.535824] [] ? try_to_wake_up+0x2f0/0x2f0
[10680.535831] [] wait_for_completion+0x1d/0x20
[10680.535841] [] writeback_inodes_sb_nr+0x85/0xb0
[10680.535849] [] ? sys_mknod+0x1/0x20
[10680.535886] [] writeback_inodes_sb+0x2e/0x40
[10680.535893] [] sync_filesystem+0x3d/0xb0
[10680.535902] [] generic_shutdown_super+0x3b/0xf0
[10680.535910] [] kill_block_super+0x30/0x80
[10680.535920] [] deactivate_locked_super+0x3c/0xa0
[10680.535927] [] deactivate_super+0x4e/0x70
[10680.535936] [] mntput_no_expire+0x101/0x160
[10680.535944] [] sys_umount+0x76/0x3a0
[10680.535953] [] system_call_fastpath+0x1a/0x1f

Anyhow, I declare this 8GB SD card deceased. Just another thought. As this “dying sd card” causes weird symptoms.

Edit: I believe the cause of the problems were rather different. During an update, the governor was set to ondemand again, in stead of powersave which I had configured. The issues were probably caused by overheating. I have experienced SD problems before related due overheating. I wonder why my laptop has to run at 800 MHz nowadays, while when it was new it ran at 2800 MHz without problems, but suddenly, overheating issues arrised.