Forum

Full Version: Xbian hangs when writing to USB hard drive
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Software
XBian version: Xbian 1.0 (knockout) (linux: kernel 3.18.8+)
XBMC/Kodi version: Kodi 14.2-BETA2 Git:2015-02-25-c4ce8e3-dirty
Overclock settings: default and high

Hardware
Device type and model: Raspberry Pi Model B 512 MB
Power supply rating: 5V 1A
SD card size and make/type: Kingston SDHC 8GB class 10 and Lexar SDHC 8GB class 10
Network (Ethernet or wireless): Ethernet
Connected devices: USB hard drive with its own power supply (Seagate Expansion 2TB), TV (HDMI)

Log files
Link to logfile(s):

Problem description:
Every time that any process writes to the USB hard drive the pi hangs, or it is unreachable via network at least (SSH, samba, deluge thinclient or web). All lights on the board are on. It happened for the first time while downloading torrents with deluge and it always happens while doing a live backup with a cronjob ("dd if=/dev/mmcblk0 of=/somefolderinthehd/image.img"). I realized that the pi doesn't hang if I limit the downloading speed in deluge (1MB/s) or if I run "dd if=/dev/mmcblk0 of=/somefolderinthehd/image.img" manually via SSH.

I would like to provide a log file, but I have to unplug the power cord when it happens and dmesg is overwritten on the next boot. I've tried to read the SD card from a live CD (Ubuntu), but it is not able to mount the btrfs partition. Is there any way to rotate dmesg logs?

I've changed "sync" to "async" in /etc/usbmount/usbmount.conf because writing rates were too low. I've also tried to mount the hard drive using "mount /dev/sda1 /somemountpoint". Mount options that I've tried:

usbmount: /dev/sda1 on /media/RaspberryPi type ext4 (rw,nodev,noexec,noatime,data=ordered)
mount command: /dev/sda1 on /media/RaspberryPi type ext4 (rw,relatime,data=ordered)

How to reproduce:
I have had the same result with several Xbian installations (two different SD cards). Xbian fresh install (default or high overclock), plug the USB hard drive and try to run the live backup described above as a cronjob.

I will try to reproduce the problem using other hard drive and other file system.

Workaround:
This workaround was posted by Fabio72 in this thread: http://forum.xbian.org/thread-2785-post-27555.html#pid27555

Verify the output of these commands:
Terminal
root@xbian:~# cat /sys/devices/platform/bcm2708_usb/regoffset
0xffffffff
root@xbian:~# cat /sys/devices/platform/bcm2708_usb/regvalue
invalid offset

Run:
Terminal
root@xbian:~# echo 08 > /sys/devices/platform/bcm2708_usb/regoffset
root@xbian:~# echo 0x31 > /sys/devices/platform/bcm2708_usb/regvalue

New output:
Terminal
root@xbian:~# cat /sys/devices/platform/bcm2708_usb/regoffset
0x00000008
root@xbian:~# cat /sys/devices/platform/bcm2708_usb/regvalue
Reg@0x000008 = 0x00000031
It seems to be working! Thank you so much, I've done what you say in your post, run "dd if=/dev/mmcblk0 of=/somefolderinthehd/image.img" as a cronjob and the pi is still working fine. I will keep testing it.

I still want to know if there is a way to rotate logs, so they are not overwritten on reboot (dmesg in particular).
Added the workaround to the first post.
Reference URL's